Skip to content

Commit 4b1414f

Browse files
authored
Update hf.py
1 parent 5db3e34 commit 4b1414f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

dsp/modules/hf.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,10 @@ def _generate(self, prompt, **kwargs):
168168
print("Failed to extract 'content' from the prompt.")
169169
inputs = self.tokenizer(prompt, return_tensors="pt").to(self.device)
170170

171+
if 'temperature' in kwargs:
172+
if kwargs['temperature'] == 0.0:
173+
kwargs['do_sample'] = False
174+
171175
# print(kwargs)
172176
outputs = self.model.generate(**inputs, **kwargs)
173177
if self.drop_prompt_from_output:

0 commit comments

Comments
 (0)