Conversion

#5
by joorei - opened

Hello,

do I need conversion script even if I ask transformers to download it for me?

I tried the example CPU code verbatim and got this:

Traceback (most recent call last):
  File "/Users/test/tmp/models/lib/python3.10/site-packages/transformers/tokenization_utils_base.py", line 248, in __getattr__
    return self.data[item]
KeyError: 'shape'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/test/tmp/models/flan-ul5-test.py", line 10, in <module>
    outputs = model.generate(inputs, max_length=200)
  File "/Users/test/tmp/models/lib/python3.10/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context
    return func(*args, **kwargs)
  File "/Users/test/tmp/models/lib/python3.10/site-packages/transformers/generation/utils.py", line 1239, in generate
    batch_size = inputs_tensor.shape[0]
  File "/Users/test/tmp/models/lib/python3.10/site-packages/transformers/tokenization_utils_base.py", line 250, in __getattr__
    raise AttributeError
AttributeError

Hi @joorei
please make sure you are calling:

inputs = tokenizer(input_string, return_tensors="pt").input_ids

Can you share with use the code snippet you are using?

That was it, good catch and sorry, should have noticed that one.

joorei changed discussion status to closed

Sign up or log in to comment