Shotor is a Persian language model built upon the llama 3 8B architecture, a multilingual Large Language Model (LLM). It has been fine-tuned using supervised learning techniques and the Dora method for efficient fine-tuning. The model has been specifically tailored and trained on Persian datasets, particularly leveraging the dataset provided by
persian-alpaca-deep-clean.
Here's a sample Python code snippet demonstrating how to use Shotor for text generation:
1import transformers
2import torch
3
4# Load the Shotor model
5model_id = "myrkur/shotor"
6pipeline = transformers.pipeline(
7 "text-generation",
8 model=model_id,
9 model_kwargs={"torch_dtype": torch.bfloat16},
10 device_map="auto",
11)
12
13# Define user messages
14messages = [
15 {"role": "user", "content": "علم بهتر است یا ثروت؟"},
16]
17
18# Apply chat template and generate text
19prompt = pipeline.tokenizer.apply_chat_template(
20 messages,
21 tokenize=False,
22 add_generation_prompt=True
23)
24
25terminators = [
26 pipeline.tokenizer.eos_token_id,
27 pipeline.tokenizer.convert_tokens_to_ids("<|eot_id|>")
28]
29
30outputs = pipeline(
31 prompt,
32 max_new_tokens=512,
33 eos_token_id=terminators,
34 do_sample=True,
35 temperature=0.5,
36 top_p=0.9,
37 repetition_penalty=1.1
38)
39print(outputs[0]["generated_text"][len(prompt):])
Contributions to Shotor are welcome! Whether it's enhancing the model's capabilities, improving its performance on specific tasks, or evaluating its performance, your contributions can help advance Persian natural language processing.