Run this model with HF Jobs

Run google/gemma-7b-it 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/google/gemma-7b-it. Ask me which dataset to train on, then push the fine-tuned model to a new private 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/google/gemma-7b-it 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/google/gemma-7b-it. Ask me which benchmark to run, then save the scores and the per-example results to a new private 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/google/gemma-7b-it. Push it to a new private model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.

Running sample code has a shape error:

#23
by yingliuhf - opened

I'm running the sample code

from transformers import AutoTokenizer, AutoModelForCausalLM

tokenizer = AutoTokenizer.from_pretrained("google/gemma-7b-it")
model = AutoModelForCausalLM.from_pretrained("google/gemma-7b-it", device_map="auto")

input_text = "Write me a poem about Machine Learning."
input_ids = tokenizer(input_text, return_tensors="pt").to("cuda")

outputs = model.generate(**input_ids)
print(tokenizer.decode(outputs[0]))

But it's giving me a shape error:

RuntimeError: shape '[1, 9, 3072]' is invalid for input of size 36864

Yup, doesn't work with transformers.

•
This comment has been hidden

Try, it helped me,
pip install "torch>=2.1.1" -U

Worked after updating the torch version.

Thanks! We'll fix it for lower torch versions. See https://huggingface.co/google/gemma-7b/discussions/17#65d64073550694a180cfd5df

osanseviero changed discussion status to closed

Also now pip install -U transformers if you cannot support latest versions of torch . We had a patch for this!

Sign up or log in to comment