Download annotations/annotation_10/SimPO/generate.py from mcy98/RECODE-H: direct link, hf CLI and curl.
- Browser
- Download file 409 Bytes
-
https://huggingface.co/datasets/mcy98/RECODE-H/resolve/main/annotations/annotation_10/SimPO/generate.py
- Command line
-
hf download hf://datasets/mcy98/RECODE-H/annotations/annotation_10/SimPO/generate.py
-
curl -L -o generate.py https://huggingface.co/datasets/mcy98/RECODE-H/resolve/main/annotations/annotation_10/SimPO/generate.py
409 Bytes
| import torch | |
| from transformers import pipeline | |
| model_id = "princeton-nlp/gemma-2-9b-it-SimPO" | |
| generator = pipeline( | |
| "text-generation", | |
| model=model_id, | |
| model_kwargs={"torch_dtype": torch.bfloat16}, | |
| device="cuda", | |
| ) | |
| outputs = generator([{"role": "user", "content": "What's the difference between llamas and alpacas?"}], do_sample=False, max_new_tokens=200) | |
| print(outputs[0]['generated_text']) | |