Downloads · 30 days
0
aashay96/indic-BloomLM
indic-BloomLM is a machine learning model from aashay96. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
This repository contains the code and resources for fine-tuning the Huggingface Bloom model on the Indic language dataset using Low-Rank Adaptation (LoRA). The goal is to create a high-performance language model speci…
Downloads · 30 days
0
Access
Public
Updated May 3, 2023
Repo size
19.7 MB
Likes
5
Public
Click a slice to open those files.
.bin19.7 MB · 100%
From the Hugging Face model README
This repository contains the code and resources for fine-tuning the Huggingface Bloom model on the Indic language dataset using Low-Rank Adaptation (LoRA). The goal is to create a high-performance language model specifically tailored to Indic languages.
The dataset used for training is provided by AI4Bharat. I have uploaded it to huggingface hub at:
import torch
from peft import PeftModel, PeftConfig
from transformers import AutoModelForCausalLM, AutoTokenizer
peft_model_id = "aashay96/indic-BloomLM"
config = PeftConfig.from_pretrained(peft_model_id)
model = AutoModelForCausalLM.from_pretrained(config.base_model_name_or_path, return_dict=True, load_in_8bit=True, device_map='auto')
tokenizer = AutoTokenizer.from_pretrained(config.base_model_name_or_path)
# Load the Lora model
model = PeftModel.from_pretrained(model, peft_model_id)
batch = tokenizer("आप कैसे हैं", return_tensors='pt')
with torch.cuda.amp.autocast():
output_tokens = model.generate(**batch, max_new_tokens=10)
print('\n\n', tokenizer.decode(output_tokens[0], skip_special_tokens=True))