Skip to content
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

Why do I use the phi model to output the same result for all samples at a temperature of 0.8? #34

Open
Mrzhang-dada opened this issue Dec 6, 2023 · 0 comments

Comments

@Mrzhang-dada
Copy link

def generate_one_completion(prompt: str):
torch.set_default_device("cuda")
model = AutoModelForCausalLM.from_pretrained("//phi-1", trust_remote_code=True)
tokenizer = AutoTokenizer.from_pretrained("/
/phi-1", trust_remote_code=True)
# inputs = tokenizer("'''"+prompt+"'''", return_tensors="pt", return_attention_mask=False)
inputs = tokenizer(prompt, return_tensors="pt", return_attention_mask=False)
# outputs = model.generate(**inputs, max_length=200,max_new_tokens=430)
outputs = model.generate(**inputs, max_length=200,temperature=0.8,do_sample=True)
completion = tokenizer.batch_decode(outputs)[0]
return completion

This is my model output code. Regardless of the value of num_samples_per_task set, it returns the same answer for each question

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant