You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
RuntimeError: probability tensor contains either inf, nan or element < 0 #86
my environment is
GPU: V100-32G
torch: 1.13.1+cu116
python: 3.7.13
I load the model by using Int8:
tokenizer = AutoTokenizer.from_pretrained("togethercomputer/GPT-NeoXT-Chat-Base-20B")
model = AutoModelForCausalLM.from_pretrained("togethercomputer/GPT-NeoXT-Chat-Base-20B", device_map="auto", load_in_8bit=True)
And when run the model.generate the error will occur: RuntimeError: probability tensor contains either inf, nan or element < 0 at "next_tokens = torch.multinomial(probs, num_samples=1).squeeze(1)"
I printed the values and found that from "next_token_scores = logits_processor(input_ids, next_token_logits)", all the elements of the tensor is "nan".
Activity
DavidFarago commentedon May 24, 2023
I have the same problem.
inputsare all valid (notnan, notinf, and >0), butprobsseems to be allnan:ChengYen-Tang commentedon Aug 7, 2023
This problem seems to be caused by incorrect configuration of the Converting weights to Hugging Face format step
--n-stages can be found from checkpoint folder, in my environment

--n-stages 2--n-layer-per-stage must refer to the model configuration

--n-layer-per-stage = model layers / --n-stages, in my environment--n-layer-per-stage 16https://huggingface.co/EleutherAI/pythia-6.9b-deduped