From bef6a0d3cb36f8cd3c615b3c4424cf9da4016d6a Mon Sep 17 00:00:00 2001
From: Zuellni <123005779+Zuellni@users.noreply.github.com>
Date: Fri, 23 Aug 2024 22:21:47 +0200
Subject: [PATCH] Fix default values not showing in preview
---
.gitignore | 160 -----------------------------------------------------
README.md | 4 +-
exllama.py | 50 ++++++++++++-----
text.js | 2 +-
text.py | 26 +++++----
5 files changed, 56 insertions(+), 186 deletions(-)
delete mode 100644 .gitignore
diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index 68bc17f..0000000
--- a/.gitignore
+++ /dev/null
@@ -1,160 +0,0 @@
-# Byte-compiled / optimized / DLL files
-__pycache__/
-*.py[cod]
-*$py.class
-
-# C extensions
-*.so
-
-# Distribution / packaging
-.Python
-build/
-develop-eggs/
-dist/
-downloads/
-eggs/
-.eggs/
-lib/
-lib64/
-parts/
-sdist/
-var/
-wheels/
-share/python-wheels/
-*.egg-info/
-.installed.cfg
-*.egg
-MANIFEST
-
-# PyInstaller
-# Usually these files are written by a python script from a template
-# before PyInstaller builds the exe, so as to inject date/other infos into it.
-*.manifest
-*.spec
-
-# Installer logs
-pip-log.txt
-pip-delete-this-directory.txt
-
-# Unit test / coverage reports
-htmlcov/
-.tox/
-.nox/
-.coverage
-.coverage.*
-.cache
-nosetests.xml
-coverage.xml
-*.cover
-*.py,cover
-.hypothesis/
-.pytest_cache/
-cover/
-
-# Translations
-*.mo
-*.pot
-
-# Django stuff:
-*.log
-local_settings.py
-db.sqlite3
-db.sqlite3-journal
-
-# Flask stuff:
-instance/
-.webassets-cache
-
-# Scrapy stuff:
-.scrapy
-
-# Sphinx documentation
-docs/_build/
-
-# PyBuilder
-.pybuilder/
-target/
-
-# Jupyter Notebook
-.ipynb_checkpoints
-
-# IPython
-profile_default/
-ipython_config.py
-
-# pyenv
-# For a library or package, you might want to ignore these files since the code is
-# intended to run in multiple environments; otherwise, check them in:
-# .python-version
-
-# pipenv
-# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
-# However, in case of collaboration, if having platform-specific dependencies or dependencies
-# having no cross-platform support, pipenv may install dependencies that don't work, or not
-# install all needed dependencies.
-#Pipfile.lock
-
-# poetry
-# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
-# This is especially recommended for binary packages to ensure reproducibility, and is more
-# commonly ignored for libraries.
-# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
-#poetry.lock
-
-# pdm
-# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
-#pdm.lock
-# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
-# in version control.
-# https://pdm.fming.dev/#use-with-ide
-.pdm.toml
-
-# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
-__pypackages__/
-
-# Celery stuff
-celerybeat-schedule
-celerybeat.pid
-
-# SageMath parsed files
-*.sage.py
-
-# Environments
-.env
-.venv
-env/
-venv/
-ENV/
-env.bak/
-venv.bak/
-
-# Spyder project settings
-.spyderproject
-.spyproject
-
-# Rope project settings
-.ropeproject
-
-# mkdocs documentation
-/site
-
-# mypy
-.mypy_cache/
-.dmypy.json
-dmypy.json
-
-# Pyre type checker
-.pyre/
-
-# pytype static type analyzer
-.pytype/
-
-# Cython debug symbols
-cython_debug/
-
-# PyCharm
-# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
-# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
-# and can be added to the global gitignore or merged into this file. For a more nuclear
-# option (not recommended) you can uncomment the following to ignore the entire idea folder.
-#.idea/
diff --git a/README.md b/README.md
index 9cda4ff..94f7cce 100644
--- a/README.md
+++ b/README.md
@@ -125,12 +125,12 @@ git clone https://huggingface.co/turboderp/Llama-3.1-8B-Instruct-exl2 -b 4.0bpw
| String |
- A string. That's it. |
+ A string constant. |
## Workflow
An example workflow is embedded in the image below and can be opened in ComfyUI.
-
+
diff --git a/exllama.py b/exllama.py
index b5d713f..179737a 100644
--- a/exllama.py
+++ b/exllama.py
@@ -24,7 +24,7 @@ from comfy.model_management import soft_empty_cache, unload_all_models
from comfy.utils import ProgressBar
from folder_paths import add_model_folder_path, get_folder_paths, models_dir
-_CATEGORY = "Zuellni/ExLlama"
+_CATEGORY = "zuellni/exllama"
_MAPPING = "ZuellniExLlama"
@@ -49,7 +49,10 @@ class Loader:
"cache_bits": (caches, {"default": 4}),
"fast_tensors": ("BOOLEAN", {"default": True}),
"flash_attention": ("BOOLEAN", {"default": True}),
- "max_seq_len": ("INT", {"default": 2048, "max": 2**20, "step": 256}),
+ "max_seq_len": (
+ "INT",
+ {"default": 2048, "min": 0, "max": 2**20, "step": 256},
+ ),
}
}
@@ -179,7 +182,7 @@ class Tokenizer:
return {
"required": {
"model": ("EXL_MODEL",),
- "text": ("STRING", {"forceInput": True}),
+ "text": ("STRING", {"default": "", "forceInput": True}),
"add_bos_token": ("BOOLEAN", {"default": True}),
"encode_special_tokens": ("BOOLEAN", {"default": True}),
}
@@ -205,14 +208,35 @@ class Settings:
def INPUT_TYPES(cls):
return {
"required": {
- "temperature": ("FLOAT", {"default": 1, "max": 10, "step": 0.01}),
- "penalty": ("FLOAT", {"default": 1, "min": 1, "max": 10, "step": 0.01}),
- "top_k": ("INT", {"default": 1, "max": 1000}),
- "top_p": ("FLOAT", {"max": 1, "step": 0.01}),
- "top_a": ("FLOAT", {"max": 1, "step": 0.01}),
- "min_p": ("FLOAT", {"max": 1, "step": 0.01}),
- "tfs": ("FLOAT", {"max": 1, "step": 0.01}),
- "typical": ("FLOAT", {"max": 1, "step": 0.01}),
+ "temperature": (
+ "FLOAT",
+ {"default": 1.0, "min": 0.0, "max": 10.0, "step": 0.01},
+ ),
+ "penalty": (
+ "FLOAT",
+ {"default": 1.0, "min": 1.0, "max": 10.0, "step": 0.01},
+ ),
+ "top_k": ("INT", {"default": 1, "min": 0, "max": 1000}),
+ "top_p": (
+ "FLOAT",
+ {"default": 0.0, "min": 0.0, "max": 1.0, "step": 0.01},
+ ),
+ "top_a": (
+ "FLOAT",
+ {"default": 0.0, "min": 0.0, "max": 1.0, "step": 0.01},
+ ),
+ "min_p": (
+ "FLOAT",
+ {"default": 0.0, "min": 0.0, "max": 1.0, "step": 0.01},
+ ),
+ "tfs": (
+ "FLOAT",
+ {"default": 0.0, "min": 0.0, "max": 1.0, "step": 0.01},
+ ),
+ "typical": (
+ "FLOAT",
+ {"default": 0.0, "min": 0.0, "max": 1.0, "step": 0.01},
+ ),
"temperature_last": ("BOOLEAN", {"default": True}),
}
}
@@ -256,8 +280,8 @@ class Generator:
"tokens": ("EXL_TOKENS",),
"unload": ("BOOLEAN", {"default": False}),
"stop_conditions": ("STRING", {"default": r'"\n"'}),
- "max_tokens": ("INT", {"default": 128, "max": 2**20}),
- "seed": ("INT", {"max": 2**64 - 1}),
+ "max_tokens": ("INT", {"default": 128, "min": 0, "max": 2**20}),
+ "seed": ("INT", {"default": 0, "min": 0, "max": 2**64 - 1}),
},
"optional": {"settings": ("EXL_SETTINGS",)},
}
diff --git a/text.js b/text.js
index 879e6de..09f1138 100644
--- a/text.js
+++ b/text.js
@@ -20,7 +20,7 @@ app.registerExtension({
output.inputEl.style.opacity = 0.7
}
- this.setSize(this.computeSize());
+ this.setSize(this.computeSize())
return onNodeCreated?.apply(this, arguments)
}
diff --git a/text.py b/text.py
index 3d9e2d7..13a94c9 100644
--- a/text.py
+++ b/text.py
@@ -1,6 +1,6 @@
import string
-_CATEGORY = "Zuellni/Text"
+_CATEGORY = "zuellni/text"
_MAPPING = "ZuellniText"
@@ -9,9 +9,15 @@ class Clean:
def INPUT_TYPES(cls):
return {
"required": {
- "text": ("STRING", {"forceInput": True}),
- "strip": (("both", "punctuation", "whitespace", "none"),),
- "case": (("lower", "upper", "capitalize", "title", "none"),),
+ "text": ("STRING", {"default": "", "forceInput": True}),
+ "strip": (
+ ("both", "punctuation", "whitespace", "none"),
+ {"default": "both"},
+ ),
+ "case": (
+ ("lower", "upper", "capitalize", "title", "none"),
+ {"default": "lower"},
+ ),
"fix": ("BOOLEAN", {"default": True}),
}
}
@@ -44,8 +50,8 @@ class Message:
def INPUT_TYPES(cls):
return {
"required": {
- "role": (("system", "user", "assistant"),),
- "content": ("STRING", {"multiline": True}),
+ "role": (("system", "user", "assistant"), {"default": "system"}),
+ "content": ("STRING", {"default": "", "multiline": True}),
},
"optional": {"messages": ("EXL_MESSAGES",)},
}
@@ -64,8 +70,8 @@ class Preview:
def INPUT_TYPES(cls):
return {
"required": {
- "text": ("STRING", {"forceInput": True}),
- "output": ("STRING", {"multiline": True}),
+ "text": ("STRING", {"default": "", "forceInput": True}),
+ "output": ("STRING", {"default": "", "multiline": True}),
}
}
@@ -84,7 +90,7 @@ class Replace:
return {
"required": {
"count": ("INT", {"default": 1, "min": 1, "max": 26}),
- "text": ("STRING", {"multiline": True}),
+ "text": ("STRING", {"default": "", "multiline": True}),
}
}
@@ -106,7 +112,7 @@ class Replace:
class String:
@classmethod
def INPUT_TYPES(cls):
- return {"required": {"text": ("STRING", {"multiline": True})}}
+ return {"required": {"text": ("STRING", {"default": "", "multiline": True})}}
CATEGORY = _CATEGORY
FUNCTION = "get"