RuntimeError: probability tensor contains either `inf`, `nan` or element < 0

#2
by Mradr - opened

C:\Users\Owner\AppData\Local\Programs\Python\Python310\lib\site-packages\transformers\models\qwen2\modeling_qwen2.py:521: UserWarning: 1Torch was not compiled with flash attention. (Triggered internally at ..\aten\src\ATen\native\transformers\cuda\sdp_utils.cpp:263.)
attn_output = torch.nn.functional.scaled_dot_product_attention(
Traceback (most recent call last):
File "C:\Users\Owner\Desktop\otherbot.py", line 20, in
generated_ids = model.generate(
File "C:\Users\Owner\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\utils_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "C:\Users\Owner\AppData\Local\Programs\Python\Python310\lib\site-packages\transformers\generation\utils.py", line 1989, in generate
result = self._sample(
File "C:\Users\Owner\AppData\Local\Programs\Python\Python310\lib\site-packages\transformers\generation\utils.py", line 2969, in _sample
next_tokens = torch.multinomial(probs, num_samples=1).squeeze(1)
RuntimeError: probability tensor contains either inf, nan or element < 0

Just using the example code keep getting the above error

Sign up or log in to comment