Instructions to use cenfis/llama3-8b-tr-finetuned with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use cenfis/llama3-8b-tr-finetuned with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("unsloth/llama-3-8b-bnb-4bit") model = PeftModel.from_pretrained(base_model, "cenfis/llama3-8b-tr-finetuned") - Transformers
How to use cenfis/llama3-8b-tr-finetuned with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="cenfis/llama3-8b-tr-finetuned")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("cenfis/llama3-8b-tr-finetuned") model = AutoModelForCausalLM.from_pretrained("cenfis/llama3-8b-tr-finetuned") - llama-cpp-python
How to use cenfis/llama3-8b-tr-finetuned with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="cenfis/llama3-8b-tr-finetuned", filename="llama3-8b-tr-uns.gguf", )
output = llm( "Once upon a time,", max_tokens=512, echo=True ) print(output)
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use cenfis/llama3-8b-tr-finetuned with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf cenfis/llama3-8b-tr-finetuned # Run inference directly in the terminal: llama-cli -hf cenfis/llama3-8b-tr-finetuned
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf cenfis/llama3-8b-tr-finetuned # Run inference directly in the terminal: llama-cli -hf cenfis/llama3-8b-tr-finetuned
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf cenfis/llama3-8b-tr-finetuned # Run inference directly in the terminal: ./llama-cli -hf cenfis/llama3-8b-tr-finetuned
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf cenfis/llama3-8b-tr-finetuned # Run inference directly in the terminal: ./build/bin/llama-cli -hf cenfis/llama3-8b-tr-finetuned
Use Docker
docker model run hf.co/cenfis/llama3-8b-tr-finetuned
- LM Studio
- Jan
- vLLM
How to use cenfis/llama3-8b-tr-finetuned with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "cenfis/llama3-8b-tr-finetuned" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "cenfis/llama3-8b-tr-finetuned", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/cenfis/llama3-8b-tr-finetuned
- SGLang
How to use cenfis/llama3-8b-tr-finetuned 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 "cenfis/llama3-8b-tr-finetuned" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "cenfis/llama3-8b-tr-finetuned", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "cenfis/llama3-8b-tr-finetuned" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "cenfis/llama3-8b-tr-finetuned", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Ollama
How to use cenfis/llama3-8b-tr-finetuned with Ollama:
ollama run hf.co/cenfis/llama3-8b-tr-finetuned
- Unsloth Studio new
How to use cenfis/llama3-8b-tr-finetuned with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
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 cenfis/llama3-8b-tr-finetuned to start chatting
Install Unsloth Studio (Windows)
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 cenfis/llama3-8b-tr-finetuned to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for cenfis/llama3-8b-tr-finetuned to start chatting
- Docker Model Runner
How to use cenfis/llama3-8b-tr-finetuned with Docker Model Runner:
docker model run hf.co/cenfis/llama3-8b-tr-finetuned
- Lemonade
How to use cenfis/llama3-8b-tr-finetuned with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull cenfis/llama3-8b-tr-finetuned
Run and chat with the model
lemonade run user.llama3-8b-tr-finetuned-{{QUANT_TAG}}List all available models
lemonade list
Llama 3-8B Turkish Model
This repo contains the experimental-educational fine-tuned model for the Turkish Llama 3 Project and its variants that can be used for different purposes.
The actual trained model is an adapter model of Unsloth's Llama 3-8B quantized model, which is then converted into .gguf format using llama.cpp and into .bin format for vLLM.
The model is open to further development, we will continue to train the model when we obtain quality data. We can't use every Turkish dataset since some of them has poor quality of translation from English.
You can access the fine-tuning code here.
Trained with NVIDIA L4 with 150 steps, took around 8 minutes.
Example Usages
You can use the adapter model with PEFT.
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))
You can use it 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))
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
Important Notes
- 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.
- Use the model with a CUDA supported GPU.
Fine-tuned by emre570.
- Downloads last month
- 31
We're not able to determine the quantization variants.