Skip to content

Commit 9383653

Browse files
authored
initial copy (#1414)
1 parent d6d1d6b commit 9383653

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/deepsparse/transformers/utils/token_generator.py

+4
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ def generate(self, logits: numpy.ndarray) -> numpy.ndarray:
7777
:param logits: the logits from the model with shape (vocab_size,)
7878
:return: the sampled token
7979
"""
80+
# make a copy of logits to avoid modifying the original
81+
# logits distribution in-place
82+
logits = logits.copy()
83+
8084
if self.deterministic:
8185
token = numpy.argmax(logits)
8286
self.tokens.append(token)

0 commit comments

Comments
 (0)