Instructions to use saik0s/comfy_backup with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use saik0s/comfy_backup with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="saik0s/comfy_backup", filename="ComfyUI/models/text_encoders/gemma-3-12b-it-q2_k.gguf", )
llm.create_chat_completion( messages = "No input example has been defined for this model task." )
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use saik0s/comfy_backup with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf saik0s/comfy_backup:Q4_K_S # Run inference directly in the terminal: llama cli -hf saik0s/comfy_backup:Q4_K_S
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf saik0s/comfy_backup:Q4_K_S # Run inference directly in the terminal: llama cli -hf saik0s/comfy_backup:Q4_K_S
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf saik0s/comfy_backup:Q4_K_S # Run inference directly in the terminal: ./llama-cli -hf saik0s/comfy_backup:Q4_K_S
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf saik0s/comfy_backup:Q4_K_S # Run inference directly in the terminal: ./build/bin/llama-cli -hf saik0s/comfy_backup:Q4_K_S
Use Docker
docker model run hf.co/saik0s/comfy_backup:Q4_K_S
- LM Studio
- Jan
- Ollama
How to use saik0s/comfy_backup with Ollama:
ollama run hf.co/saik0s/comfy_backup:Q4_K_S
- Unsloth Studio
How to use saik0s/comfy_backup with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for saik0s/comfy_backup to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for saik0s/comfy_backup to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for saik0s/comfy_backup to start chatting
- Pi
How to use saik0s/comfy_backup with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf saik0s/comfy_backup:Q4_K_S
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "saik0s/comfy_backup:Q4_K_S" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use saik0s/comfy_backup with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf saik0s/comfy_backup:Q4_K_S
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default saik0s/comfy_backup:Q4_K_S
Run Hermes
hermes
- Atomic Chat new
- OpenClaw new
How to use saik0s/comfy_backup with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf saik0s/comfy_backup:Q4_K_S
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "saik0s/comfy_backup:Q4_K_S" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
- Docker Model Runner
How to use saik0s/comfy_backup with Docker Model Runner:
docker model run hf.co/saik0s/comfy_backup:Q4_K_S
- Lemonade
How to use saik0s/comfy_backup with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull saik0s/comfy_backup:Q4_K_S
Run and chat with the model
lemonade run user.comfy_backup-Q4_K_S
List all available models
lemonade list
| import torch | |
| from torch import Tensor | |
| from .flux.layers import DoubleStreamBlockIPA, SingleStreamBlockIPA | |
| from comfy.ldm.flux.layers import timestep_embedding | |
| from types import MethodType | |
| def FluxUpdateModules(bi, ip_attn_procs, image_emb): | |
| flux_model = bi.model | |
| bi.add_object_patch(f"diffusion_model.forward_orig", MethodType(forward_orig_ipa, flux_model.diffusion_model)) | |
| for i, original in enumerate(flux_model.diffusion_model.double_blocks): | |
| patch_name = f"double_blocks.{i}" | |
| maybe_patched_layer = bi.get_model_object(f"diffusion_model.{patch_name}") | |
| # if there's already a patch there, collect its adapters and replace it | |
| procs = [ip_attn_procs[patch_name]] | |
| embs = [image_emb] | |
| if isinstance(maybe_patched_layer, DoubleStreamBlockIPA): | |
| procs = maybe_patched_layer.ip_adapter + procs | |
| embs = maybe_patched_layer.image_emb + embs | |
| # initial ipa models with image embeddings | |
| new_layer = DoubleStreamBlockIPA(original, procs, embs) | |
| # for example, ComfyUI internally uses model.add_patches to add loras | |
| bi.add_object_patch(f"diffusion_model.{patch_name}", new_layer) | |
| for i, original in enumerate(flux_model.diffusion_model.single_blocks): | |
| patch_name = f"single_blocks.{i}" | |
| maybe_patched_layer = bi.get_model_object(f"diffusion_model.{patch_name}") | |
| procs = [ip_attn_procs[patch_name]] | |
| embs = [image_emb] | |
| if isinstance(maybe_patched_layer, SingleStreamBlockIPA): | |
| procs = maybe_patched_layer.ip_adapter + procs | |
| embs = maybe_patched_layer.image_emb + embs | |
| # initial ipa models with image embeddings | |
| new_layer = SingleStreamBlockIPA(original, procs, embs) | |
| bi.add_object_patch(f"diffusion_model.{patch_name}", new_layer) | |
| def is_model_pathched(model): | |
| def test(mod): | |
| if isinstance(mod, DoubleStreamBlockIPA): | |
| return True | |
| else: | |
| for p in mod.children(): | |
| if test(p): | |
| return True | |
| return False | |
| result = test(model) | |
| return result | |
| def forward_orig_ipa( | |
| self, | |
| img: Tensor, | |
| img_ids: Tensor, | |
| txt: Tensor, | |
| txt_ids: Tensor, | |
| timesteps: Tensor, | |
| y: Tensor, | |
| guidance: Tensor|None = None, | |
| control=None, | |
| transformer_options={}, | |
| attn_mask: Tensor = None, | |
| ) -> Tensor: | |
| patches_replace = transformer_options.get("patches_replace", {}) | |
| if img.ndim != 3 or txt.ndim != 3: | |
| raise ValueError("Input img and txt tensors must have 3 dimensions.") | |
| # running on sequences img | |
| img = self.img_in(img) | |
| vec = self.time_in(timestep_embedding(timesteps, 256).to(img.dtype)) | |
| if self.params.guidance_embed: | |
| if guidance is None: | |
| raise ValueError("Didn't get guidance strength for guidance distilled model.") | |
| vec = vec + self.guidance_in(timestep_embedding(guidance, 256).to(img.dtype)) | |
| vec = vec + self.vector_in(y[:,:self.params.vec_in_dim]) | |
| txt = self.txt_in(txt) | |
| ids = torch.cat((txt_ids, img_ids), dim=1) | |
| pe = self.pe_embedder(ids) | |
| blocks_replace = patches_replace.get("dit", {}) | |
| for i, block in enumerate(self.double_blocks): | |
| if ("double_block", i) in blocks_replace: | |
| def block_wrap(args): | |
| out = {} | |
| if isinstance(block, DoubleStreamBlockIPA): # ipadaper | |
| out["img"], out["txt"] = block(img=args["img"], txt=args["txt"], vec=args["vec"], pe=args["pe"], t=args["timesteps"], attn_mask=args.get("attn_mask")) | |
| else: | |
| out["img"], out["txt"] = block(img=args["img"], txt=args["txt"], vec=args["vec"], pe=args["pe"], attn_mask=args.get("attn_mask")) | |
| return out | |
| out = blocks_replace[("double_block", i)]({"img": img, "txt": txt, "vec": vec, "pe": pe, "timesteps": timesteps, "attn_mask": attn_mask}, {"original_block": block_wrap}) | |
| txt = out["txt"] | |
| img = out["img"] | |
| else: | |
| if isinstance(block, DoubleStreamBlockIPA): # ipadaper | |
| img, txt = block(img=img, txt=txt, vec=vec, pe=pe, t=timesteps, attn_mask=attn_mask) | |
| else: | |
| img, txt = block(img=img, txt=txt, vec=vec, pe=pe, attn_mask=attn_mask) | |
| if control is not None: # Controlnet | |
| control_i = control.get("input") | |
| if i < len(control_i): | |
| add = control_i[i] | |
| if add is not None: | |
| img += add | |
| img = torch.cat((txt, img), 1) | |
| for i, block in enumerate(self.single_blocks): | |
| if ("single_block", i) in blocks_replace: | |
| def block_wrap(args): | |
| out = {} | |
| if isinstance(block, SingleStreamBlockIPA): # ipadaper | |
| out["img"] = block(args["img"], vec=args["vec"], pe=args["pe"], t=args["timesteps"], attn_mask=args.get("attn_mask")) | |
| else: | |
| out["img"] = block(args["img"], vec=args["vec"], pe=args["pe"], attn_mask=args.get("attn_mask")) | |
| return out | |
| out = blocks_replace[("single_block", i)]({"img": img, "vec": vec, "pe": pe, "timesteps": timesteps, "attn_mask": attn_mask}, {"original_block": block_wrap}) | |
| img = out["img"] | |
| else: | |
| if isinstance(block, SingleStreamBlockIPA): # ipadaper | |
| img = block(img, vec=vec, pe=pe, t=timesteps, attn_mask=attn_mask) | |
| else: | |
| img = block(img, vec=vec, pe=pe, attn_mask=attn_mask) | |
| if control is not None: # Controlnet | |
| control_o = control.get("output") | |
| if i < len(control_o): | |
| add = control_o[i] | |
| if add is not None: | |
| img[:, txt.shape[1] :, ...] += add | |
| img = img[:, txt.shape[1] :, ...] | |
| img = self.final_layer(img, vec) # (N, T, patch_size ** 2 * out_channels) | |
| return img |