Instructions to use ytu-ce-cosmos/Turkish-Llama-8b-v0.1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ytu-ce-cosmos/Turkish-Llama-8b-v0.1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ytu-ce-cosmos/Turkish-Llama-8b-v0.1")# Load model directly from transformers import AutoTokenizer, AutoModelForMultimodalLM tokenizer = AutoTokenizer.from_pretrained("ytu-ce-cosmos/Turkish-Llama-8b-v0.1") model = AutoModelForMultimodalLM.from_pretrained("ytu-ce-cosmos/Turkish-Llama-8b-v0.1") - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use ytu-ce-cosmos/Turkish-Llama-8b-v0.1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ytu-ce-cosmos/Turkish-Llama-8b-v0.1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ytu-ce-cosmos/Turkish-Llama-8b-v0.1", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/ytu-ce-cosmos/Turkish-Llama-8b-v0.1
- SGLang
How to use ytu-ce-cosmos/Turkish-Llama-8b-v0.1 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 "ytu-ce-cosmos/Turkish-Llama-8b-v0.1" \ --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": "ytu-ce-cosmos/Turkish-Llama-8b-v0.1", "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 "ytu-ce-cosmos/Turkish-Llama-8b-v0.1" \ --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": "ytu-ce-cosmos/Turkish-Llama-8b-v0.1", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use ytu-ce-cosmos/Turkish-Llama-8b-v0.1 with Docker Model Runner:
docker model run hf.co/ytu-ce-cosmos/Turkish-Llama-8b-v0.1
Cosmos LLaMa
This model is a fully fine-tuned version of the LLaMA-3 8B model with a 30GB Turkish dataset.
The Cosmos LLaMa is designed for text generation tasks, providing the ability to continue a given text snippet in a coherent and contextually relevant manner. Due to the diverse nature of the training data, which includes websites, books, and other text sources, this model can exhibit biases. Users should be aware of these biases and use the model responsibly.
Example Usage
Here is an example of how to use the model in colab:
!pip install -U accelerate bitsandbytes
import torch
from transformers import pipeline, AutoTokenizer, AutoModelForCausalLM
from transformers import BitsAndBytesConfig
import time
model_name = "ytu-ce-cosmos/Turkish-Llama-8b-v0.1"
bnb_config = BitsAndBytesConfig(
load_in_8bit=True,
bnb_8bit_compute_dtype=torch.bfloat16,
load_in_8bit_fp32_cpu_offload=True,
device_map = 'auto'
)
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(
model_name,
device_map="auto",
torch_dtype=torch.bfloat16,
quantization_config=bnb_config,
)
text_generator = pipeline(
"text-generation",
model=model,
tokenizer=tokenizer,
device_map="auto",
temperature=0.3,
repetition_penalty=1.1,
top_p=0.9,
max_length=610,
do_sample=True,
return_full_text=False,
min_new_tokens=32
)
text = """Yapay zeka hakkΔ±nda 3 tespit yaz.\n"""
r = text_generator(text)
print(r[0]['generated_text'])
"""
1. Yapay Zeka (AI), makinelerin insan benzeri biliΕsel iΕlevleri gerΓ§ekleΕtirmesini saΔlayan bir teknoloji alanΔ±dΔ±r.
2. Yapay zekanΔ±n geliΕtirilmesi ve uygulanmasΔ±, saΔlΔ±k hizmetlerinden eΔlenceye kadar Γ§eΕitli sektΓΆrlerde Γ§ok sayΔ±da fΔ±rsat sunmaktadΔ±r.
3. Yapay zeka teknolojisinin potansiyel faydalarΔ± ΓΆnemli olsa da mahremiyet, iΕten Γ§Δ±karma ve etik hususlar gibi konularla ilgili endiΕeler de var.
"""
Acknowledgments
- Thanks to the generous support from the Hugging Face team, it is possible to download models from their S3 storage π€
- Computing resources used in this work were provided by the National Center for High Performance Computing of Turkey (UHeM) under grant numbers 1016912023 and 1018512024
- Research supported with Cloud TPUs from Google's TPU Research Cloud (TRC)
Contact
COSMOS AI Research Group, Yildiz Technical University Computer Engineering Department
https://cosmos.yildiz.edu.tr/
cosmos@yildiz.edu.tr
Citation
@inproceedings{kesgin2024optimizing,
title={Optimizing Large Language Models for Turkish: New Methodologies in Corpus Selection and Training},
author={Kesgin, H Toprak and Yuce, M Kaan and Dogan, Eren and Uzun, M Egemen and Uz, Atahan and {\.I}nce, Elif and Erdem, Yusuf and Shbib, Osama and Zeer, Ahmed and Amasyali, M Fatih},
booktitle={2024 Innovations in Intelligent Systems and Applications Conference (ASYU)},
pages={1--6},
year={2024},
organization={IEEE}
}
license: llama3
- Downloads last month
- 179
Model tree for ytu-ce-cosmos/Turkish-Llama-8b-v0.1
Base model
meta-llama/Meta-Llama-3-8B