Downloads · 30 days
21
1% of all-time downloads
sartifyllc/pawa-min-alpha
pawa-min-alpha is a text generation model from sartifyllc. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
Downloads · 30 days
21
1% of all-time downloads
All-time downloads
3.2K
Public
Parameters
2.6B
5.3 GB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors5.2 GB · 99%
From the Hugging Face model README
PAWA is a Swahili-specialized language model designed to excel in tasks requiring nuanced understanding and interaction in Swahili and English. It leverages supervised fine-tuning (SFT) and Direct Preference Optimization (DPO) for improved performance and consistency. Below are the detailed model specifications, installation steps, usage examples, and its intended applications.
Ensure the necessary libraries are installed and up-to-date:
!pip uninstall transformers -y && pip install --upgrade --no-cache-dir "git+https://github.com/huggingface/transformers.git"
!pip uninstall unsloth -y && pip install --upgrade --no-cache-dir "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git"
!pip install datasets
You can load the model using the following code snippet:
from unsloth import FastLanguageModel
import torch
model_name = "sartifyllc/pawa-min-alpha"
max_seq_length = 2048
dtype = None
load_in_4bit = False
model, tokenizer = FastLanguageModel.from_pretrained(
model_name=model_name,
max_seq_length=max_seq_length,
dtype=dtype,
load_in_4bit=load_in_4bit,
)
For a seamless conversational experience, configure the tokenizer with the appropriate chat template:
from unsloth.chat_templates import get_chat_template
FastLanguageModel.for_inference(model) # Enable native 2x faster inference
tokenizer = get_chat_template(
tokenizer,
chat_template="chatml", # Supports templates like zephyr, chatml, mistral, etc.
mapping={"role": "from", "content": "value", "user": "human", "assistant": "gpt"}, # ShareGPT style
map_eos_token=True, # Maps <|im_end|> to </s>
)
Generate a short story in Swahili:
messages = [{"from": "human", "value": "Tengeneza hadithi fupi"}]
inputs = tokenizer.apply_chat_template(
messages,
tokenize=True,
add_generation_prompt=True,
return_tensors="pt",
).to("cuda")
from transformers import TextStreamer
text_streamer = TextStreamer(tokenizer)
_ = model.generate(input_ids=inputs, streamer=text_streamer, max_new_tokens=128, use_cache=True)
General Assistance:
Provides structured answers for general-purpose use.
Interactive Q&A:
Designed for general-purpose chat environments.
RAG (Retrieval-Augmented Generation):
Works best for RAG and specific use cases.
Biases:
The model may exhibit biases inherent in its fine-tuning datasets.
Generalization:
May struggle with tasks outside the trained domain.
Hardware Requirements:
@misc{pawa-min-alpha-2024,
title={Pan-African Wide Alignment (PAWA) Language Model},
author={Charles, Innocent and Enosh, Godfrey and Kipingili, Prosperity and Mgonzo, Wasiwasi and Mangeni, Winnie and Magori, January and Mollel, Michael},
year={2024},
publisher={sartify.com},
url={https://huggingface.co/sartifyllc/pawa-min-alpha}
}
Feel free to reach out for further guidance or collaboration opportunities regarding PAWA!