Browse Source

make history conditional

tags/v0.3.11-rc1
haixuanTao 10 months ago
parent
commit
4dcc61f550
1 changed files with 3 additions and 2 deletions
  1. +3
    -2
      node-hub/dora-transformers/dora_transformers/main.py

+ 3
- 2
node-hub/dora-transformers/dora_transformers/main.py View File

@@ -20,6 +20,7 @@ MODEL_NAME = os.getenv("MODEL_NAME", "Qwen/Qwen2.5-0.5B-Instruct")
MAX_TOKENS = int(os.getenv("MAX_TOKENS", "512"))
DEVICE = os.getenv("DEVICE", "auto")
TORCH_DTYPE = os.getenv("TORCH_DTYPE", "auto")
HISTORY= os.getenv("HISTORY", "False").lower() == "true"


# Words that trigger the model to respond
@@ -90,8 +91,8 @@ def main():
if len(ACTIVATION_WORDS) == 0 or any(
word in ACTIVATION_WORDS for word in words
):
response, _history = generate_response(model, tokenizer, text, history)
response, tmp_history = generate_response(model, tokenizer, text, history)
history = tmp_history if HISTORY else history
node.send_output(
output_id="text", data=pa.array([response]), metadata={}
)


Loading…
Cancel
Save