Edit model card

TeenyTinyLlama-Doc-160m

A little llama with a stethoscope.

This repository contains a version of TeenyTinyLlama-160m fine-tuned on the medicine-training-pt dataset.

Author

Mariana Moreira dos Santos (LinkedIn)

Model Summary

Details

  • Architecture: a Transformer-based model pre-trained via causal language modeling
  • Size: 162,417,408 parameters
  • Context length: 2048 tokens
  • Dataset for training: Pt-Corpus Instruct (6.2B tokens)
  • Dataset for fine-tuning: medicine-qa-pt
  • Language: Portuguese
  • GPU:
  • Training time: ~
  • Emissions:
  • Total energy consumption:

Parameters

  • Number of Epochs: 3
  • Batch size: 4
  • Optimizer: torch.optim.AdamW (warmup_steps = 1e3, learning_rate = 1e-5, epsilon = 1e-8)

Code

This repository has the GOOGLE COLAB LINK used to train this model.

Dataset

Evaluations

Model Perplexity Evaluation Loss Energy Consumption (kWh) Emissions (KgCO2eq)
TeenyTinyLlama 160m xxxxx xxxxx xx
TeenyTinyLlama Doc 160m xxxxx xxxxx xx
TeenyTinyLlama 460m xxxxx xxxxx xxxxx
TeenyTinyLlama Doc 460m xxxxx xxxxx xxxxx

Basic usage

Using the pipeline:

from transformers import pipeline

generator = pipeline("text-generation", model="nicholasKluge/TeenyTinyLlama-460m")

completions  = generator("Astronomia é a ciência", num_return_sequences=2, max_new_tokens=100)

for comp in completions:
  print(f"🤖 {comp['generated_text']}")

Using the AutoTokenizer and AutoModelForCausalLM:

from transformers import AutoTokenizer, AutoModelForCausalLM
import torch

# Load model and the tokenizer
tokenizer = AutoTokenizer.from_pretrained("nicholasKluge/TeenyTinyLlama-460m", revision='main')
model = AutoModelForCausalLM.from_pretrained("nicholasKluge/TeenyTinyLlama-460m", revision='main')

# Pass the model to your device
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model.eval()
model.to(device)

# Tokenize the inputs and pass them to the device
inputs = tokenizer("Astronomia é a ciência", return_tensors="pt").to(device)

# Generate some text
completions = model.generate(**inputs, num_return_sequences=2, max_new_tokens=100)

# Print the generated text
for i, completion in enumerate(completions):
    print(f'🤖 {tokenizer.decode(completion)}')

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.

Limitations

Like almost all other language models trained on large text datasets scraped from the web, the TTL pair exhibited behavior that does not make them an out-of-the-box solution to many real-world applications, especially those requiring factual, reliable, nontoxic text generation. Our models are all subject to the following:

  • Hallucinations: This model can produce content that can be mistaken for truth but is, in fact, misleading or entirely false, i.e., hallucination.

  • Biases and Toxicity: This model inherits the social and historical stereotypes from the data used to train it. Given these biases, the model can produce toxic content, i.e., harmful, offensive, or detrimental to individuals, groups, or communities.

  • Unreliable Code: The model may produce incorrect code snippets and statements. These code generations should not be treated as suggestions or accurate solutions.

  • Language Limitations: The model is primarily designed to understand standard Brazilian Portuguese. Other languages might challenge its comprehension, leading to potential misinterpretations or errors in response.

  • Repetition and Verbosity: The model may get stuck on repetition loops (especially if the repetition penalty during generations is set to a meager value) or produce verbose responses unrelated to the prompt it was given.

Hence, even though our models are released with a permissive license, we urge users to perform their risk analysis on these models if intending to use them for real-world applications and also have humans moderating the outputs of these models in applications where they will interact with an audience, guaranteeing users are always aware they are interacting with a language model.

Cite as 🤗

Acknowledgements

The TeenyTinyLlama base models used here were created by Nicholas Kluge Corrêa and his team. For more information, visit TeenyTinyLlama.

License

TeenyTinyLlama-Doc-160m is licensed under the Apache License, Version 2.0. See the LICENSE file for more details.

Downloads last month
35
Safetensors
Model size
162M params
Tensor type
F32
·
Inference API
Input a message to start chatting with mmoreirast/TeenyTinyLlama-Doc-160m.
This model can be loaded on Inference API (serverless).

Datasets used to train mmoreirast/TeenyTinyLlama-Doc-160m

Collection including mmoreirast/TeenyTinyLlama-Doc-160m