Skip to content

Instantly share code, notes, and snippets.

import torch
import gc
from typing import Dict, Any, Tuple, Optional
import comfy.model_management as model_management
import comfy.utils
class FastUNetMerger:
"""
Ultra-fast, low-memory UNet merger for ComfyUI
@marduk191
marduk191 / gist:c26be9b55f7a766d759494da3269ff4b
Created July 2, 2025 18:05
function call, saved so i don't forget the function lol
rem #Q2_k
set qversion=Q2_k
echo Quantizing "%fname%-%qversion%-%author%.gguf"
llama-quantize.exe "%output%-%mvers%-%author%.gguf" "%output%-%qversion%-%author%.gguf" %qversion%
timeout /t 3 /nobreak
rem #upload 2_k
echo uploading "%fname%-%qversion%-%author%.gguf"
huggingface-cli upload %reponame% "%output%-%qversion%-%author%.gguf" ./%fname%/"%fname%-%qversion%-%author%.gguf" --commit-message "uploaded %fname%-%qversion%-%author%.gguf"
@marduk191
marduk191 / minimal_safetensors_converter.py
Created June 30, 2025 01:54
Pt to safetensors converter with minimal checking. fp32 output
#!/usr/bin/env python3
"""
Minimal SafeTensors Converter
Converts PyTorch model files (.pt, .pth) to .safetensors format
Usage: python converter.py <input_path> [output_path]
by:marduk191
"""
import os
import sys
@marduk191
marduk191 / xcompose.py
Last active November 13, 2024 04:25
Comfyui Tranformers node for internlm-xcomposer2-4khd-7b
import torch
import os
import folder_paths
from transformers import AutoModel, AutoTokenizer
class InternLMXComposer2:
def __init__(self):
self.device = "cuda" if torch.cuda.is_available() else "cpu"
self.model = None
self.tokenizer = None
@marduk191
marduk191 / RusRoulette
Last active April 5, 2016 10:36
Russian roulette
#!/bin/bash
## Russian Roulette
## By marduk191
## email: [email protected]
#comment these out if you use an external list below
#live[0]="You live bitch!"
#live[1]="You haven't died YET!"
#live[2]="Still alive asshole!..."
@marduk191
marduk191 / hasteCLI
Last active March 17, 2016 17:48
A small shellscript for pasting to hastebin from the command line
Hastebin CLI
#Add to ~/.bashrc
haste() { a=$(cat); curl -X POST -s -d "$a" http://hastebin.com/documents | awk -F '"' '{print "http://hastebin.com/"$4}'; }
alias copy="xclip -selection c"
##Usage:
@marduk191
marduk191 / bconv.nemo_action
Last active March 15, 2016 21:32
Nemo action for converting bash scripts to binary from the right click menu. (uses shc)
[Nemo Action]
Name=bash2bin
Comment=Convert "%N" to binary
Exec=gnome-terminal --working-directory=%P -e "shc -f %F -o binary_out -r"
Icon-Name=gtk-execute
Selection=notnone
Extensions=sh;bash;
Quote=double
@marduk191
marduk191 / vh_termbin_install.sh
Last active November 11, 2021 02:49
This is a shell script to install command line "termbin" online paste service from virtualhacker.net
#!/bin/bash
## Termbin installer
## By marduk191
## email: [email protected]
printf "%s\n" "Checking dependencies"
if ! dpkg-query -W netcat | grep .
then printf "%s\n" "netcat isn't installed. Setting up netcat."
gksudo apt-get install netcat
@marduk191
marduk191 / push
Created February 6, 2016 07:32
My kodi release script
#!/bin/bash
## Kodi Repo tool frontend
## By marduk191
## email: [email protected]
while getopts ":sf" flags;
do
case $flags in
s)
git add .
git commit -a
@marduk191
marduk191 / addon3.xml
Created February 6, 2016 06:44
Kodi repository addon.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="repository.yourname" name="Your Addons" version="0.1.2" provider-name="You">
<extension point="xbmc.addon.repository" name="Your addons">
<info compressed="false">https://raw.githubusercontent.com/you/your_repo_folder/master/addons.xml</info>
<checksum>https://raw.githubusercontent.com/you/your_repo_folder/master/addons.xml.md5</checksum>
<datadir zip="true">https://raw.githubusercontent.com/you/your_repo_folder/master/</datadir>
</extension>
<extension point="xbmc.addon.metadata">
<summary lang="en_GB">Your Kodi Addons</summary>
<description lang="en_GB">Your Kodi repository description.</description>