Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- en
|
| 4 |
+
license: mit
|
| 5 |
+
base_model: microsoft/Phi-3-mini-4k-instruct
|
| 6 |
+
tags:
|
| 7 |
+
- lora
|
| 8 |
+
- fine-tuned
|
| 9 |
+
- rpg
|
| 10 |
+
- basic-fantasy
|
| 11 |
+
- bfrpg
|
| 12 |
+
- tabletop
|
| 13 |
+
datasets:
|
| 14 |
+
- custom
|
| 15 |
+
pipeline_tag: text-generation
|
| 16 |
+
---
|
| 17 |
+
|
| 18 |
+
# Phi-3 Mini 4K Instruct — BFRPG Fine-Tune
|
| 19 |
+
|
| 20 |
+
A fine-tuned version of [Microsoft Phi-3 Mini 4K Instruct](https://huggingface.co/microsoft/Phi-3-mini-4k-instruct) trained on Basic Fantasy Role-Playing Game (BFRPG) Thief abilities rules Q&A.
|
| 21 |
+
|
| 22 |
+
## Model Details
|
| 23 |
+
|
| 24 |
+
| Property | Value |
|
| 25 |
+
|----------|-------|
|
| 26 |
+
| **Base Model** | [Microsoft Phi-3 Mini 4K Instruct](https://huggingface.co/microsoft/Phi-3-mini-4k-instruct) |
|
| 27 |
+
| **Parameters** | ~3.8B |
|
| 28 |
+
| **Fine-Tuning Method** | LoRA SFT (merged) |
|
| 29 |
+
| **Precision** | bfloat16 |
|
| 30 |
+
| **LoRA Rank** | 16 |
|
| 31 |
+
| **LoRA Alpha** | 32 |
|
| 32 |
+
| **LoRA Dropout** | 0.05 |
|
| 33 |
+
| **Epochs** | 5 |
|
| 34 |
+
| **Batch Size** | 4 |
|
| 35 |
+
| **Learning Rate** | 2e-4 |
|
| 36 |
+
| **Hardware** | NVIDIA DGX Spark (GB10 Blackwell) |
|
| 37 |
+
|
| 38 |
+
## Training Data
|
| 39 |
+
|
| 40 |
+
8 synthetic Q&A pairs generated from the Basic Fantasy RPG rulebook, focused on Thief class abilities (Open Locks, Pick Pockets, Move Silently, etc.). Data was generated using an LLM-based synthetic data generation pipeline with faithfulness judging.
|
| 41 |
+
|
| 42 |
+
The model uses the following system prompt:
|
| 43 |
+
|
| 44 |
+
> You are a rules expert for the Basic Fantasy Role-Playing Game. Answer questions accurately based on the official rules. Be specific and cite page references or table values where possible.
|
| 45 |
+
|
| 46 |
+
## Usage
|
| 47 |
+
|
| 48 |
+
```python
|
| 49 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 50 |
+
|
| 51 |
+
model = AutoModelForCausalLM.from_pretrained("FrankDigsData/phi3-mini-rhai-finetuned")
|
| 52 |
+
tokenizer = AutoTokenizer.from_pretrained("FrankDigsData/phi3-mini-rhai-finetuned")
|
| 53 |
+
|
| 54 |
+
messages = [
|
| 55 |
+
{"role": "system", "content": "You are a rules expert for the Basic Fantasy Role-Playing Game. Answer questions accurately based on the official rules."},
|
| 56 |
+
{"role": "user", "content": "What is a level 5 Thief's Pick Pockets score?"}
|
| 57 |
+
]
|
| 58 |
+
|
| 59 |
+
inputs = tokenizer.apply_chat_template(messages, return_tensors="pt", add_generation_prompt=True)
|
| 60 |
+
outputs = model.generate(inputs, max_new_tokens=256)
|
| 61 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
| 62 |
+
```
|
| 63 |
+
|
| 64 |
+
## Context
|
| 65 |
+
|
| 66 |
+
This model was fine-tuned as part of a Red Hat AI workshop comparing small model adaptation techniques across multiple architectures.
|