Text Generation
Transformers
Safetensors
phi3
fine-tuned
merged
lora
japanese
qa
question-answering
conversational
text-generation-inference
Instructions to use eyepyon/rcrcPhi4miniR-merged-final with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use eyepyon/rcrcPhi4miniR-merged-final with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="eyepyon/rcrcPhi4miniR-merged-final") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("eyepyon/rcrcPhi4miniR-merged-final") model = AutoModelForCausalLM.from_pretrained("eyepyon/rcrcPhi4miniR-merged-final") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use eyepyon/rcrcPhi4miniR-merged-final with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "eyepyon/rcrcPhi4miniR-merged-final" # 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/rcrcPhi4miniR-merged-final", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/eyepyon/rcrcPhi4miniR-merged-final
- SGLang
How to use eyepyon/rcrcPhi4miniR-merged-final 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/rcrcPhi4miniR-merged-final" \ --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/rcrcPhi4miniR-merged-final", "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/rcrcPhi4miniR-merged-final" \ --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/rcrcPhi4miniR-merged-final", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use eyepyon/rcrcPhi4miniR-merged-final with Docker Model Runner:
docker model run hf.co/eyepyon/rcrcPhi4miniR-merged-final
eyepyon/rcrcPhi4miniR-merged-final
このモデルは、microsoft/Phi-4-mini-reasoning をベースにLoRAでファインチューニングし、その後アダプターをベースモデルにマージした完全なモデルです。
🚀 クイックスタート
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
# モデルとトークナイザーを読み込み
model = AutoModelForCausalLM.from_pretrained(
"eyepyon/rcrcPhi4miniR-merged-final",
torch_dtype=torch.float16,
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained("eyepyon/rcrcPhi4miniR-merged-final")
# 質問応答の実行
def ask_question(context, question):
input_text = f"### コンテキスト:\n{context}\n\n### 質問:\n{question}\n\n### 回答:\n"
inputs = tokenizer(input_text, return_tensors="pt")
# GPUに移動(利用可能な場合)
if torch.cuda.is_available():
inputs = {k: v.to(model.device) for k, v in inputs.items()}
with torch.no_grad():
outputs = model.generate(
**inputs,
max_length=512,
do_sample=True,
temperature=0.7,
top_p=0.9,
pad_token_id=tokenizer.eos_token_id
)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
if "### 回答:" in response:
response = response.split("### 回答:")[-1].strip()
return response
# 使用例
context = "人工知能は機械が人間のような知的行動を示す技術分野です。"
question = "人工知能の主な応用分野は何ですか?"
answer = ask_question(context, question)
print(f"回答: {answer}")
📝 モデル情報
| 項目 | 詳細 |
|---|---|
| ベースモデル | microsoft/Phi-4-mini-reasoning |
| ファインチューニング手法 | LoRA (Low-Rank Adaptation) |
| マージ済み | ✅ はい(単独で動作) |
| 対応言語 | 🇯🇵 日本語 |
| 主要タスク | 質問応答 |
⚙️ ファインチューニング設定
- LoRAランク: 8
- LoRA Alpha: 16
- ターゲットモジュール: q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj
- 量子化: 4ビット (QLoRA)
- 最大シーケンス長: 256-512トークン
- バッチサイズ: 1 × 4 (gradient accumulation)
- 学習率: 2e-4
📊 入力フォーマット
### コンテキスト:
[背景情報やコンテキスト]
### 質問:
[ユーザーの質問]
### 回答:
[モデルが生成する回答]
💡 使用例
基本的な質問応答
context = "量子コンピュータは量子力学の原理を利用した計算機です。"
question = "量子コンピュータの特徴は?"
answer = ask_question(context, question)
⚠️ 制限事項
- 主に日本語での質問応答に最適化
- 生成される回答の事実確認が必要
- 特定のドメイン知識でのファインチューニング
📄 ライセンス
Apache 2.0 License
最終更新: 2025年05月25日
- Downloads last month
- 4
Model tree for eyepyon/rcrcPhi4miniR-merged-final
Base model
microsoft/Phi-4-mini-reasoning