replit / ReplitLM

Inference code and configs for the ReplitLM model family
https://huggingface.co/replit
Apache License 2.0
925 stars 80 forks source link

errors in generation, TypeError: gelu() #13

Closed ran337287 closed 1 year ago

ran337287 commented 1 year ago

When I run the following code, it came to the error "y = model(x) return torch._C._nn.gelu(input, approximate) TypeError: gelu(): argument 'approximate' (position 2) must be bool, not str"

from transformers import AutoTokenizer
from transformers import AutoModelForCausalLM

tokenizer = AutoTokenizer.from_pretrained('replit/replit-code-v1-3b', trust_remote_code=True)

model = AutoModelForCausalLM.from_pretrained('replit/replit-code-v1-3b', trust_remote_code=True)
model.to(device='cuda:1')

x = torch.tensor([[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]])
x = x.to(device='cuda:1')
y = model(x)
print(y)
pirroh commented 1 year ago

It looks like you might have an issue in your own environment configuration (as in, your pytorch installation might be corrupted). Here's our recommendation:

Let us know if that helps!

ran337287 commented 1 year ago

It looks like you might have an issue in your own environment configuration (as in, your pytorch installation might be corrupted). Here's our recommendation:

  • upgrade torch to the latest version
  • upgrade transformers to the latest version
  • run the new codebase which we recently pushed to this repo

Let us know if that helps!

It works for me to upgrade torch