🚀 TeenyTinyLlama-160m-GGUF
Quantized GGUF model files for TeenyTinyLlama-160m from nicholasKluge
🚀 Quick Start
This repository provides quantized GGUF model files for the TeenyTinyLlama-160m model. You can use these files for text generation tasks related to Brazilian Portuguese.
✨ Features
- Compact Model: Specifically designed for Brazilian Portuguese text generation, with a relatively small number of parameters (162,417,408).
- Quantized Format: The GGUF format allows for more efficient storage and inference.
- Controlled Training: The model was pre - trained via causal language modeling on a specific dataset, and checkpoints can be used for scientific experiments.
📦 Installation
The README does not provide specific installation steps, so this section is skipped.
💻 Usage Examples
Basic Usage
Using the pipeline
:
from transformers import pipeline
generator = pipeline("text-generation", model="nicholasKluge/TeenyTinyLlama-160m")
completions = generator("Astronomia é a ciência", num_return_sequences=2, max_new_tokens=100)
for comp in completions:
print(f"🤖 {comp['generated_text']}")
Advanced Usage
Using the AutoTokenizer
and AutoModelForCausalLM
:
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
tokenizer = AutoTokenizer.from_pretrained("nicholasKluge/TeenyTinyLlama-160m", revision='main')
model = AutoModelForCausalLM.from_pretrained("nicholasKluge/TeenyTinyLlama-160m", revision='main')
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model.eval()
model.to(device)
inputs = tokenizer("Astronomia é a ciência", return_tensors="pt").to(device)
completions = model.generate(**inputs, num_return_sequences=2, max_new_tokens=100)
for i, completion in enumerate(completions):
print(f'🤖 {tokenizer.decode(completion)}')
📚 Documentation
Model Summary
Large language models (LLMs) have significantly advanced natural language processing, but their progress has yet to be equal across languages. While most LLMs are trained in high - resource languages like English, multilingual models generally underperform monolingual ones. Additionally, aspects of their multilingual foundation sometimes restrict the byproducts they produce, like computational demands and licensing regimes. Hence, the TeenyTinyLlama pair was developed: two compact models for Brazilian Portuguese text generation.
Read the preprint on ArXiv.
Details
Property |
Details |
Architecture |
A Transformer - based model pre - trained via causal language modeling |
Size |
162,417,408 parameters |
Context length |
2048 tokens |
Dataset |
[Pt - Corpus Instruct](https://huggingface.co/datasets/nicholasKluge/Pt - Corpus - Instruct) (6.2B tokens) |
Language |
Portuguese |
Number of steps |
458,000 |
GPU |
1 NVIDIA A100 - SXM4 - 40GB |
Training time |
~ 36 hours |
Emissions |
5.6 KgCO2 (Germany) |
Total energy consumption |
15.5 kWh |
This repository has the [source code](https://github.com/Nkluge - correa/TeenyTinyLlama) used to train this model. The main libraries used are:
Intended Uses
The primary intended use of TeenyTinyLlama is to research the challenges related to developing language models for low - resource languages. Checkpoints saved during training are intended to provide a controlled setting for performing scientific experiments. You may also further fine - tune and adapt TeenyTinyLlama for deployment, as long as your use is following the Apache 2.0 license. If you decide to use pre - trained TeenyTinyLlama as a basis for your fine - tuned model, please conduct your own risk and bias assessment.
Out - of - scope Use
- TeenyTinyLlama is not intended for deployment. It is not a product and should not be used for human - facing interactions.
- TeenyTinyLlama models are Brazilian Portuguese language only and are not suitable for translation or generating text in other languages.
- TeenyTinyLlama has not been fine - tuned for downstream contexts in which language models are commonly deployed.
🔧 Technical Details
During training runs, both models showed consistent convergence. At no point did the evaluation curves show signs of overfitting or saturation. In the case of the 460m parameter model, it was intentionally trained past the optimal point by approximately 75,000 steps to assess if there were any signs of saturation, but the evaluations consistently gave better results. It is hypothesized that the models are under - trained but can improve if further trained to pass the Chinchilla optimal range.
Processed Tokens |
Perplexity |
Energy Consumption (kWh) |
Emissions (KgCO2eq) |
8.1M |
20.49 |
9.40 |
3.34 |
1.6B |
16.90 |
18.82 |
6.70 |
2.4B |
15.43 |
28.59 |
10.16 |
3.2B |
14.64 |
38.20 |
13.57 |
4.0B |
14.08 |
48.04 |
17.07 |
4.9B |
13.61 |
57.74 |
20.52 |
5.7B |
13.25 |
67.32 |
23.92 |
6.5B |
12.87 |
76.84 |
27.30 |
7.3B |
12.57 |
86.40 |
30.70 |
8.1B |
12.27 |
96.19 |
34.18 |
9.0B |
11.96 |
106.06 |
37.70 |
9.8B |
11.77 |
115.69 |
41.31 |
Benchmarks were performed using the [Language Model Evaluation Harness](https://github.com/EleutherAI/lm - evaluation - harness) (by EleutherAI). [Laiviet](https://github.com/laiviet/lm - evaluation - harness) translated the tasks from the LM - Evaluation - Harness used. The results of models marked with an "*" were extracted from the Open LLM Leaderboard.
📄 License
This model is released under the Apache 2.0 license.