Edit model card

SabiYarn

Test the whole generation capabilities here: https://huggingface.co/spaces/BeardedMonster/SabiYarn_125M

Pretrained model on Nigerian languages including English using a causal language modeling (CLM) Multi-task objective.

Model Details

Model Description

SabiYarn-125M is the first of a series of transformer models (adopted from nanogpt and inspired by GPT-J's architecture) pretrained on a large corpus of Nigerian language data in a self-supervised fashion. This means it was pretrained on the raw texts only, with no humans labelling them in any way (which is why it can use lots of publicly available data) with an automatic process to generate inputs and labels from those texts. More precisely, it was trained to guess the next word in sentences.

More precisely, inputs are sequences of continuous text of a certain length and the targets are the same sequence, shifted one token (word or piece of word) to the right. The model uses internally a mask-mechanism to make sure the predictions for the token i only uses the inputs from 1 to i but not the future tokens. It also makes sure attention is not calculated across documents.

This way, the model learns an inner representation of the languages that can then be used to extract features useful for downstream tasks. The model is best at what it was pretrained for however, which is generating coherent texts.

This is the smallest version, with 125M parameters.

  • Developed by: Aletheia.ai Research Lab
  • Funded by [optional]: Personal
  • Shared by [optional]: Jeffreypaul
  • Model type: GPTJX (Adopted from NanoGPT)
  • Language(s) (NLP): Majorly English, Yoruba, Hausa, Igbo, Pidgin and some others: Fulah/Fulfulde, Efik, Urhobo.

Model Sources [optional]

Uses

You can use the raw model for text generation or fine-tune it to a downstream task.

Bias, Risks, and Limitations

The training data used for this model is mostly an aggregation of data available on huggingface for nigerian languages. We know it contains a lot of unfiltered content from the internet, which is far from neutral.

Because large-scale language models of this size do not distinguish fact from fiction, we don’t support use-cases that require the generated text to be true.

Additionally, language models often reflect the biases inherent to the systems they were trained on, so we do not recommend that they be deployed into systems that interact with humans > unless the deployers first carry out a study of biases relevant to the intended use-case.

Recommendations

Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.

How to Get Started with the Model

Use the code below to get started with the model.

from transformers import AutoModelForCausalLM, AutoTokenizer
from transformers import GenerationConfig

generation_config = GenerationConfig(
    max_length=100,               # Adjust this based on your translation requirements
    max_new_tokens=50,            # Ensure sufficient tokens for your translations
    num_beams=5,                  # Moderate number of beams for a balance between speed and quality
    do_sample=False,              # Disable sampling to make output deterministic
    temperature=1.0,              # Neutral temperature since sampling is off
    top_k=0,                      # Disable top-k sampling (since sampling is off)
    top_p=0,                      # Disable top-p (nucleus) sampling (since sampling is off)
    repetition_penalty=4.0,       # Neutral repetition penalty for translation
    length_penalty=3.0,           # No penalty for sequence length; modify if your translations tend to be too short/long
    early_stopping=True           # Stop early when all beams finish to speed up generation
)

repo_name = "BeardedMonster/SabiYarn-125M-sentiment"
tokenizer_name = "BeardedMonster/SabiYarn-125M"
model = AutoModelForCausalLM.from_pretrained(repo_name, trust_remote_code=True)
tokenizer= AutoTokenizer.from_pretrained(tokenizer_name, trust_remote_code=True)

Use the following tags for the following downstream tasks:
- Sentiment Analysis
  ```python
   <classify> .... <sentiment>

You should typically put user's input between these 2 tags. Currently, model also doesnt perform very well on NER due to the scarce data on this.

Model Architecture and Objective

Architecture is very similar to GPT-J

Downloads last month
27
Safetensors
Model size
138M params
Tensor type
F32
·
Inference Examples
Inference API (serverless) does not yet support model repos that contain custom code.