Error calling tokenizer.get_vocab() (Codegen2.5)
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Ferma
- Stack tecnologico
- python
- Ambito
- machine-learning
Direzione di ricerca
Start with CodeGen25Tokenizer.get_vocab and _convert_id_to_token in tokenization_codegen25.py, then reproduce the failure with the AutoTokenizer snippet in the issue. Done means tokenizer.get_vocab() returns the expected vocabulary dictionary without raising UnicodeDecodeError.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
I wanted to check if Codegen2.5 uses the same vocabulary as Codegen2 (a question to the authors: does it?), and noticed that calling .get_vocab() on tokenizer produces an error.
How to reproduce:
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("Salesforce/codegen25-7b-multi", trust_remote_code=True)
tokenizer.get_vocab()
The expected output would be a dictionary with vocabulary.
The output I get instead is:
"UnicodeDecodeError Traceback (most recent call last)
Cell In[18], line 1
----> 1 tokenizer.get_vocab()File /home/shushan/.cache/huggingface/modules/transformers_modules/Salesforce/codegen25-7b-multi/d4dc9dd90e8b23d5411e6d970e3a11e88dc5c2bc/tokenization_codegen25.py:153, in CodeGen25Tokenizer.get_vocab(self)
151 def get_vocab(self):
152 """Returns vocab as a dict"""
--> 153 vocab = {self._convert_id_to_token(i): i for i in range(self.vocab_size)}
154 return vocabFile /home/shushan/.cache/huggingface/modules/transformers_modules/Salesforce/codegen25-7b-multi/d4dc9dd90e8b23d5411e6d970e3a11e88dc5c2bc/tokenization_codegen25.py:153, in (.0)
151 def get_vocab(self):
152 """Returns vocab as a dict"""
--> 153 vocab = {self._convert_id_to_token(i): i for i in range(self.vocab_size)}
154 return vocabFile /home/shushan/.cache/huggingface/modules/transformers_modules/Salesforce/codegen25-7b-multi/d4dc9dd90e8b23d5411e6d970e3a11e88dc5c2bc/tokenization_codegen25.py:169, in CodeGen25Tokenizer._convert_id_to_token(self, index)
167 def _convert_id_to_token(self, index):
168 """Converts an index (integer) in a token (str) using the vocab."""
--> 169 return self.encoder.decode_single_token_bytes(index).decode("utf-8")UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa1 in position 0: invalid start byte"
- Lingua principale
- Python
- Stelle
- 5.2k
- Fork
- 420
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di salesforce/CodeGen
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 45/100
salesforce/CodeGen#107 ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 20/100
salesforce/CodeGen#104 ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
salesforce/CodeGen#101 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 48/100
salesforce/CodeGen#95 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
salesforce/CodeGen#94 · 8 commenti ·
Tutte le issue di salesforce/CodeGen
Issue simili
-
bug priority:low
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
CyberAgent/psd2svg#436 ·
-
area/install-update comp/cli comp/desktop P3 sweeper:risk-compatibility type/bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
NousResearch/hermes-agent#122386 · 1 commento ·
-
ai-generated
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
vllm-project/production-stack#1105 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100