nicholasKluge's picture
Upload 2 files
d9cd092 verified
|
raw
history blame
8.43 kB
metadata
license: apache-2.0
datasets:
  - nicholasKluge/instruct-aira-dataset-v2
language:
  - pt
metrics:
  - accuracy
library_name: transformers
pipeline_tag: text-generation
tags:
  - alignment
  - instruction tuned
  - text generation
  - conversation
  - assistant
widget:
  - text: >-
      <s><instruction>Cite algumas bandas de rock famosas da década de
      1960.</instruction>
    example_title: Exemplo
  - text: <s><instruction>Quantos planetas existem no sistema solar?</instruction>
    example_title: Exemplo
  - text: <s><instruction>Qual é o futuro do ser humano?</instruction>
    example_title: Exemplo
  - text: <s><instruction>Qual o sentido da vida?</instruction>
    example_title: Exemplo
  - text: <s><instruction>Como imprimir hello world em python?</instruction>
    example_title: Exemplo
  - text: >-
      <s><instruction>Invente uma história sobre um encanador com poderes
      mágicos.</instruction>
    example_title: Exemplo
inference:
  parameters:
    repetition_penalty: 1.2
    temperature: 0.2
    top_k: 30
    top_p: 0.3
    max_new_tokens: 200
    length_penalty: 0.3
    early_stopping: true
co2_eq_emissions:
  emissions: 0.83
  source: CodeCarbon
  training_type: fine-tuning
  geographical_location: United States of America
  hardware_used: NVIDIA A100-SXM4-40GB

TeenyTinyLlama-160m-Chat

TeenyTinyLlama is a pair of small foundational models trained in Brazilian Portuguese.

This repository contains a version of TeenyTinyLlama-160m (TeenyTinyLlama-160m-Chat) fine-tuned on the Instruct-Aira Dataset version 2.0.

Details

  • Number of Epochs: 3
  • Batch size: 4
  • Optimizer: torch.optim.AdamW (warmup_steps = 1e3, learning_rate = 5e-5, epsilon = 1e-8)
  • GPU: 1 NVIDIA A100-SXM4-40GB
  • Carbon emissions stats are logged in this file.

This repository has the source code used to train this model.

Usage

The following special tokens are used to mark the user side of the interaction and the model's response:

<instruction>What is a language model?</instruction>A language model is a probability distribution over a vocabulary.</s>

from transformers import AutoTokenizer, AutoModelForCausalLM
import torch

device = torch.device("cuda" if torch.cuda.is_available() else "cpu")

tokenizer = AutoTokenizer.from_pretrained('nicholasKluge/TeenyTinyLlama-160m-Chat')
model = AutoModelForCausalLM.from_pretrained('nicholasKluge/TeenyTinyLlama-160m-Chat')

model.eval()
model.to(device)

question =  input("Entre seu prompt aqui: ")

inputs = tokenizer("<instruction>" + question + "</instruction>", return_tensors="pt").to(device)

responses = model.generate(**inputs, num_return_sequences=2)

print(f"Pergunta: 👤 {question}\n")

for i, response in  enumerate(responses):
    print(f'Resposta {i+1}: 🤖 {tokenizer.decode(response, skip_special_tokens=True).replace(question, "")}')

The model will output something like:

>>>Question: 👤 Qual a capital do Brasil?

>>>Response 1: 🤖 A capital do Brasil é Brasília.
>>>Response 2: 🤖 A capital do Brasil é Brasília.

Limitations

  • 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 Portuguese (BR). 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.

Benchmarks

Models Average ARC Hellaswag MMLU TruthfulQA
TeenyTinyLlama-460m 33.01 29.40 33.00 28.55 41.10
Bloom-560m 32.13 24.74* 37.15* 24.22* 42.44*
Xglm-564M 31.97 25.56 34.64* 25.18* 42.53
TeenyTinyLlama-160m 31.16 26.15 29.29 28.11 41.12
Pythia-160m 31.16 24.06* 31.39* 24.86* 44.34*
OPT-125m 30.80 22.87 31.47 26.02 42.87
Gpt2-portuguese-small 30.22 22.48* 29.62* 27.36* 41.44*
Gpt2-small 29.97 21.48* 31.60* 25.79* 40.65*
Multilingual GPT 29.45 24.79 26.37* 25.17* 41.50

Cite as 🤗


@misc{nicholas22llama,
  doi = {10.5281/zenodo.6989727},
  url = {https://huggingface.co/nicholasKluge/TeenyTinyLlama-160m},
  author = {Nicholas Kluge Corrêa},
  title = {TeenyTinyLlama},
  year = {2023},
  publisher = {HuggingFace},
  journal = {HuggingFace repository},
}

Funding

This repository was built as part of the RAIES (Rede de Inteligência Artificial Ética e Segura) initiative, a project supported by FAPERGS - (Fundação de Amparo à Pesquisa do Estado do Rio Grande do Sul), Brazil.

License

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