Skip to content

armgit / dspy

Public Imported from GitHub
0

DSPy: The framework for programming—not prompting—language models

Python

Update hf.py

Pasquale Minervini4b1414f0fb7c
diff --git a/dsp/modules/hf.py b/dsp/modules/hf.py
index cefcee929..73cba0b12 100644
--- a/dsp/modules/hf.py
+++ b/dsp/modules/hf.py
@@ -168,6 +168,10 @@ class HFModel(LM):
print("Failed to extract 'content' from the prompt.")
inputs = self.tokenizer(prompt, return_tensors="pt").to(self.device)
+ if 'temperature' in kwargs:
+ if kwargs['temperature'] == 0.0:
+ kwargs['do_sample'] = False
+
# print(kwargs)
outputs = self.model.generate(**inputs, **kwargs)
if self.drop_prompt_from_output: