kadirnar/combined-turkish-datasets-v5
Viewer • Updated • 1.05M • 50 • 16
How to use Codex07/Lora_1B_TR with PEFT:
from peft import PeftModel
from transformers import AutoModelForCausalLM
base_model = AutoModelForCausalLM.from_pretrained("/home/tk/Desktop/Folder/projects/AI/Models/Llama-3.2-1B-Instruct/")
model = PeftModel.from_pretrained(base_model, "Codex07/Lora_1B_TR")How to use Codex07/Lora_1B_TR with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="Codex07/Lora_1B_TR")
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # Load model directly
from transformers import AutoModel
model = AutoModel.from_pretrained("Codex07/Lora_1B_TR", device_map="auto")How to use Codex07/Lora_1B_TR with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "Codex07/Lora_1B_TR"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "Codex07/Lora_1B_TR",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/Codex07/Lora_1B_TR
How to use Codex07/Lora_1B_TR with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "Codex07/Lora_1B_TR" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "Codex07/Lora_1B_TR",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker run --gpus all \
--shm-size 32g \
-p 30000:30000 \
-v ~/.cache/huggingface:/root/.cache/huggingface \
--env "HF_TOKEN=<secret>" \
--ipc=host \
lmsysorg/sglang:latest \
python3 -m sglang.launch_server \
--model-path "Codex07/Lora_1B_TR" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "Codex07/Lora_1B_TR",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use Codex07/Lora_1B_TR with Unsloth Studio:
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for Codex07/Lora_1B_TR to start chatting
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for Codex07/Lora_1B_TR to start chatting
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for Codex07/Lora_1B_TR to start chatting
pip install unsloth
from unsloth import FastModel
model, tokenizer = FastModel.from_pretrained(
model_name="Codex07/Lora_1B_TR",
max_seq_length=2048,
)How to use Codex07/Lora_1B_TR with Docker Model Runner:
docker model run hf.co/Codex07/Lora_1B_TR
This is a Lora Adaptor of 'meta-llama/Llama-3.2-1B-Instruct'. The main goal of this adapter is to obtain an Llama who speaks Turkish better.
(r=32, lora_alpha=64, lora_dropout=0.005)
from unsloth import FastLanguageModel
from peft import PeftModel
from transformers import AutoTokenizer
BASE = "meta-llama/Llama-3.2-1B-Instruct"
ADAPTER = "Codex07/Lora_1B_TR"
# Load Model
model, tok = FastLanguageModel.from_pretrained(
model_name=BASE, max_seq_length=2048, load_in_4bit=False, dtype=None, device_map="auto"
)
# Load Adaptor
model = PeftModel.from_pretrained(model, ADAPTER) # adapter’ı Unsloth modeline tak
FastLanguageModel.for_inference(model)
# Test
messages = [
{"role":"system","content":"You are AI assistant. Give user answers"},# Sen bir Yapay Zeka Asistanısısın. kullanıcıdan gelen sorulara resmi cevap ver.
{"role":"user","content":"Selam!"}
]
prompt = tok.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt").to(model.device)
out = model.generate(prompt, max_new_tokens=2048)
print(tok.decode(out[0, prompt.shape[-1]:], skip_special_tokens=True))
Half of 'kadirnar/combined-turkish-datasets-v5' Turkish dataset used. Dataset divided into chunks by size 65k.
1> 2:50:33 / 2.746500 -> 1.771400 / 5.1.0
2> 3:00:00 / 1.7 -> 1.7 / 5.1.1
3> 2:18:19 / 1.859100 -> 1.474300 / 5.1.2
4> 3:15:13 / 1.421800 -> 1.122000 / 5.1.3
5> 2:50:00 / 1.746600 -> 1.629600 / 5.1.0
6> 2:44:46 / 1.745000 -> 1.653300 / 5.1.1
7> 2:07:00 / 1.478200 -> 1.357400 / 5.1.2
8> 3:11:54 / 1.174700 -> 1.046100 / 5.1.3
9> 3:12:39 / 1.117600 -> 0.796700 / 5.2.0
10>1:00:57 / 2.217400 -> 1.741400 / 5.2.1
11>1:30:04 / 2.919900 -> 2.534300 / 5.2.2
12>1:30:05 / 2.534300 -> 2.320100 / 5.2.2
This model was trained with SFT.
Cite TRL as:
@misc{vonwerra2022trl,
title = {{TRL: Transformer Reinforcement Learning}},
author = {Leandro von Werra and Younes Belkada and Lewis Tunstall and Edward Beeching and Tristan Thrush and Nathan Lambert and Shengyi Huang and Kashif Rasul and Quentin Gallou{\'e}dec},
year = 2020,
journal = {GitHub repository},
publisher = {GitHub},
howpublished = {\url{https://github.com/huggingface/trl}}
}
Base model
meta-llama/Llama-3.2-1B-Instruct
docker model run hf.co/Codex07/Lora_1B_TR