Comments (3)
I tried to pass preds[0]
to the tokenizer instead of just preds: decoded_preds = tokenizer.batch_decode(preds[0], skip_special_tokens=True)
But I got the following error: TypeError: argument 'ids': 'float' object cannot be interpreted as an integer
from transformers.
I tried to turn the floats into integers so it became: decoded_preds = tokenizer.batch_decode(preds[0].astype('int32'), skip_special_tokens=True)
but I got the following error:
File "/home/ubuntu/Aml/utils.py", line 82, in compute_metrics
decoded_preds = tokenizer.batch_decode(preds[0].astype('int32'), skip_special_tokens=True)
File "/home/ubuntu/Aml/venv/lib/python3.10/site-packages/transformers/tokenization_utils_base.py", line 3771, in batch_decode
return [
File "/home/ubuntu/Aml/venv/lib/python3.10/site-packages/transformers/tokenization_utils_base.py", line 3772, in <listcomp>
self.decode(
File "/home/ubuntu/Aml/venv/lib/python3.10/site-packages/transformers/tokenization_utils_base.py", line 3811, in decode
return self._decode(
File "/home/ubuntu/Aml/venv/lib/python3.10/site-packages/transformers/tokenization_utils_fast.py", line 625, in _decode
text = self._tokenizer.decode(token_ids, skip_special_tokens=skip_special_tokens)
OverflowError: out of range integral type conversion attempted
from transformers.
Hey! Would recommend you to ask on the forum as you are using custom code.
However note that printing / debugging to get what you pass the tokenizer is usually a good practice. The decode function expects ints, and ints that are not too big. OverflowError: out of range integral type conversion attempted
means you gave it a HUGE integer! 🤗
from transformers.
Related Issues (20)
- Add ability to specify input device for ffmpeg_microphone() HOT 1
- Slow tokenizer not loading mixtral 8x22b tokenizer correctly HOT 1
- Multi input of owlv2 cause RuntimeError: Boolean value of Tensor with more than one value is ambiguous HOT 2
- Log multiple losses used along with the combined losses when a model returns a dictionary of losses.
- get_wsd_schedule gets passed num_training_steps because not handled HOT 1
- rework `test_multi_gpu_data_parallel_forward`
- Convert_mistral_weights_to_hf fails loading consolidated.safetensors HOT 3
- Caching Past Key values of any length for Vision LLM's HOT 2
- LLAMA3's special_token is not the same in a file as it is used HOT 1
- Pre-training reference URL in Idefics2 codebase HOT 4
- Add HelpingAIForCausalLM to it HOT 7
- NotImplementedError: Cannot copy out of meta tensor; no data! HOT 2
- need better token_type_id processing on transformer GPT2Model HOT 3
- OverflowError: out of range integral type conversion attempted HOT 4
- TypeError: Cannot convert [array([322., 1.])] to EagerTensor of dtype int64
- Hey @JohnHerry, I'm not sure I understand what's the issue. Could you provide a code sample of what seems to be limiting you?
- BitsAndBytesConfig missing a validation
- Understanding loss in Training LLM HOT 2
- Request for Static Cache Support for XLA Compiler in Transformers
- Inconsistency in logit values between generation and direct model prediction HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from transformers.