turkish-nlp-suite/InstrucTurca
Viewer • Updated • 2.58M • 497 • 40
How to use suayptalha/Llama-3.1-8b-Turkish-Finetuned with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="suayptalha/Llama-3.1-8b-Turkish-Finetuned") # Load model directly
from transformers import AutoModel
model = AutoModel.from_pretrained("suayptalha/Llama-3.1-8b-Turkish-Finetuned", dtype="auto")How to use suayptalha/Llama-3.1-8b-Turkish-Finetuned with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "suayptalha/Llama-3.1-8b-Turkish-Finetuned"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "suayptalha/Llama-3.1-8b-Turkish-Finetuned",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/suayptalha/Llama-3.1-8b-Turkish-Finetuned
How to use suayptalha/Llama-3.1-8b-Turkish-Finetuned with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "suayptalha/Llama-3.1-8b-Turkish-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": "suayptalha/Llama-3.1-8b-Turkish-Finetuned",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'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 "suayptalha/Llama-3.1-8b-Turkish-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": "suayptalha/Llama-3.1-8b-Turkish-Finetuned",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use suayptalha/Llama-3.1-8b-Turkish-Finetuned 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 suayptalha/Llama-3.1-8b-Turkish-Finetuned 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 suayptalha/Llama-3.1-8b-Turkish-Finetuned to start chatting
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for suayptalha/Llama-3.1-8b-Turkish-Finetuned to start chatting
pip install unsloth
from unsloth import FastModel
model, tokenizer = FastModel.from_pretrained(
model_name="suayptalha/Llama-3.1-8b-Turkish-Finetuned",
max_seq_length=2048,
)How to use suayptalha/Llama-3.1-8b-Turkish-Finetuned with Docker Model Runner:
docker model run hf.co/suayptalha/Llama-3.1-8b-Turkish-Finetuned
This is a Turkish finetuned Llama-3.1-8B model using InstrucTurca dataset in order to increase the Turkish capability of modern LLMs.
Note: These are only LoRA adapters. You should also import the base model itself.
Example usage:
model_name = "unsloth/Meta-Llama-3.1-8B"
model = AutoModelForCausalLM.from_pretrained(model_name, device_map="auto", torch_dtype=torch.float16)
model.gradient_checkpointing_enable()
tokenizer = AutoTokenizer.from_pretrained(model_name)
adapter_path = "suayptalha/Llama-3.1-8b-Turkish-Finetuned"
model = PeftModel.from_pretrained(model, adapter_path)
alpaca_prompt = """Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
{}
### Input:
{}
### Response:
{}"""
inputs = tokenizer(
[
alpaca_prompt.format(
"", #Your question here
"", #Given input here
"", #Output (for training)
)
], return_tensors = "pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens = 512, use_cache = True)
tokenizer.batch_decode(outputs)
Base model
unsloth/Meta-Llama-3.1-8B