pytorch-labs / gpt-fast

Simple and efficient pytorch-native transformer text generation in <1000 LOC of python.
BSD 3-Clause "New" or "Revised" License
5.37k stars 488 forks source link

AttributeError: 'LlamaForCausalLM' object has no attribute 'setup_caches' #11

Closed ohashi3399 closed 7 months ago

ohashi3399 commented 7 months ago

Thanks for your valuable efforts for implementing such tricks! I faced an error as you see in the title using following code. Does everyone use setup_cachesmethod? I am suspicious that I use wrong way. My environments are belows:

model = torch.compile(model, mode="reduce-overhead")

with torch.device(model.device): model.setup_caches( max_batch_size=1, max_seq_length=512, )


thanks in advance.
ohashi3399 commented 7 months ago

I confirmed that model = torch.compile(model, mode="reduce-overhead") degrades generation quality. I removed it.

Chillee commented 7 months ago

You can't use an arbitrary model with generate - you need to use the model in model.py.

ohashi3399 commented 7 months ago

i got it, Chillee-san! my mistake was solved by your advice! I appreciate for your help.