Downloads · 30 days
13
5% of all-time downloads
beyoru/MCQ-o1-1
MCQ-o1-1 is a text generation model from beyoru. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
- Developed by: beyoru - License: apache-2.0
Downloads · 30 days
13
5% of all-time downloads
All-time downloads
253
Public
Repo size
12.4 GB
Likes
1
Public
Click a slice to open those files.
.bin6.2 GB · 100%
From the Hugging Face model README
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "beyoru/MCQ-3B-o1-1"
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype="auto",
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained(model_name)
messages = [
{"role": "system", "content": "Tạo một câu hỏi trắc nghiệm về"},
{"role": "user", "content": "<YOUR CONTEXT>"}
]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
generated_ids = model.generate(
**model_inputs,
do_sample=True
)
generated_ids = [
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
]
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]