🚀 Indic-gemma-7b-finetuned-sft-Navarasa-2.0
本模型基于 google/gemma-7b,并在 15 种印度语言和英语的指令数据集上进行了 LoRA 微调。它能够处理多种印度语言的文本生成任务,为多语言自然语言处理提供了强大的支持。
🚀 快速开始
本模型基于 google/gemma-7b,并在 15 种印度语言和英语的指令数据集上进行了 LoRA 微调。以下是使用该模型的基本信息。
✨ 主要特性
- 多语言支持:支持 15 种印度语言(泰卢固语、英语、泰米尔语等)和英语,能处理多种语言的文本生成任务。
- 高效微调:使用 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-7b-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 AutoModelForCausalLM, AutoTokenizer
import torch
model = AutoModelForCausalLM.from_pretrained(
"Telugu-LLM-Labs/Indic-gemma-7b-finetuned-sft-Navarasa-2.0",
load_in_4bit = False,
token = hf_token
)
model.to("cuda")
tokenizer = AutoTokenizer.from_pretrained("Telugu-LLM-Labs/Indic-gemma-7b-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
数据集
参考资料
开发者
本模型由 Ravi Theja 和 Ramsri Goutham 合作完成。如有任何问题,欢迎随时联系他们。
📄 许可证