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
| # ================================================ | |
| # File: api/huggingface.py | |
| # ================================================ | |
| import requests | |
| import json | |
| from typing import List, Optional, Dict, Any, Union | |
| # Try to import huggingface_hub for better downloads | |
| try: | |
| from huggingface_hub import hf_hub_download, snapshot_download | |
| HF_HUB_AVAILABLE = True | |
| except ImportError: | |
| HF_HUB_AVAILABLE = False | |
| print("[HuggingFace API] huggingface_hub not available, falling back to manual downloads") | |
| # Try to use huggingface_hub CLI as fallback | |
| import subprocess | |
| import sys | |
| class HuggingFaceAPI: | |
| """Simple wrapper for interacting with the HuggingFace API.""" | |
| BASE_URL = "https://huggingface.co/api" | |
| def __init__(self, api_key: Optional[str] = None): | |
| self.api_key = api_key | |
| self.base_headers = {'Content-Type': 'application/json'} | |
| if api_key: | |
| self.base_headers["Authorization"] = f"Bearer {api_key}" | |
| print("[HuggingFace API] Using HF token for private repositories.") | |
| else: | |
| print("[HuggingFace API] No HF token provided. Only public repositories accessible.") | |
| def _get_request_headers(self, method: str, has_json_data: bool) -> Dict[str, str]: | |
| """Returns headers for a specific request.""" | |
| headers = self.base_headers.copy() | |
| # Don't send content-type for GET/HEAD if no json_data | |
| if method.upper() in ["GET", "HEAD"] and not has_json_data: | |
| headers.pop('Content-Type', None) | |
| return headers | |
| def _request(self, method: str, endpoint: str, params: Optional[Dict] = None, | |
| json_data: Optional[Dict] = None, stream: bool = False, | |
| allow_redirects: bool = True, timeout: int = 30) -> Union[Dict[str, Any], requests.Response, None]: | |
| """Makes a request to the HuggingFace API and handles basic errors.""" | |
| url = f"{self.BASE_URL}/{endpoint.lstrip('/')}" | |
| request_headers = self._get_request_headers(method, json_data is not None) | |
| try: | |
| response = requests.request( | |
| method, | |
| url, | |
| headers=request_headers, | |
| params=params, | |
| json=json_data, | |
| stream=stream, | |
| allow_redirects=allow_redirects, | |
| timeout=timeout | |
| ) | |
| response.raise_for_status() # Raise HTTPError for bad responses (4xx or 5xx) | |
| if stream: | |
| return response # Return the response object for streaming | |
| # Handle No Content response (e.g., 204) | |
| if response.status_code == 204 or not response.content: | |
| return None | |
| return response.json() | |
| except requests.exceptions.HTTPError as http_err: | |
| error_detail = None | |
| status_code = http_err.response.status_code | |
| try: | |
| error_detail = http_err.response.json() | |
| except json.JSONDecodeError: | |
| error_detail = http_err.response.text[:200] # First 200 chars | |
| print(f"HuggingFace API HTTP Error ({method} {url}): Status {status_code}, Response: {error_detail}") | |
| # Return a structured error dictionary | |
| return {"error": f"HTTP Error: {status_code}", "details": error_detail, "status_code": status_code} | |
| except requests.exceptions.RequestException as req_err: | |
| print(f"HuggingFace API Request Error ({method} {url}): {req_err}") | |
| return {"error": str(req_err), "details": None, "status_code": None} | |
| except json.JSONDecodeError as json_err: | |
| print(f"HuggingFace API Error: Failed to decode JSON response from {url}: {json_err}") | |
| # Include response text if possible and not streaming | |
| response_text = response.text[:200] if not stream and hasattr(response, 'text') else "N/A" | |
| return {"error": "Invalid JSON response", "details": response_text, "status_code": response.status_code if hasattr(response, 'status_code') else None} | |
| def search_models(self, query: str, limit: int = 20) -> Optional[Dict[str, Any]]: | |
| """Searches for models on HuggingFace. (GET /models)""" | |
| endpoint = "/models" | |
| params = { | |
| "search": query, | |
| "limit": limit | |
| } | |
| result = self._request("GET", endpoint, params=params) | |
| if isinstance(result, dict) and "error" in result: | |
| return result | |
| return result | |
| def search_models_meili(self, query: str = None, types: Optional[List[str]] = None, | |
| base_models: Optional[List[str]] = None, | |
| sort: str = 'Most Downloaded', limit: int = 20, page: int = 1, | |
| nsfw: Optional[bool] = None) -> Optional[Dict[str, Any]]: | |
| """Searches models using HuggingFace's Meilisearch endpoint.""" | |
| meili_url = "https://huggingface.co/multi-search" | |
| headers = {'Content-Type': 'application/json'} | |
| if self.api_key: | |
| headers['Authorization'] = f'Bearer {self.api_key}' | |
| # Build search query | |
| search_query = { | |
| "q": query or "", | |
| "limit": limit, | |
| "offset": (page - 1) * limit | |
| } | |
| # Add filters | |
| filters = [] | |
| # Type filters | |
| if types: | |
| type_filter = {"type": types} | |
| filters.append(type_filter) | |
| # Base model filters | |
| if base_models: | |
| base_filter = {"base_model": base_models} | |
| filters.append(base_filter) | |
| # NSFW filter | |
| if nsfw is not None: | |
| nsfw_filter = {"nsfw": nsfw} | |
| filters.append(nsfw_filter) | |
| if filters: | |
| search_query["filters"] = filters | |
| # Add sorting | |
| sort_mapping = { | |
| "Relevancy": "id:desc", | |
| "Most Downloaded": "metrics.downloadCount:desc", | |
| "Highest Rated": "metrics.thumbsUpCount:desc", | |
| "Most Liked": "metrics.favoriteCount:desc", | |
| "Most Discussed": "metrics.commentCount:desc", | |
| "Most Collected": "metrics.collectedCount:desc", | |
| "Most Buzz": "metrics.tippedAmountCount:desc", | |
| "Newest": "createdAt:desc", | |
| } | |
| if sort in sort_mapping: | |
| search_query["sort"] = [sort_mapping[sort]] | |
| try: | |
| response = requests.post(meili_url, json=search_query, headers=headers, timeout=30) | |
| response.raise_for_status() | |
| return response.json() | |
| except requests.exceptions.RequestException as e: | |
| print(f"HuggingFace Meili API Error: {e}") | |
| return {"error": str(e), "status_code": getattr(e.response, 'status_code', None) if hasattr(e, 'response') else None} | |
| def get_model_files(self, model_id: str) -> Optional[Dict[str, Any]]: | |
| """Gets files for a specific HuggingFace model. Uses huggingface_hub instead of API.""" | |
| # Skip API calls, let huggingface_hub handle everything | |
| print(f"[HuggingFace API] Skipping file listing, using huggingface_hub auto-detect for {model_id}") | |
| return {"auto_detect": True} | |
| def get_model_info(self, model_id: str) -> Optional[Dict[str, Any]]: | |
| """Gets information about a model by its ID. Uses huggingface_hub instead of API.""" | |
| # Skip API calls, let huggingface_hub handle everything | |
| print(f"[HuggingFace API] Skipping model info, using huggingface_hub auto-detect for {model_id}") | |
| return {"id": model_id, "name": model_id.split('/')[-1]} | |
| def get_model_version_info(self, version_id: str) -> Optional[Dict[str, Any]]: | |
| """Gets version information - not applicable for HuggingFace, returns empty dict""" | |
| # HuggingFace doesn't have version IDs like Civitai | |
| # This method is kept for compatibility but returns empty | |
| return {} | |
| def download_file(self, model_id: str, filename: str, local_dir: str = None) -> Optional[Union[requests.Response, str]]: | |
| """Downloads a specific file from HuggingFace. Uses only huggingface_hub.""" | |
| if not HF_HUB_AVAILABLE: | |
| print("[HuggingFace API] huggingface_hub not available") | |
| return None | |
| if not local_dir: | |
| print("[HuggingFace API] local_dir not specified") | |
| return None | |
| try: | |
| print(f"[HuggingFace API] Using huggingface_hub for download: {model_id}/{filename}") | |
| if filename is None: | |
| # Download entire repo using snapshot_download | |
| print(f"[HuggingFace API] Downloading entire repo {model_id}") | |
| result = snapshot_download( | |
| repo_id=model_id, | |
| local_dir=local_dir, | |
| token=self.api_key | |
| ) | |
| print(f"[HuggingFace API] snapshot_download success: {result}") | |
| return result | |
| else: | |
| # Download specific file using hf_hub_download | |
| result = hf_hub_download( | |
| repo_id=model_id, | |
| filename=filename, | |
| local_dir=local_dir, | |
| resume_download=True, | |
| token=self.api_key | |
| ) | |
| print(f"[HuggingFace API] hf_hub_download success: {result}") | |
| return result | |
| except Exception as e: | |
| print(f"[HuggingFace API] huggingface_hub download failed: {e}") | |
| return None | |