Instructions to use TURKCELL/Turkcell-LLM-7b-v1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use TURKCELL/Turkcell-LLM-7b-v1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="TURKCELL/Turkcell-LLM-7b-v1") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("TURKCELL/Turkcell-LLM-7b-v1") model = AutoModelForCausalLM.from_pretrained("TURKCELL/Turkcell-LLM-7b-v1", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use TURKCELL/Turkcell-LLM-7b-v1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "TURKCELL/Turkcell-LLM-7b-v1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "TURKCELL/Turkcell-LLM-7b-v1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/TURKCELL/Turkcell-LLM-7b-v1
- SGLang
How to use TURKCELL/Turkcell-LLM-7b-v1 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 "TURKCELL/Turkcell-LLM-7b-v1" \ --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": "TURKCELL/Turkcell-LLM-7b-v1", "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 "TURKCELL/Turkcell-LLM-7b-v1" \ --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": "TURKCELL/Turkcell-LLM-7b-v1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use TURKCELL/Turkcell-LLM-7b-v1 with Docker Model Runner:
docker model run hf.co/TURKCELL/Turkcell-LLM-7b-v1
| license: apache-2.0 | |
| language: | |
| - tr | |
| <img src="https://huggingface.co/TURKCELL/Turkcell-LLM-7b-v1/resolve/main/icon.jpeg" | |
| alt="Turkcell LLM" width="300"/> | |
| # Turkcell-LLM-7b-v1 | |
| This model is an extended version of a Mistral-based Large Language Model (LLM) for Turkish. It was trained on a cleaned Turkish raw dataset containing 5 billion tokens. The training process involved using the DORA method initially. Following this, we utilized Turkish instruction sets created from various open-source and internal resources for fine-tuning with the LORA method. | |
| ## Model Details | |
| - **Base Model**: Mistral 7B based LLM | |
| - **Tokenizer Extension**: Specifically extended for Turkish | |
| - **Training Dataset**: Cleaned Turkish raw data with 5 billion tokens, custom Turkish instruction sets | |
| - **Training Method**: Initially with DORA, followed by fine-tuning with LORA | |
| ### DORA Configuration | |
| - `lora_alpha`: 128 | |
| - `lora_dropout`: 0.05 | |
| - `r`: 64 | |
| - `target_modules`: "all-linear" | |
| ### LORA Fine-Tuning Configuration | |
| - `lora_alpha`: 128 | |
| - `lora_dropout`: 0.05 | |
| - `r`: 256 | |
| - `target_modules`: "all-linear" | |
| ## Usage Examples | |
| ```python | |
| from transformers import AutoModelForCausalLM, AutoTokenizer | |
| device = "cuda" # the device to load the model onto | |
| model = AutoModelForCausalLM.from_pretrained("TURKCELL/Turkcell-LLM-7b-v1") | |
| tokenizer = AutoTokenizer.from_pretrained("TURKCELL/Turkcell-LLM-7b-v1") | |
| messages = [ | |
| {"role": "user", "content": "Türkiye'nin başkenti neresidir?"}, | |
| ] | |
| encodeds = tokenizer.apply_chat_template(messages, return_tensors="pt") | |
| eos_token = tokenizer("<|im_end|>",add_special_tokens=False)["input_ids"][0] | |
| model_inputs = encodeds.to(device) | |
| model.to(device) | |
| generated_ids = model.generate(model_inputs, | |
| max_new_tokens=1024, | |
| do_sample=True, | |
| eos_token_id=eos_token) | |
| decoded = tokenizer.batch_decode(generated_ids) | |
| print(decoded[0]) | |