🚀 Llama 3-8B Turkish Model
This repository houses an experimental and educational fine - tuned model for the Turkish Llama 3 Project and its variants, which can serve various purposes. The actual trained model is an adapter model of Unsloth's Llama 3 - 8B quantized model. It is then converted into the .gguf format using llama.cpp and the .bin format for vLLM.
The model is open to further development. We will continue to train the model when we acquire high - quality data. Not all Turkish datasets can be used because some have poor English - to - Turkish translations.
You can access the fine - tuning code here. The model was trained on an NVIDIA L4 for 150 steps, which took approximately 8 minutes.
✨ Features
- Fine - tuned for Turkish: Specifically tailored for Turkish language tasks.
- Multiple Formats: Available in .gguf and .bin formats for different use - cases.
- Open for Development: Ready for further improvement with high - quality data.
📦 Installation
No specific installation steps are provided in the original document.
💻 Usage Examples
Basic Usage
from peft import PeftModel, PeftConfig
from transformers import AutoModelForCausalLM, AutoTokenizer
base_model = AutoModelForCausalLM.from_pretrained("unsloth/llama-3-8b-bnb-4bit")
model = PeftModel.from_pretrained(base_model, "myzens/llama3-8b-tr-finetuned")
tokenizer = AutoTokenizer.from_pretrained("myzens/llama3-8b-tr-finetuned")
alpaca_prompt = """
Instruction:
{}
Input:
{}
Response:
{}"""
inputs = tokenizer([
alpaca_prompt.format(
"",
"Ankara'da gezilebilecek 3 yeri söyle ve ne olduklarını kısaca açıkla.",
"",
)], return_tensors = "pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens=256)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Advanced Usage
Using from Transformers
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("myzens/llama3-8b-tr-finetuned")
model = AutoModelForCausalLM.from_pretrained("myzens/llama3-8b-tr-finetuned")
alpaca_prompt = """
Instruction:
{}
Input:
{}
Response:
{}"""
inputs = tokenizer([
alpaca_prompt.format(
"",
"Ankara'da gezilebilecek 3 yeri söyle ve ne olduklarını kısaca açıkla.",
"",
)], return_tensors = "pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens=192)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Using Transformers Pipeline
from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline
tokenizer = AutoTokenizer.from_pretrained("myzens/llama3-8b-tr-finetuned")
model = AutoModelForCausalLM.from_pretrained("myzens/llama3-8b-tr-finetuned")
pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)
alpaca_prompt = """
Instruction:
{}
Input:
{}
Response:
{}"""
input = alpaca_prompt.format(
"",
"Ankara'da gezilebilecek 3 yeri söyle ve ne olduklarını kısaca açıkla.",
"",
)
pipe(input)
Output
Instruction:
Input:
Ankara'da gezilebilecek 3 yeri söyle ve ne olduklarını kısaca açıkla.
Response:
1. Anıtkabir - Mustafa Kemal Atatürk'ün mezarı
2. Gençlik ve Spor Sarayı - spor etkinliklerinin yapıldığı yer
3. Kızılay Meydanı - Ankara'nın merkezinde bulunan bir meydan
📚 Documentation
Important Notes
- ⚠️ Important Note
- We recommend you to use an Alpaca Prompt Template or another template, otherwise you can see generations with no meanings or repeating the same sentence constantly.
- 💡 Usage Tip
- Use the model with a CUDA supported GPU.
📄 License
The model is licensed under the Apache - 2.0 license.
Fine - tuned by emre570.
Property |
Details |
Model Type |
Fine - tuned adapter model for Turkish Llama 3 |
Training Data |
myzens/alpaca - turkish - combined |
Base Model |
unsloth/llama - 3 - 8b - bnb - 4bit |
Library Name |
peft |