Update README.md
Browse files
README.md
CHANGED
|
@@ -30,73 +30,6 @@ If your SSD is constantly out of space, this project allows you to stream model
|
|
| 30 |
|
| 31 |
---
|
| 32 |
|
| 33 |
-
### How to Install the Custom Node in ComfyUI
|
| 34 |
-
|
| 35 |
-
1. Go to your ComfyUI directory: `ComfyUI/custom_nodes/`.
|
| 36 |
-
2. Create a folder named `ComfyUI-Viking-ZeroDisk`.
|
| 37 |
-
3. Create a file named `__init__.py` inside that folder.
|
| 38 |
-
4. Copy and paste the node code below into `__init__.py`:
|
| 39 |
-
|
| 40 |
-
```python
|
| 41 |
-
import gc
|
| 42 |
-
import requests
|
| 43 |
-
import torch
|
| 44 |
-
from safetensors.torch import load
|
| 45 |
-
import comfy.sd
|
| 46 |
-
|
| 47 |
-
class VikingHFLoraLoader:
|
| 48 |
-
@classmethod
|
| 49 |
-
def INPUT_TYPES(s):
|
| 50 |
-
return {
|
| 51 |
-
"required": {
|
| 52 |
-
"model": ("MODEL",),
|
| 53 |
-
"clip": ("CLIP",),
|
| 54 |
-
"repo_id": ("STRING", {"default": "OrakulStorm/Zero-Disk-VRAM-Streaming-Engine"}),
|
| 55 |
-
"filename": ("STRING", {"default": "Horror/model.safetensors"}),
|
| 56 |
-
"hf_token": ("STRING", {"default": ""}),
|
| 57 |
-
"strength_model": ("FLOAT", {"default": 1.0, "min": -10.0, "max": 10.0, "step": 0.01}),
|
| 58 |
-
"strength_clip": ("FLOAT", {"default": 1.0, "min": -10.0, "max": 10.0, "step": 0.01}),
|
| 59 |
-
}
|
| 60 |
-
}
|
| 61 |
-
|
| 62 |
-
RETURN_TYPES = ("MODEL", "CLIP")
|
| 63 |
-
FUNCTION = "load_lora_transit"
|
| 64 |
-
CATEGORY = "Viking Engine/Network"
|
| 65 |
-
|
| 66 |
-
def load_lora_transit(self, model, clip, repo_id, filename, hf_token, strength_model, strength_clip):
|
| 67 |
-
path = filename.strip().strip('"').strip("'").replace("\\", "/").lstrip("/")
|
| 68 |
-
url = f"https://huggingface.co/{repo_id.strip()}/resolve/main/{path}"
|
| 69 |
-
|
| 70 |
-
headers = {}
|
| 71 |
-
if hf_token.strip():
|
| 72 |
-
headers["Authorization"] = f"Bearer {hf_token.strip()}"
|
| 73 |
-
|
| 74 |
-
print(f"[VikingHF] 🌐 Streaming {path} from {repo_id}...")
|
| 75 |
-
response = requests.get(url, headers=headers)
|
| 76 |
-
response.raise_for_status()
|
| 77 |
-
|
| 78 |
-
lora_state_dict = load(response.content)
|
| 79 |
-
del response
|
| 80 |
-
|
| 81 |
-
print("[VikingHF] ⚡ Patching weights into MODEL & CLIP...")
|
| 82 |
-
model_lora, clip_lora = comfy.sd.load_lora_for_models(
|
| 83 |
-
model, clip, lora_state_dict, strength_model, strength_clip
|
| 84 |
-
)
|
| 85 |
-
|
| 86 |
-
del lora_state_dict
|
| 87 |
-
gc.collect()
|
| 88 |
-
if torch.cuda.is_available():
|
| 89 |
-
torch.cuda.empty_cache()
|
| 90 |
-
|
| 91 |
-
return (model_lora, clip_lora)
|
| 92 |
-
|
| 93 |
-
NODE_CLASS_MAPPINGS = { "VikingHFLoraLoader": VikingHFLoraLoader }
|
| 94 |
-
NODE_DISPLAY_NAME_MAPPINGS = { "VikingHFLoraLoader": "Viking HF LoRA (Zero-Disk)" }
|
| 95 |
-
```
|
| 96 |
-
|
| 97 |
-
5. Restart ComfyUI.
|
| 98 |
-
|
| 99 |
-
---
|
| 100 |
|
| 101 |
### How to Use
|
| 102 |
1. In ComfyUI, add the **Viking HF LoRA (Zero-Disk)** node.
|
|
|
|
| 30 |
|
| 31 |
---
|
| 32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
### How to Use
|
| 35 |
1. In ComfyUI, add the **Viking HF LoRA (Zero-Disk)** node.
|