Run this model with HF Jobs

Run HuggingFaceM4/idefics-9b-instruct 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/HuggingFaceM4/idefics-9b-instruct. 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/HuggingFaceM4/idefics-9b-instruct 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/HuggingFaceM4/idefics-9b-instruct. 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/HuggingFaceM4/idefics-9b-instruct. 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.

what are the changes from `normalized=true` to `false` in `special_tokens_map.json`?

#5
by luodian - opened

hi I noticed your configs changed and could I ask why did this change and what could it bring with normalized=false? Thanks!

luodian changed discussion title from what are the changes from `normalized=false` to `true` in `special_tokens_map.json`? to what are the changes from `normalized=true` to `false` in `special_tokens_map.json`?

running the given example would produce

# normalized=true
User: What is in this image? 
Assistant: This picture depicts Idefix, the dog of Obelix in Asterix and Obelix. Idefix is running on the ground. 
User: And who is that? 
Assistant: That is a cartoon character from the Asterix comics, which is a popular French comic series created by René Goscinny and Albert Uderzo.
# normalized=false
User: What is in this image? 
Assistant: This picture depicts Idefix, the dog of Obelix in Asterix and Obelix. Idefix is running on the ground. 
User: And who is that? 
Assistant: The person in the image is Julius Caesar, a prominent Roman politician and military general in ancient Rome.

@HugoLaurencon is the best person to comment!

Hi @luodian

Can you tell me which version of transformers you are using?

If you are on the main branch and installed the repo from source, there has been a recent big change in tokenizers.

Essentially, if normalized=true, now the special tokens can be split into several sub-tokens, which is not something wanted.
For example, we trained the model using <fake_token_around_image><image><fake_token_around_image>, but here the token <image> could be split into < followed by image>.
In that case, we would not have the token <image>, and we would have no image attention mask or pixel values.
Note that if you are using the example code, we are dealing with these tokens for you in the processor script.

Could you try to see, with your version of transformers, how the prompt is tokenized with both normalized=true and normalized=false?
You need to write

from transformers import AutoProcessor

checkpoint = "HuggingFaceM4/idefics-9b"
processor = AutoProcessor.from_pretrained(checkpoint)
tokenizer = processor.tokenizer

prompt =  "<fake_token_around_image><image><fake_token_around_image>In this picture from Asterix and Obelix, we can see"  # Or a longer prompt
tokens = tokenizer.encode(prompt)
print(tokens)

Are you also using the base model or the instruct one?

Sign up or log in to comment