From e98048093c80eb7dc240fa0ab9c0403ef7aa11d1 Mon Sep 17 00:00:00 2001
From: Zuellni <123005779+Zuellni@users.noreply.github.com>
Date: Fri, 6 Dec 2024 15:22:11 +0100
Subject: [PATCH] Fix typo in js script, add printing to console for preview
node, remove deprecated config option
---
README.md | 5 -----
exllama.py | 23 +++++++----------------
text.js | 2 +-
text.py | 4 +++-
4 files changed, 11 insertions(+), 23 deletions(-)
diff --git a/README.md b/README.md
index 94f7cce..25905fe 100644
--- a/README.md
+++ b/README.md
@@ -43,11 +43,6 @@ git clone https://huggingface.co/turboderp/Llama-3.1-8B-Instruct-exl2 -b 4.0bpw
cache_bits |
A lower value reduces VRAM usage, but also affects generation speed and quality. |
-
- |
- fast_tensors |
- Enabling reduces RAM usage and speeds up model loading. |
-
|
flash_attention |
diff --git a/exllama.py b/exllama.py
index e47c453..64e6d3c 100644
--- a/exllama.py
+++ b/exllama.py
@@ -27,12 +27,11 @@ from folder_paths import add_model_folder_path, get_folder_paths, models_dir
_CATEGORY = "zuellni/exllama"
_MAPPING = "ZuellniExLlama"
-class Loader:
- _input_info = None
+class Loader:
@classmethod
def INPUT_TYPES(cls):
- def get_input_info(cls):
+ if not cls._MODELS:
add_model_folder_path("llm", str(Path(models_dir) / "llm"))
for folder in get_folder_paths("llm"):
@@ -41,21 +40,14 @@ class Loader:
parent = path.relative_to(folder).parent
cls._MODELS[str(parent / path.name)] = path
- models = list(cls._MODELS.keys())
- caches = list(cls._CACHES.keys())
- default = models[0] if models else None
-
- return models, caches, default
-
- if Loader._input_info is None:
- Loader._input_info = get_input_info(cls)
- models, caches, default = Loader._input_info
+ models = list(cls._MODELS.keys())
+ caches = list(cls._CACHES.keys())
+ default = models[0] if models else None
return {
"required": {
"model": (models, {"default": default}),
"cache_bits": (caches, {"default": 4}),
- "fast_tensors": ("BOOLEAN", {"default": True}),
"flash_attention": ("BOOLEAN", {"default": True}),
"max_seq_len": (
"INT",
@@ -76,12 +68,11 @@ class Loader:
RETURN_NAMES = ("MODEL",)
RETURN_TYPES = ("EXL_MODEL",)
- def setup(self, model, cache_bits, fast_tensors, flash_attention, max_seq_len):
+ def setup(self, model, cache_bits, flash_attention, max_seq_len):
self.unload()
self.cache_bits = cache_bits
self.config = ExLlamaV2Config(__class__._MODELS[model])
- self.config.fasttensors = fast_tensors
self.config.no_flash_attn = not flash_attention
if max_seq_len:
@@ -328,7 +319,7 @@ class Generator:
if not settings:
settings = ExLlamaV2Sampler.Settings()
- settings.greedy()
+ settings = settings.greedy()
job = ExLlamaV2DynamicJob(
input_ids=tokens,
diff --git a/text.js b/text.js
index 09f1138..dc0e449 100644
--- a/text.js
+++ b/text.js
@@ -3,7 +3,7 @@ import { app } from "../../../scripts/app.js"
app.registerExtension({
name: "ZuellniText",
async beforeRegisterNodeDef(nodeType, nodeData, app) {
- if (nodeData.category != "Zuellni/Text")
+ if (nodeData.category != "zuellni/text")
return
const onNodeCreated = nodeType.prototype.onNodeCreated
diff --git a/text.py b/text.py
index 13a94c9..07762bd 100644
--- a/text.py
+++ b/text.py
@@ -71,6 +71,7 @@ class Preview:
return {
"required": {
"text": ("STRING", {"default": "", "forceInput": True}),
+ "print_to_console": ("BOOLEAN", {"default": False}),
"output": ("STRING", {"default": "", "multiline": True}),
}
}
@@ -80,7 +81,8 @@ class Preview:
OUTPUT_NODE = True
RETURN_TYPES = ()
- def preview(self, text, output):
+ def preview(self, text, print_to_console, output):
+ print_to_console and print(text)
return {"ui": {"text": [text]}}