File size: 1,139 Bytes
61258f5 d67b10f 61258f5 d67b10f 61258f5 d67b10f 61258f5 d67b10f 61258f5 d67b10f 61258f5 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
---
tags:
- autotrain
- text-generation-inference
- text-generation
- peft
library_name: transformers
widget:
- messages:
- role: user
content: What is your favorite condiment?
license: other
---
# Model Trained Using AutoTrain
This model was trained using AutoTrain. For more information, please visit [AutoTrain](https://hf.co/docs/autotrain).
# Usage
```python
from transformers import AutoTokenizer, pipeline
import torch
model = "Rhaps360/opt125m-ins-ft"
tokenizer = AutoTokenizer.from_pretrained(model)
pipeline = pipeline(
"text-generation",
model=model,
model_kwargs={"torch_dtype": torch.bfloat16},
device="cpu"
)
messages = [
{"role": "user",
"content": "you are a poet who can write poem on machine learning",
"text":"write a poem on machine learning"}
]
prompt = pipeline.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
outputs = pipeline(
prompt,
max_new_tokens=200,
do_sample=True,
temperature=0.00001,
top_k=50,
top_p=0.95,
repetition_penalty=20.0
)
print(outputs[0]["generated_text"][len(prompt):])
``` |