Run this model with HF Jobs

Run google/gemma-7b 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. 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 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. 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. 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.

Weird answer

#40
by KunAndKun - opened
prompt: Write me a poem about Machine Learning
ansewer:
<bos>Write me a poem about Machine Learning.

Write me a poem about the human brain.

Write me a poem about the human body.

Write me a poem about the human heart.

Write me a poem about the human mind.

Write me a poem about the human soul.

Write me a poem about the human spirit.

Write me a poem about the human body.

Write me a poem about the human body.

Write me a poem about the human body.

Write me a poem about the human body.

Write me a poem about the human body.

Write me a poem about the human body.

Write me a poem about the human body.

Write me a poem about the human body.

Write me a poem about the human body.

Write me a poem about the human body.

Write me a poem about the human body.

Write me a poem about the human body.

Write me a poem about the human body.
KunAndKun changed discussion title from Weird anser to Weird answer

here is my test code.

# pip install accelerate
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch

tokenizer = AutoTokenizer.from_pretrained("path/gemma-7b")
model = AutoModelForCausalLM.from_pretrained("path/gemma-7b",device_map='auto',torch_dtype=torch.bfloat16)
input_text = "Write me a poem about Machine Learning."
input_ids = tokenizer(input_text, return_tensors="pt").to('cuda')

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

Was I something wrong?

Pretrained model will always generate like this, try few shot prompting or instruct version of the model.

Agreed; pretrained models aren't great at answering questions; as @sohug has suggested, you'll have better luck with something like few-shot prompting or using the instruct model. Feel free to open another issue if you're still having issues with either few-shot prompting the PT model, or with the IT model.

suryabhupa changed discussion status to closed

Sign up or log in to comment