Text Generation
Transformers
Safetensors
Bengali
llama
text-generation-inference
unsloth
trl
4-bit precision
bitsandbytes
Run this model with HF Jobs
Run KillerShoaib/llama-3-8b-bangla-4bit on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/KillerShoaib/llama-3-8b-bangla-4bit. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/KillerShoaib/llama-3-8b-bangla-4bit on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/KillerShoaib/llama-3-8b-bangla-4bit. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Instructions to use KillerShoaib/llama-3-8b-bangla-4bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use KillerShoaib/llama-3-8b-bangla-4bit with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="KillerShoaib/llama-3-8b-bangla-4bit")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("KillerShoaib/llama-3-8b-bangla-4bit") model = AutoModelForCausalLM.from_pretrained("KillerShoaib/llama-3-8b-bangla-4bit", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use KillerShoaib/llama-3-8b-bangla-4bit with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "KillerShoaib/llama-3-8b-bangla-4bit" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "KillerShoaib/llama-3-8b-bangla-4bit", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/KillerShoaib/llama-3-8b-bangla-4bit
- SGLang
How to use KillerShoaib/llama-3-8b-bangla-4bit 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 "KillerShoaib/llama-3-8b-bangla-4bit" \ --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": "KillerShoaib/llama-3-8b-bangla-4bit", "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 "KillerShoaib/llama-3-8b-bangla-4bit" \ --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": "KillerShoaib/llama-3-8b-bangla-4bit", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Unsloth Desktop
- Docker Model Runner
How to use KillerShoaib/llama-3-8b-bangla-4bit with Docker Model Runner:
docker model run hf.co/KillerShoaib/llama-3-8b-bangla-4bit
LLama-3 Bangla 4 bit
- Developed by: KillerShoaib
- License: apache-2.0
- Finetuned from model : unsloth/llama-3-8b-bnb-4bit
- Datset used for fine-tuning : iamshnoo/alpaca-cleaned-bengali
4-bit Quantization
This is 4-bit quantization of Llama-3 8b model.
Llama-3 Bangla Different Formats
LoRA Adapters only- KillerShoaib/llama-3-8b-bangla-loraGGUF q4_k_m- KillerShoaib/llama-3-8b-bangla-GGUF-Q4_K_M
Model Details
Llama 3 8 billion model was finetuned using unsloth package on a cleaned Bangla alpaca dataset. After that the model was quantized in 4-bit. The model is finetuned for 2 epoch on a single T4 GPU.
Pros & Cons of the Model
Pros
- The model can comprehend the Bangla language, including its semantic nuances
- Given context model can answer the question based on the context
Cons
- Model is unable to do creative or complex work. i.e: creating a poem or solving a math problem in Bangla
- Since the size of the dataset was small, the model lacks lot of general knowledge in Bangla
Run The Model
FastLanguageModel from unsloth for 2x faster inference
from unsloth import FastLanguageModel
model, tokenizer = FastLanguageModel.from_pretrained(
model_name = "KillerShoaib/llama-3-8b-bangla-4bit",
max_seq_length = 2048,
dtype = None,
load_in_4bit = True,
)
FastLanguageModel.for_inference(model)
# alpaca_prompt for the model
alpaca_prompt = """Below is an instruction in bangla that describes a task, paired with an input also in bangla that provides further context. Write a response in bangla that appropriately completes the request.
### Instruction:
{}
### Input:
{}
### Response:
{}"""
# input with instruction and input
inputs = tokenizer(
[
alpaca_prompt.format(
"সুস্থ থাকার তিনটি উপায় বলুন", # instruction
"", # input
"", # output - leave this blank for generation!
)
], return_tensors = "pt").to("cuda")
# generating the output and decoding it
outputs = model.generate(**inputs, max_new_tokens = 2048, use_cache = True)
tokenizer.batch_decode(outputs)
AutoModelForCausalLM from Hugginface
from transformers import AutoTokenizer, AutoModelForCausalLM
model_name = "KillerShoaib/llama-3-8b-bangla-4bit" # YOUR MODEL YOU USED FOR TRAINING either hf hub name or local folder name.
tokenizer_name = model_name
# Load tokenizer
tokenizer = AutoTokenizer.from_pretrained(tokenizer_name)
# Load model
model = AutoModelForCausalLM.from_pretrained(model_name)
alpaca_prompt = """Below is an instruction in bangla that describes a task, paired with an input also in bangla that provides further context. Write a response in bangla that appropriately completes the request.
### Instruction:
{}
### Input:
{}
### Response:
{}"""
inputs = tokenizer(
[
alpaca_prompt.format(
"সুস্থ থাকার তিনটি উপায় বলুন", # instruction
"", # input
"", # output - leave this blank for generation!
)
], return_tensors = "pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens = 1024, use_cache = True)
tokenizer.batch_decode(outputs)
Inference Script & Github Repo
Google Colab- Llama-3 8b Bangla Inference ScriptGithub Repo- Llama-3 Bangla
- Downloads last month
- 63
Model tree for KillerShoaib/llama-3-8b-bangla-4bit
Base model
meta-llama/Meta-Llama-3-8B Quantized
unsloth/llama-3-8b-bnb-4bit