Fix default values not showing in preview

This commit is contained in:
Zuellni
2024-08-23 22:21:47 +02:00
parent 97ec4b551c
commit bef6a0d3cb
5 changed files with 56 additions and 186 deletions
-160
View File
@@ -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/
+2 -2
View File
@@ -125,12 +125,12 @@ git clone https://huggingface.co/turboderp/Llama-3.1-8B-Instruct-exl2 -b 4.0bpw
</tr> </tr>
<tr> <tr>
<td><b>String</b></td> <td><b>String</b></td>
<td colspan="2">A string. That's it.</td> <td colspan="2">A string constant.</td>
</tr> </tr>
</table> </table>
## Workflow ## Workflow
An example workflow is embedded in the image below and can be opened in ComfyUI. An example workflow is embedded in the image below and can be opened in ComfyUI.
![workflow](https://github.com/user-attachments/assets/359c0340-fe0e-4e69-a1b4-259c6ff5a142) ![Workflow](https://github.com/user-attachments/assets/359c0340-fe0e-4e69-a1b4-259c6ff5a142)
+37 -13
View File
@@ -24,7 +24,7 @@ from comfy.model_management import soft_empty_cache, unload_all_models
from comfy.utils import ProgressBar from comfy.utils import ProgressBar
from folder_paths import add_model_folder_path, get_folder_paths, models_dir from folder_paths import add_model_folder_path, get_folder_paths, models_dir
_CATEGORY = "Zuellni/ExLlama" _CATEGORY = "zuellni/exllama"
_MAPPING = "ZuellniExLlama" _MAPPING = "ZuellniExLlama"
@@ -49,7 +49,10 @@ class Loader:
"cache_bits": (caches, {"default": 4}), "cache_bits": (caches, {"default": 4}),
"fast_tensors": ("BOOLEAN", {"default": True}), "fast_tensors": ("BOOLEAN", {"default": True}),
"flash_attention": ("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 { return {
"required": { "required": {
"model": ("EXL_MODEL",), "model": ("EXL_MODEL",),
"text": ("STRING", {"forceInput": True}), "text": ("STRING", {"default": "", "forceInput": True}),
"add_bos_token": ("BOOLEAN", {"default": True}), "add_bos_token": ("BOOLEAN", {"default": True}),
"encode_special_tokens": ("BOOLEAN", {"default": True}), "encode_special_tokens": ("BOOLEAN", {"default": True}),
} }
@@ -205,14 +208,35 @@ class Settings:
def INPUT_TYPES(cls): def INPUT_TYPES(cls):
return { return {
"required": { "required": {
"temperature": ("FLOAT", {"default": 1, "max": 10, "step": 0.01}), "temperature": (
"penalty": ("FLOAT", {"default": 1, "min": 1, "max": 10, "step": 0.01}), "FLOAT",
"top_k": ("INT", {"default": 1, "max": 1000}), {"default": 1.0, "min": 0.0, "max": 10.0, "step": 0.01},
"top_p": ("FLOAT", {"max": 1, "step": 0.01}), ),
"top_a": ("FLOAT", {"max": 1, "step": 0.01}), "penalty": (
"min_p": ("FLOAT", {"max": 1, "step": 0.01}), "FLOAT",
"tfs": ("FLOAT", {"max": 1, "step": 0.01}), {"default": 1.0, "min": 1.0, "max": 10.0, "step": 0.01},
"typical": ("FLOAT", {"max": 1, "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}), "temperature_last": ("BOOLEAN", {"default": True}),
} }
} }
@@ -256,8 +280,8 @@ class Generator:
"tokens": ("EXL_TOKENS",), "tokens": ("EXL_TOKENS",),
"unload": ("BOOLEAN", {"default": False}), "unload": ("BOOLEAN", {"default": False}),
"stop_conditions": ("STRING", {"default": r'"\n"'}), "stop_conditions": ("STRING", {"default": r'"\n"'}),
"max_tokens": ("INT", {"default": 128, "max": 2**20}), "max_tokens": ("INT", {"default": 128, "min": 0, "max": 2**20}),
"seed": ("INT", {"max": 2**64 - 1}), "seed": ("INT", {"default": 0, "min": 0, "max": 2**64 - 1}),
}, },
"optional": {"settings": ("EXL_SETTINGS",)}, "optional": {"settings": ("EXL_SETTINGS",)},
} }
+1 -1
View File
@@ -20,7 +20,7 @@ app.registerExtension({
output.inputEl.style.opacity = 0.7 output.inputEl.style.opacity = 0.7
} }
this.setSize(this.computeSize()); this.setSize(this.computeSize())
return onNodeCreated?.apply(this, arguments) return onNodeCreated?.apply(this, arguments)
} }
+16 -10
View File
@@ -1,6 +1,6 @@
import string import string
_CATEGORY = "Zuellni/Text" _CATEGORY = "zuellni/text"
_MAPPING = "ZuellniText" _MAPPING = "ZuellniText"
@@ -9,9 +9,15 @@ class Clean:
def INPUT_TYPES(cls): def INPUT_TYPES(cls):
return { return {
"required": { "required": {
"text": ("STRING", {"forceInput": True}), "text": ("STRING", {"default": "", "forceInput": True}),
"strip": (("both", "punctuation", "whitespace", "none"),), "strip": (
"case": (("lower", "upper", "capitalize", "title", "none"),), ("both", "punctuation", "whitespace", "none"),
{"default": "both"},
),
"case": (
("lower", "upper", "capitalize", "title", "none"),
{"default": "lower"},
),
"fix": ("BOOLEAN", {"default": True}), "fix": ("BOOLEAN", {"default": True}),
} }
} }
@@ -44,8 +50,8 @@ class Message:
def INPUT_TYPES(cls): def INPUT_TYPES(cls):
return { return {
"required": { "required": {
"role": (("system", "user", "assistant"),), "role": (("system", "user", "assistant"), {"default": "system"}),
"content": ("STRING", {"multiline": True}), "content": ("STRING", {"default": "", "multiline": True}),
}, },
"optional": {"messages": ("EXL_MESSAGES",)}, "optional": {"messages": ("EXL_MESSAGES",)},
} }
@@ -64,8 +70,8 @@ class Preview:
def INPUT_TYPES(cls): def INPUT_TYPES(cls):
return { return {
"required": { "required": {
"text": ("STRING", {"forceInput": True}), "text": ("STRING", {"default": "", "forceInput": True}),
"output": ("STRING", {"multiline": True}), "output": ("STRING", {"default": "", "multiline": True}),
} }
} }
@@ -84,7 +90,7 @@ class Replace:
return { return {
"required": { "required": {
"count": ("INT", {"default": 1, "min": 1, "max": 26}), "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: class String:
@classmethod @classmethod
def INPUT_TYPES(cls): def INPUT_TYPES(cls):
return {"required": {"text": ("STRING", {"multiline": True})}} return {"required": {"text": ("STRING", {"default": "", "multiline": True})}}
CATEGORY = _CATEGORY CATEGORY = _CATEGORY
FUNCTION = "get" FUNCTION = "get"