mshojaei77/Persian_sft dataset to explore its capabilities in Persian language conversational tasks.
['down_proj', 'gate_proj', 'k_proj', 'o_proj', 'q_proj', 'up_proj', 'v_proj'] (linear layers)sample_packing: true)fp16: true), Load in 4bit (load_in_4bit: true), BF16: Disabled (bf16: false)gradient_checkpointing: true)flash_attention: false)google/gemma-2-2b-it.Persian_sft dataset.Critical Note: The model was trained for an exceptionally short duration (20 steps). This is insufficient for robust learning and generalization. Expect significantly under-optimized performance.
Persian_sft dataset is a collection of Persian conversations designed for instruction fine-tuning of language models. It likely contains examples of user queries and desired model responses in Persian, formatted for conversational fine-tuning.1import torch
2from transformers import pipeline
3
4# Initialize the text generation pipeline
5pipe = pipeline(
6 "text-generation",
7 model="mshojaei77/Gemma-2b-fa",
8 model_kwargs={"torch_dtype": torch.bfloat16},
9 device="cuda", # Or "mps" for Macs with Apple Silicon
10)
11
12# Prepare input messages (using the gemma chat template implicitly)
13messages = [
14 {"role": "user", "content": "سلام چطوری؟"},
15]
16
17# Generate a response with a maximum of 512 new tokens
18outputs = pipe(messages, max_new_tokens=512, chat_template="gemma") # Explicitly using chat_template for clarity
19assistant_response = outputs[0]["generated_text"][-1]["content"].strip()
20
21print(assistant_response)
22# Example Output (Illustrative - Output quality may vary significantly):
23# سلام! من خوبم، ممنون. شما چطوری؟ 😊library_name: transformers and pipeline_tag: text-generation: Specified in metadata and Model Details for discoverability and clarity.chat_template="gemma": Use the correct chat template for Gemma models.device="mps" for Apple Silicon (performance may vary).