Pretrained model on Nigerian languages including English using a causal language modeling (CLM) Multi-task objective. Finetuned on the following downstream tasks: NER, sentiment analysis, topic classification, translation.
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.
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.
python
1from transformers import AutoModelForCausalLM, AutoTokenizer
2from transformers import GenerationConfig
34generation_config = GenerationConfig(5 max_length=100,# Adjust this based on your translation requirements6 max_new_tokens=50,# Ensure sufficient tokens for your translations7 num_beams=5,# Moderate number of beams for a balance between speed and quality8 do_sample=False,# Disable sampling to make output deterministic9 temperature=1.0,# Neutral temperature since sampling is off10 top_k=0,# Disable top-k sampling (since sampling is off)11 top_p=0,# Disable top-p (nucleus) sampling (since sampling is off)12 repetition_penalty=4.0,# Neutral repetition penalty for translation13 length_penalty=3.0,# No penalty for sequence length; modify if your translations tend to be too short/long14 early_stopping=True# Stop early when all beams finish to speed up generation15)1617repo_name ="BeardedMonster/SabiYarn-125M-finetune"18tokenizer_name ="BeardedMonster/SabiYarn-125M"19model = AutoModelForCausalLM.from_pretrained(repo_name, trust_remote_code=True)20tokenizer= AutoTokenizer.from_pretrained(tokenizer_name, trust_remote_code=True)2122Use the following tags for the following downstream tasks:23- Translation
24 ```python
25<translate><yor>,<translate>....<ibo>,<translate>...<hau>,<translate>....<efi>,<translate>....<pcm>,<translate>.....<urh>26
Topic classification
<classify> ...... <topic>
Sentiment Analysis
<classify> .... <sentiment>
Named Entity Recognition
<NER>.... <tag>
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.