Instructions to use Mollel/swahili-Instruct-llama-2-7b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Mollel/swahili-Instruct-llama-2-7b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Mollel/swahili-Instruct-llama-2-7b")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Mollel/swahili-Instruct-llama-2-7b") model = AutoModelForCausalLM.from_pretrained("Mollel/swahili-Instruct-llama-2-7b") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use Mollel/swahili-Instruct-llama-2-7b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Mollel/swahili-Instruct-llama-2-7b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Mollel/swahili-Instruct-llama-2-7b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Mollel/swahili-Instruct-llama-2-7b
- SGLang
How to use Mollel/swahili-Instruct-llama-2-7b with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Mollel/swahili-Instruct-llama-2-7b" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Mollel/swahili-Instruct-llama-2-7b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "Mollel/swahili-Instruct-llama-2-7b" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Mollel/swahili-Instruct-llama-2-7b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Unsloth Studio new
How to use Mollel/swahili-Instruct-llama-2-7b with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for Mollel/swahili-Instruct-llama-2-7b to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for Mollel/swahili-Instruct-llama-2-7b to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for Mollel/swahili-Instruct-llama-2-7b to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="Mollel/swahili-Instruct-llama-2-7b", max_seq_length=2048, ) - Docker Model Runner
How to use Mollel/swahili-Instruct-llama-2-7b with Docker Model Runner:
docker model run hf.co/Mollel/swahili-Instruct-llama-2-7b
Uploaded model
- Developed by: Mollel
- License: apache-2.0
- ** continue pre trained and Finetuned from model :** Llama-2
Notes:
- Swahili_LLaMA is intended for research purposes. The model-generated text/code should be treated as a starting point rather than a definitive solution for potential use cases. Users should be cautious when employing these models in their applications.
- Direct adoption for production tasks is out of the scope of this research project. As a result, the swahili_llama model has not been tested to ensure that it performs adequately for any production-level application. Please refer to the limitation sections of this document for more details.
- Any use of this model is at your own risk.
Limitations of Swahili LLaMA
Generate Inaccurate Facts as the base model
Limited Scope for code: It performs poorly on code
Unreliable Responses to Instruction: The model has not undergone instruction fine-tuning. As a result, it may struggle or fail to adhere to intricate or nuanced instructions provided by users.
Language Limitations: The model is primarily designed to understand standard Swahili. The checkpoint of this model also leads to more inaccurate responses. Any Informal Swahili, slang, or any other language might challenge its comprehension, leading to potential misinterpretations or errors in response.
Potential Societal Biases: it fed with limited text it might be bias
Toxicity: It might be toxic; however, most of the dataset trained in Swahili comes from newspapers, which makes it less toxic.
Verbosity: Swahili LLaMa, being a base model, often produces irrelevant or extra text and responses following its first answer to user prompts within a single turn. This is due to its training dataset being primarily news and blogspot, which results in random response.
Training
Model
Architecture: LLaMA-2a (Transformer-based model with next-word prediction objective)
Context length: LLaMA-2 (2048 tokens)
Dataset size: 600M tokens(LLaMA-2) from C100 swahili and other craw from swahili newspaper and blogspots.
Training tokens: 1.4T tokens
GPUs: 2xA6000-48G
Training time: Expected 13 days
- Downloads last month
- 4