Instructions to use menikev/Llama-3.1-8B-NigerianLegalBot with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use menikev/Llama-3.1-8B-NigerianLegalBot with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("unsloth/meta-llama-3.1-8b-instruct-unsloth-bnb-4bit") model = PeftModel.from_pretrained(base_model, "menikev/Llama-3.1-8B-NigerianLegalBot") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Unsloth Studio
How to use menikev/Llama-3.1-8B-NigerianLegalBot 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 menikev/Llama-3.1-8B-NigerianLegalBot 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 menikev/Llama-3.1-8B-NigerianLegalBot to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for menikev/Llama-3.1-8B-NigerianLegalBot to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="menikev/Llama-3.1-8B-NigerianLegalBot", max_seq_length=2048, )
Nigerian Legal Assistant - Multilingual LoRA Adapter
This is a LoRA adapter for Meta-Llama-3.1-8B-Instruct, fine-tuned for Nigerian legal assistance in multiple languages.
Supported Languages
- English (Nigerian variety)
- Yoruba
- Hausa
- Igbo
- Nigerian Pidgin
Usage
from unsloth import FastLanguageModel
import torch
# Load base model
model, tokenizer = FastLanguageModel.from_pretrained(
model_name="unsloth/Meta-Llama-3.1-8B-Instruct",
max_seq_length=2048,
dtype=None,
load_in_4bit=True,
device_map="auto", # Use this if you have memory issues
)
# Load this adapter
model.load_adapter("menikev/Llama-3.1-8B-NigerianLegalBot", adapter_name="default")
# Enable inference
FastLanguageModel.for_inference(model)
# Use the model
system_prompt = "You are a helpful and knowledgeable legal assistant in Nigeria. Respond to queries in the language of the user's question."
messages = [
{"role": "system", "content": system_prompt},
{"role": "user", "content": "What are the requirements for business registration in Nigeria?"}
]
inputs = tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt")
with torch.no_grad():
outputs = model.generate(
input_ids=inputs.to("cuda"),
max_new_tokens=512,
temperature=0.7,
do_sample=True,
)
response = tokenizer.decode(outputs[0][len(inputs[0]):], skip_special_tokens=True)
print(response)
Training Details
- Base Model: unsloth/Meta-Llama-3.1-8B-Instruct
- Method: QLoRA (4-bit quantization)
- Rank: 16
- Alpha: 16
- Target Modules: q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj
- Training Data: Custom Nigerian legal Q&A dataset in multiple languages
Files Uploaded
- README.md
- adapter_model.safetensors
- adapter_config.json
Disclaimer
This model is for informational purposes only. Always consult qualified legal professionals for actual legal advice.
License
This adapter follows the LLaMA 3.1 license terms.
- Downloads last month
- 1
Model tree for menikev/Llama-3.1-8B-NigerianLegalBot
Base model
meta-llama/Llama-3.1-8B Finetuned
meta-llama/Llama-3.1-8B-Instruct Finetuned
unsloth/Meta-Llama-3.1-8B-Instruct