Downloads · 30 days
0
Rhaps360/opt125m-ins-ft
opt125m-ins-ft is a text generation model from Rhaps360. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as other.
This model was trained using AutoTrain. For more information, please visit AutoTrain.
Downloads · 30 days
0
Access
Public
Updated Apr 11, 2024
Repo size
7.1 MB
Likes
0
Public
Click a slice to open those files.
.json5.8 MB · 36%
From the Hugging Face model README
This model was trained using AutoTrain. For more information, please visit AutoTrain.
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):])