Run this model with HF Jobs

Run Salesforce/xgen-7b-8k-base on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs and TRL to fine-tune https://huggingface.co/Salesforce/xgen-7b-8k-base. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/Salesforce/xgen-7b-8k-base on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.

Evaluate on a benchmark

Use HF Jobs to evaluate https://huggingface.co/Salesforce/xgen-7b-8k-base. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.

Quantize for lower memory use

Use HF Jobs to create a 4-bit version of https://huggingface.co/Salesforce/xgen-7b-8k-base. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.

tokenizer.get_vocab() method is not working

#17
by Zangs3011 - opened

Hi team ,

There is an major issue with the tokenizer.get_vocab() method, as get_vocab() is a very important method that is used by a lot of codebases and libraries..for example ctranslate2

Having an issue over here renders the model useless for many usecases

Below are my logs and a possible fix

Thanks,

How to reproduce?
tokenizer = AutoTokenizer.from_pretrained("Salesforce/xgen-7b-8k-base",trust_remote_code=True)
tokenizer.get_vocab()

Possible Fix?
def _convert_id_to_token(self, index):
"""Converts an index (integer) in a token (str) using the vocab."""

  •    return self.encoder.decode_single_token_bytes(index).decode("utf-8")
    
  •   return self.encoder.decode_single_token_bytes(index).decode("latin1")
    

Use latin1 encoding over here instead of "utf-8"

Error thrown?

UnicodeDecodeError Traceback (most recent call last)
Cell In[39], line 1
----> 1 tokenizer.get_vocab()["<|tiktoken|>"]

File ~/.cache/huggingface/modules/transformers_modules/Salesforce/xgen-7b-8k-base/3987e094377fae577bba039af1b300ee8086f9e1/tokenization_xgen.py:142, in XgenTokenizer.get_vocab(self)
140 def get_vocab(self):
141 """Returns vocab as a dict"""
--> 142 vocab = {self._convert_id_to_token(i): i for i in range(self.vocab_size)}
143 return vocab

File ~/.cache/huggingface/modules/transformers_modules/Salesforce/xgen-7b-8k-base/3987e094377fae577bba039af1b300ee8086f9e1/tokenization_xgen.py:142, in (.0)
140 def get_vocab(self):
141 """Returns vocab as a dict"""
--> 142 vocab = {self._convert_id_to_token(i): i for i in range(self.vocab_size)}
143 return vocab

File ~/.cache/huggingface/modules/transformers_modules/Salesforce/xgen-7b-8k-base/3987e094377fae577bba039af1b300ee8086f9e1/tokenization_xgen.py:158, in XgenTokenizer._convert_id_to_token(self, index)
156 def _convert_id_to_token(self, index):
157 """Converts an index (integer) in a token (str) using the vocab."""
--> 158 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

Fixed, you can try again!

Thanks, the get vocab is working now

But still when trying to convert via ctranslate2 I'm getting the error that the model vocab size and the tokenizer vocab size does not match.

Can you check once

Sign up or log in to comment