Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
base_model: microsoft/Phi-3-mini-4k-instruct
|
| 4 |
+
tags:
|
| 5 |
+
- phi-3
|
| 6 |
+
- lora
|
| 7 |
+
- personality
|
| 8 |
+
- disc
|
| 9 |
+
- zootopia
|
| 10 |
+
language:
|
| 11 |
+
- fr
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
# Phi-3-mini QuelAnimalEsTu - LoRA Adapter
|
| 15 |
+
|
| 16 |
+
Modèle fine-tuné pour attribuer des animaux symboliques basés sur les profils de personnalité DISC.
|
| 17 |
+
|
| 18 |
+
## Utilisation
|
| 19 |
+
```python
|
| 20 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 21 |
+
from peft import PeftModel
|
| 22 |
+
|
| 23 |
+
# Charger modèle de base
|
| 24 |
+
base_model = AutoModelForCausalLM.from_pretrained(
|
| 25 |
+
"microsoft/Phi-3-mini-4k-instruct",
|
| 26 |
+
torch_dtype="auto",
|
| 27 |
+
device_map="auto",
|
| 28 |
+
trust_remote_code=True
|
| 29 |
+
)
|
| 30 |
+
|
| 31 |
+
# Charger adaptateur LoRA
|
| 32 |
+
model = PeftModel.from_pretrained(base_model, "beartoryio/phi3-quelanimal-lora")
|
| 33 |
+
|
| 34 |
+
# Tokenizer
|
| 35 |
+
tokenizer = AutoTokenizer.from_pretrained("beartoryio/phi3-quelanimal-lora")
|
| 36 |
+
|
| 37 |
+
# Inférence
|
| 38 |
+
prompt = "<|user|>\nQuel animal me correspond ?\n<|end|>\n<|assistant|>\n"
|
| 39 |
+
inputs = tokenizer(prompt, return_tensors="pt")
|
| 40 |
+
outputs = model.generate(**inputs, max_new_tokens=150)
|
| 41 |
+
print(tokenizer.decode(outputs[0]))
|
| 42 |
+
```
|
| 43 |
+
|
| 44 |
+
## Dataset
|
| 45 |
+
|
| 46 |
+
Entraîné sur 8000 conversations générées avec profils DISC et animaux Zootopia.
|
| 47 |
+
|
| 48 |
+
## Entraînement
|
| 49 |
+
|
| 50 |
+
- Méthode : LoRA (r=8, alpha=16)
|
| 51 |
+
- Epochs : 3
|
| 52 |
+
- Batch size : 1 (gradient accumulation: 16)
|
| 53 |
+
- Learning rate : 2e-4
|
| 54 |
+
- GPU : RTX 4090 24GB
|
| 55 |
+
- Durée : ~2h
|