Text Generation
PEFT
Safetensors
Transformers
Turkish
English
meta-llama/Llama-3.2-1B-Instruct
lora
sft
trl
unsloth
conversational
Instructions to use Codex07/Lora_1B_TR with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
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") - Transformers
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)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Codex07/Lora_1B_TR", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Codex07/Lora_1B_TR with vLLM:
Install from pip and serve model
# 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?" } ] }'Use Docker
docker model run hf.co/Codex07/Lora_1B_TR
- SGLang
How to use Codex07/Lora_1B_TR with SGLang:
Install from pip and serve model
# 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?" } ] }'Use Docker images
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?" } ] }' - Unsloth Desktop
- Docker Model Runner
How to use Codex07/Lora_1B_TR with Docker Model Runner:
docker model run hf.co/Codex07/Lora_1B_TR
|
Download README.md from Codex07/Lora_1B_TR: direct link, hf CLI and curl.
- Browser
- Download file 2.77 kB
-
https://huggingface.co/Codex07/Lora_1B_TR/resolve/main/README.md
- Command line
-
hf download hf://Codex07/Lora_1B_TR/README.md
-
curl -L -o README.md https://huggingface.co/Codex07/Lora_1B_TR/resolve/main/README.md
2.77 kB
metadata
library_name: peft
model_name: lora_1B_TR
tags:
- meta-llama/Llama-3.2-1B-Instruct
- lora
- sft
- transformers
- trl
- unsloth
licence: license
pipeline_tag: text-generation
base_model: meta-llama/Llama-3.2-1B-Instruct
datasets:
- kadirnar/combined-turkish-datasets-v5
language:
- tr
- en
Model Card for Lora_TR_1B
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)
Quick start
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))
Training procedure
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.
Framework versions
- PEFT 0.17.1
- TRL: 0.23.0
- Transformers: 4.56.2
- Pytorch: 2.8.0
- Datasets: 4.3.0
- Tokenizers: 0.22.1
Citations
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}}
}