🚀 Indic-gemma-2b-finetuned-sft-Navarasa-2.0
本模型基於 google/gemma-2b,並在15種印度語言和英語的指令數據集上進行了LoRA微調。它能夠處理多種印度語言的文本生成任務,為多語言自然語言處理提供了強大的支持。
🚀 快速開始
本模型基於 google/gemma-2b,並在15種印度語言和英語的指令數據集上進行了LoRA微調。可使用 unsloth 庫進行推理,也可以使用HuggingFace庫。
✨ 主要特性
- 多語言支持:支持15種印度語言和英語,包括泰盧固語(te)、英語(en)、泰米爾語(ta)等。
- 微調優化:在大量指令樣本上進行微調,提升了模型在特定任務上的性能。
- 快速推理:提供了使用 unsloth 庫的推理代碼,實現更快的推理。
📦 安裝指南
!pip install -U xformers --index-url https://download.pytorch.org/whl/cu121
!pip install "unsloth[kaggle-new] @git+https://github.com/unslothai/unsloth.git@nightly"
💻 使用示例
基礎用法
from unsloth import FastLanguageModel
import torch
max_seq_length = 2048
dtype = None # None for auto detection. Float16 for Tesla T4, V100, Bfloat16 for Ampere+
load_in_4bit = False
model, tokenizer = FastLanguageModel.from_pretrained(
model_name = "Telugu-LLM-Labs/Indic-gemma-2b-finetuned-sft-Navarasa-2.0",
max_seq_length = max_seq_length,
dtype = dtype,
load_in_4bit = load_in_4bit,
device_map="auto"
)
FastLanguageModel.for_inference(model) # Enable native 2x faster inference
input_prompt = """
### Instruction:
{}
### Input:
{}
### Response:
{}"""
input_text = input_prompt.format(
"Tranlsate following sentence to Hindi.", # instruction
"India is a great country.", # input
"", # output - leave this blank for generation!
)
inputs = tokenizer([input_text], return_tensors = "pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens = 300, use_cache = True)
response = tokenizer.batch_decode(outputs)
高級用法
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
model = AutoModelForCausalLM.from_pretrained(
"Telugu-LLM-Labs/Indic-gemma-2b-finetuned-sft-Navarasa-2.0",
load_in_4bit = False,
token = hf_token
)
model.to("cuda")
tokenizer = AutoTokenizer.from_pretrained("Telugu-LLM-Labs/Indic-gemma-2b-finetuned-sft-Navarasa-2.0")
input_prompt = """
### Instruction:
{}
### Input:
{}
### Response:
{}"""
input_text = input_prompt.format(
"Tranlsate following sentence to Hindi.", # instruction
"India is a great country.", # input
"", # output - leave this blank for generation!
)
inputs = tokenizer([input_text], return_tensors = "pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens = 300, use_cache = True)
response = tokenizer.batch_decode(outputs)[0]
📚 詳細文檔
輸入文本格式
### Instruction: {instruction}
### Input: {input}
## Response: {response}
訓練詳情
- 訓練樣本:約650K條指令樣本。
- GPU:1個A100,80GB。
- 訓練時間:45小時。
- 訓練平臺:E2E Networks
數據集
更多信息
- 示例參考:請參考 博客文章 獲取示例。
- 代碼倉庫:請查看 代碼倉庫 獲取訓練和推理腳本。
📄 許可證
本模型使用 gemma-terms-of-use 許可證。
🔧 技術細節
模型信息
開發者
本模型由 Ravi Theja 和 Ramsri Goutham 合作開發。如有任何問題,請隨時聯繫他們。