Text Generation
Transformers
Safetensors
Turkish
llama
llama-3
turkish
tiny-llama
scratch-build
text-generation-inference
Run this model with HF Jobs
Run ritterlich/mini-tr-134M on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/ritterlich/mini-tr-134M. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/ritterlich/mini-tr-134M on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/ritterlich/mini-tr-134M. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/ritterlich/mini-tr-134M. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use ritterlich/mini-tr-134M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ritterlich/mini-tr-134M with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ritterlich/mini-tr-134M")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("ritterlich/mini-tr-134M") model = AutoModelForCausalLM.from_pretrained("ritterlich/mini-tr-134M", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use ritterlich/mini-tr-134M with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ritterlich/mini-tr-134M" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ritterlich/mini-tr-134M", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/ritterlich/mini-tr-134M
- SGLang
How to use ritterlich/mini-tr-134M 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 "ritterlich/mini-tr-134M" \ --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": "ritterlich/mini-tr-134M", "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 "ritterlich/mini-tr-134M" \ --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": "ritterlich/mini-tr-134M", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use ritterlich/mini-tr-134M with Docker Model Runner:
docker model run hf.co/ritterlich/mini-tr-134M
|
Download README.md from ritterlich/mini-tr-134M: direct link, hf CLI and curl.
- Browser
- Download file 2.26 kB
-
https://huggingface.co/ritterlich/mini-tr-134M/resolve/main/README.md
- Command line
-
hf download hf://ritterlich/mini-tr-134M/README.md
-
curl -L -o README.md https://huggingface.co/ritterlich/mini-tr-134M/resolve/main/README.md
2.26 kB
| language: | |
| - tr | |
| license: apache-2.0 | |
| library_name: transformers | |
| tags: | |
| - llama-3 | |
| - turkish | |
| - tiny-llama | |
| - scratch-build | |
| datasets: | |
| - TFLai/Turkish-Alpaca | |
| metrics: | |
| - loss | |
| model_type: llama | |
| # Llama-TR-Mini (134M Parameters) | |
| Llama-TR-Mini is an experimental, ultra-lightweight Turkish language model with **134 million parameters**, trained from scratch using the Llama 3 architecture. | |
| This project was developed to explore the limits of small-scale language modeling and to understand the end-to-end pre-training/fine-tuning pipeline on consumer-grade hardware (Apple Silicon). | |
| ## Model Specifications | |
| - **Architecture:** Llama 3 | |
| - **Parameters:** 134,105,856 | |
| - **Hidden Size:** 768 | |
| - **Intermediate Size:** 2048 | |
| - **Number of Layers:** 12 | |
| - **Attention Heads:** 12 | |
| - **Vocabulary Size:** 32,000 (Custom Turkish Tokenizer) | |
| - **Training Epochs:** 30 | |
| - **Device:** MacBook Pro (MPS - Metal Performance Shaders) | |
| ## Training Data | |
| The model was trained on the [Turkish-Alpaca](https://huggingface.co/datasets/TFLai/Turkish-Alpaca) dataset, which contains approximately 52K instruction-following pairs translated into Turkish. | |
| ## Intended Use & Limitations | |
| **Important Note:** Due to its extremely small size (134M parameters), this model is prone to significant hallucinations and may produce nonsensical or repetitive outputs. | |
| - **Purpose:** Educational purposes, understanding LLM mechanics. | |
| - **Not Suited For:** Production environments, factual information retrieval, or complex reasoning tasks. | |
| - **Format:** Optimized for the Llama 3 Instruct template (`<|start_header_id|>user<|end_header_id|>`). | |
| ## How to Use | |
| You can load this model using the `transformers` library: | |
| ```python | |
| from transformers import AutoModelForCausalLM, AutoTokenizer | |
| model_id = "k12tr/mini-tr-134M" | |
| tokenizer = AutoTokenizer.from_pretrained(model_id) | |
| model = AutoModelForCausalLM.from_pretrained(model_id) | |
| prompt = "<|begin_of_text|><|start_header_id|>user<|end_header_id|>\n\nTürkiye'nin başkenti neresidir?<|eot_id|><|start_header_id|>assistant<|end_header_id|>\n\n" | |
| inputs = tokenizer(prompt, return_tensors="pt") | |
| output = model.generate(**inputs, max_new_tokens=50, temperature=0.1, repetition_penalty=1.5) | |
| print(tokenizer.decode(output[0], skip_special_tokens=True)) |