asif00/bangla-llama-1B-gguf-16bit

Model

0

stars

6

commits

1

repos using this model

2

linked in READMEs

Oct 14, 2024

updated

endpoints_compatible
gguf
llama
question-answering
text-generation-inference
transformers
Browse cluster: Bangla Language Model Fine-tuning

README

Bangla LLaMA GGUF 1B-16bit

Bangla LLaMA GGUF is a 1-billion-parameter language model optimized for Bengali-language tasks such as context-based question answering and retrieval-augmented generation. It is derived from LLaMA 3.2 1B and trained on the OdiaGenAI/all_combined_bengali_252k dataset.

Features

  • Model Size: 1B parameters
  • Format: GGUF (16-bit)
  • Language: Bengali
  • Use Cases:
    • Context-based Question Answering
    • Bengali Retrieval-Augmented Generation
  • Integration: Compatible with llama.cpp and Hugging Face transformers (with conversion)

Usage

1. Using with llama.cpp

Setup

git clone https://github.com/ggerganov/llama.cpp.git
cd llama.cpp
make

Run Inference

./main -m path/to/asif00/bangla-llama-1B-gguf-16bit.gguf -p "আপনার প্রশ্ন এখানে"

2. Using with Hugging Face Transformers

Note: GGUF format is not directly supported by transformers. Conversion to a compatible format is required.

Prerequisites

pip install transformers accelerate

Example Script

from transformers import AutoTokenizer, AutoModelForCausalLM
import torch

# Load tokenizer and model (after conversion)
tokenizer = AutoTokenizer.from_pretrained("asif00/bangla-llama-1B")
model = AutoModelForCausalLM.from_pretrained("path/to/converted-model")

prompt = """
নিচের নির্দেশনা বাংলা ভাষায় যা একটি কাজ বর্ণনা করে, এবং ইনপুটও বাংলা ভাষায় যা অতিরিক্ত প্রসঙ্গ প্রদান করে। উপযুক্তভাবে অনুরোধ পূরণ করে বাংলা ভাষায় একটি প্রতিক্রিয়া লিখুন।

### নির্দেশনা:
{}

### ইনপুট:
{}

### প্রতিক্রিয়া:
"""

def generate_response(instruction, context):
    input_text = prompt.format(instruction, context)
    inputs = tokenizer(input_text, return_tensors="pt").to("cuda")
    output = model.generate(**inputs, max_length=512, eos_token_id=tokenizer.eos_token_id)
    response = tokenizer.decode(output[0], skip_special_tokens=True)
    response = response.split("### প্রতিক্রিয়া:")[-1].strip()
    return response

# Example
instruction = "ভারতীয় বাঙালি কথাসাহিত্যিক মহাশ্বেতা দেবীর সম্পর্কে একটি সংক্ষিপ্ত বিবরণ দিন।"
context = "মহাশ্বেতা দেবী ২০১৬ সালে হৃদরোগে আক্রান্ত হয়ে কলকাতায় মৃত্যুবরণ করেন।"
print(generate_response(instruction, context))

Example

question = "ভারতীয় বাঙালি কথাসাহিত্যিক মহাশ্বেতা দেবীর মৃত্যু কবে হয় ?"
context = (
    "২০১৬ সালের ২৩ জুলাই হৃদরোগে আক্রান্ত হয়ে মহাশ্বেতা দেবী কলকাতার বেল ভিউ ক্লিনিকে ভর্তি হন। "
    "সেই বছরই ২৮ জুলাই একাধিক অঙ্গ বিকল হয়ে তাঁর মৃত্যু ঘটে। তিনি মধুমেহ, সেপ্টিসেমিয়া ও মূত্র সংক্রমণ রোগেও ভুগছিলেন।"
)
answer = generate_response(question, context)
print("উত্তর:", answer)

Output:

উত্তর: মহাশ্বেতা দেবী ২৮ জুলাই ২০১৬ সালে মৃত্যুবরণ করেন।

Limitations

  • Dataset Size: Trained on a limited dataset, which may affect response accuracy.
  • Factuality: May generate incorrect or nonsensical answers.
  • Language Support: Primarily optimized for Bengali; performance may vary for other languages.

Disclaimer

The Bangla LLaMA GGUF model's performance is contingent on the quality and diversity of the training data. Users should verify the information generated, especially for critical applications.

Additional Resources

Contributors

asif00

6 commits

