Instructions to use eyepyon/rcPhi4miniR-finetuned with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use eyepyon/rcPhi4miniR-finetuned with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="eyepyon/rcPhi4miniR-finetuned") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("eyepyon/rcPhi4miniR-finetuned", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use eyepyon/rcPhi4miniR-finetuned with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "eyepyon/rcPhi4miniR-finetuned" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "eyepyon/rcPhi4miniR-finetuned", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/eyepyon/rcPhi4miniR-finetuned
- SGLang
How to use eyepyon/rcPhi4miniR-finetuned with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "eyepyon/rcPhi4miniR-finetuned" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "eyepyon/rcPhi4miniR-finetuned", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "eyepyon/rcPhi4miniR-finetuned" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "eyepyon/rcPhi4miniR-finetuned", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use eyepyon/rcPhi4miniR-finetuned with Docker Model Runner:
docker model run hf.co/eyepyon/rcPhi4miniR-finetuned
eyepyon/rcPhi4miniR-finetuned
このモデルは、microsoft/Phi-4-mini-reasoning をベースにLoRAでファインチューニングされたモデルです。
モデル情報
- ベースモデル: microsoft/Phi-4-mini-reasoning
- ファインチューニング手法: LoRA (Low-Rank Adaptation)
- アテンション実装: eager (Phi-4推奨)
- 量子化: 4ビット (QLoRA)
- 対応言語: 日本語
- タスク: 質問応答
使用方法
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
# ベースモデルとトークナイザーを読み込み
base_model = AutoModelForCausalLM.from_pretrained(
"microsoft/Phi-4-mini-reasoning",
torch_dtype="auto",
device_map="auto",
attn_implementation="eager",
trust_remote_code=True
)
tokenizer = AutoTokenizer.from_pretrained("microsoft/Phi-4-mini-reasoning")
# LoRAアダプターを適用
model = PeftModel.from_pretrained(base_model, "eyepyon/rcPhi4miniR-finetuned")
# 推論
input_text = "### コンテキスト:\n[コンテキスト]\n\n### 質問:\n[質問]\n\n### 回答:\n"
inputs = tokenizer(input_text, return_tensors="pt")
outputs = model.generate(**inputs, max_length=200, do_sample=True, temperature=0.7)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(response)
入力フォーマット
### コンテキスト:
[背景情報]
### 質問:
[ユーザーの質問]
### 回答:
[期待される回答]
トレーニング設定
- LoRAランク: 8
- LoRA Alpha: 16
- ターゲットモジュール: qkv_proj, o_proj, gate_up_proj, down_proj
- 学習率: 2e-4
- バッチサイズ: 1 × 4 (gradient accumulation)
- エポック数: 3
注意事項
- Phi-4モデル使用のため
attn_implementation="eager"が推奨されます use_cache=Falseでトレーニングされています- グラディエントチェックポイント対応済み
Model tree for eyepyon/rcPhi4miniR-finetuned
Base model
microsoft/Phi-4-mini-reasoning
docker model run hf.co/eyepyon/rcPhi4miniR-finetuned