🚀 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 合作开发。如有任何问题,请随时联系他们。