asif00/bangla-llama-1B-gguf-16bit

Model

0

stars

6

commits

1

repos using this model

2

linked in READMEs

Oct 14, 2024

updated

endpoints_compatible
gguf
llama
question-answering
text-generation-inference
transformers
Browse cluster: Bangla Language Model Fine-tuning

README

Bangla LLaMA GGUF 1B-16bit

Bangla LLaMA GGUF is a 1-billion-parameter language model optimized for Bengali-language tasks such as context-based question answering and retrieval-augmented generation. It is derived from LLaMA 3.2 1B and trained on the OdiaGenAI/all_combined_bengali_252k dataset.

Features

  • Model Size: 1B parameters
  • Format: GGUF (16-bit)
  • Language: Bengali
  • Use Cases:
    • Context-based Question Answering
    • Bengali Retrieval-Augmented Generation
  • Integration: Compatible with llama.cpp and Hugging Face transformers (with conversion)

Usage

1. Using with llama.cpp

Setup

git clone https://github.com/ggerganov/llama.cpp.git
cd llama.cpp
make

Run Inference

./main -m path/to/asif00/bangla-llama-1B-gguf-16bit.gguf -p "আপনার প্রশ্ন এখানে"

2. Using with Hugging Face Transformers

Note: GGUF format is not directly supported by transformers. Conversion to a compatible format is required.

Prerequisites

pip install transformers accelerate

Example Script

from transformers import AutoTokenizer, AutoModelForCausalLM
import torch

# Load tokenizer and model (after conversion)
tokenizer = AutoTokenizer.from_pretrained("asif00/bangla-llama-1B")
model = AutoModelForCausalLM.from_pretrained("path/to/converted-model")

prompt = """
নিচের নির্দেশনা বাংলা ভাষায় যা একটি কাজ বর্ণনা করে, এবং ইনপুটও বাংলা ভাষায় যা অতিরিক্ত প্রসঙ্গ প্রদান করে। উপযুক্তভাবে অনুরোধ পূরণ করে বাংলা ভাষায় একটি প্রতিক্রিয়া লিখুন।

### নির্দেশনা:
{}

### ইনপুট:
{}

### প্রতিক্রিয়া:
"""

def generate_response(instruction, context):
    input_text = prompt.format(instruction, context)
    inputs = tokenizer(input_text, return_tensors="pt").to("cuda")
    output = model.generate(**inputs, max_length=512, eos_token_id=tokenizer.eos_token_id)
    response = tokenizer.decode(output[0], skip_special_tokens=True)
    response = response.split("### প্রতিক্রিয়া:")[-1].strip()
    return response

# Example
instruction = "ভারতীয় বাঙালি কথাসাহিত্যিক মহাশ্বেতা দেবীর সম্পর্কে একটি সংক্ষিপ্ত বিবরণ দিন।"
context = "মহাশ্বেতা দেবী ২০১৬ সালে হৃদরোগে আক্রান্ত হয়ে কলকাতায় মৃত্যুবরণ করেন।"
print(generate_response(instruction, context))

Example

question = "ভারতীয় বাঙালি কথাসাহিত্যিক মহাশ্বেতা দেবীর মৃত্যু কবে হয় ?"
context = (
    "২০১৬ সালের ২৩ জুলাই হৃদরোগে আক্রান্ত হয়ে মহাশ্বেতা দেবী কলকাতার বেল ভিউ ক্লিনিকে ভর্তি হন। "
    "সেই বছরই ২৮ জুলাই একাধিক অঙ্গ বিকল হয়ে তাঁর মৃত্যু ঘটে। তিনি মধুমেহ, সেপ্টিসেমিয়া ও মূত্র সংক্রমণ রোগেও ভুগছিলেন।"
)
answer = generate_response(question, context)
print("উত্তর:", answer)

Output:

উত্তর: মহাশ্বেতা দেবী ২৮ জুলাই ২০১৬ সালে মৃত্যুবরণ করেন।

Limitations

  • Dataset Size: Trained on a limited dataset, which may affect response accuracy.
  • Factuality: May generate incorrect or nonsensical answers.
  • Language Support: Primarily optimized for Bengali; performance may vary for other languages.

Disclaimer

The Bangla LLaMA GGUF model's performance is contingent on the quality and diversity of the training data. Users should verify the information generated, especially for critical applications.

Additional Resources

Contributors

asif00

6 commits