🚀 Indic-gemma-2b-finetuned-sft-Navarasa-2.0
このモデルはgoogle/gemma-2bをベースに、15種類のインドの言語と英語の命令データセットでLoRA微調整されています。これにより、多言語に対応した高性能なテキスト生成が可能になります。
🚀 クイックスタート
このモデルは、多言語の命令データセットを用いて微調整されており、以下の手順で利用することができます。まずは必要なライブラリをインストールし、推論コードを実行しましょう。
✨ 主な機能
- 15種類のインドの言語と英語に対応したテキスト生成が可能です。
- unslothライブラリを用いた高速推論がサポートされています。
- HuggingFaceライブラリを使用した推論も可能です。
📦 インストール
必要なライブラリをインストールするには、以下のコマンドを実行します。
!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"
💻 使用例
基本的な使用法
unsloth
を使用した推論の基本的なコード例は以下の通りです。
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)
高度な使用法
HuggingFaceライブラリを使用した推論のコード例は以下の通りです。
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}
学習詳細
このモデルは約65万件の命令サンプルで学習されています。
- GPU: 1台のA100(80GB)
- 学習時間: 45時間
- 学習プラットフォーム: E2E Networks
データセット
このモデルの学習に使用されたデータセットは以下の通りです。
- ヒンディー語 - ravithejads/samvaad-hi-filtered, HydraIndicLM/hindi_alpaca_dolly_67k(サンプリング済み)
- テルグ語 - Telugu-LLM-Labs/telugu_alpaca_yahma_cleaned_filtered_romanized, Telugu-LLM-Labs/telugu_teknium_GPTeacher_general_instruct_filtered_romanized
- マラーティー語 - Telugu-LLM-Labs/sindhi_alpaca_yahma_cleaned_filtered
- ウルドゥー語 - Telugu-LLM-Labs/urdu_alpaca_yahma_cleaned_filtered
- アッサム語 - Telugu-LLM-Labs/assamese_alpaca_yahma_cleaned_filtered
- コンカニー語 - Telugu-LLM-Labs/konkani_alpaca_yahma_cleaned_filtered
- ネパール語 - Telugu-LLM-Labs/nepali_alpaca_yahma_cleaned_filtered
- シンド語 - Telugu-LLM-Labs/sindhi_alpaca_yahma_cleaned_filtered
- タミル語 - abhinand/tamil-alpaca
- カンナダ語 - Tensoic/airoboros-3.2_kn, Tensoic/gpt-teacher_kn
- マラヤーラム語 - VishnuPJ/Alpaca_Instruct_Malayalam
- グジャラート語 - Tensoic/Alpaca-Gujarati
- パンジャブ語 - HydraIndicLM/punjabi_alpaca_52K
- ベンガル語 - HydraIndicLM/bengali_alpaca_dolly_67k(アルパカフィルタ済み)
- オリヤー語 - OdiaGenAI/Odia_Alpaca_instructions_52k, OdiaGenAI/gpt-teacher-roleplay-odia-3k
- 英語 - yahma/alpaca-cleaned
開発者
このモデルはRavi ThejaとRamsri Gouthamによる共同開発の成果物です。ご質問があれば、どちらかにDMを送ってください。
サンプル例
サンプル例については、ブログ記事を参照してください。
コードリポジトリ
学習と推論のスクリプトについては、コードリポジトリをご確認ください。
📄 ライセンス
このモデルはgemma-terms-of-useのライセンスの下で提供されています。