-
Notifications
You must be signed in to change notification settings - Fork 9.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to use few-shot? #1178
Comments
from transformers import LLaMAForCausalLM, LLaMATokenizer Initialize model and tokenizermodel = LLaMAForCausalLM.from_pretrained("llama-7b") Define prompt, few-shot examples, and queryprompt = "Translate English to Spanish." Format input and tokenizeinput_text = f"{prompt}\n{'\n'.join(examples)}\n{query}" Generate outputoutput = model.generate(**inputs) Print outputprint(tokenizer.decode(output[0], skip_special_tokens=True)) |
Hello,I want to use the few-shot method to assist LLAMA in inference. May I ask how the input format should be set?
The text was updated successfully, but these errors were encountered: