Update README.md
Browse files
README.md
CHANGED
@@ -2,4 +2,86 @@
|
|
2 |
license: apache-2.0
|
3 |
base_model:
|
4 |
- microsoft/Phi-3-mini-4k-instruct
|
5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
license: apache-2.0
|
3 |
base_model:
|
4 |
- microsoft/Phi-3-mini-4k-instruct
|
5 |
+
tags:
|
6 |
+
- gguf
|
7 |
+
- phi3
|
8 |
+
- finetuned
|
9 |
+
- llama.cpp
|
10 |
+
- ollama
|
11 |
+
- legal-assistant
|
12 |
+
language:
|
13 |
+
- en
|
14 |
+
---
|
15 |
+
|
16 |
+
# π§ Phi-3 Mini Fine-Tuned (GGUF) β Legal Assistant
|
17 |
+
|
18 |
+
This is a **LoRA fine-tuned** version of `microsoft/phi-3-mini-4k-instruct` converted to **GGUF format** for use with `llama.cpp`, `Ollama`, or compatible runtimes.
|
19 |
+
|
20 |
+
It was trained on legal documents to act as a **context-aware legal assistant** that can answer questions from uploaded contracts and policies.
|
21 |
+
|
22 |
+
## π§ Model Details
|
23 |
+
|
24 |
+
- **Base model**: `microsoft/phi-3-mini-4k-instruct`
|
25 |
+
- **Fine-tuned with**: [LoRA](https://huggingface.co/docs/peft/index) (PEFT) + [TRLL SFTTrainer](https://huggingface.co/docs/trl)
|
26 |
+
- **Converted to GGUF using**: `convert_hf_to_gguf.py` from `llama.cpp`
|
27 |
+
|
28 |
+
## π How to Use
|
29 |
+
|
30 |
+
### π With `llama.cpp`
|
31 |
+
```bash
|
32 |
+
./main -m phi3-finetuned.gguf -p "What rights does this contract give me?"
|
33 |
+
```
|
34 |
+
|
35 |
+
### π With `π With Python + llama-cpp-python`
|
36 |
+
```bash
|
37 |
+
from llama_cpp import Llama
|
38 |
+
|
39 |
+
llm = Llama(model_path="phi3-finetuned.gguf")
|
40 |
+
output = llm("Summarize the terms of this agreement.")
|
41 |
+
print(output)
|
42 |
+
```
|
43 |
+
|
44 |
+
### π With `π€ With Ollama (if merged)`
|
45 |
+
```bash
|
46 |
+
ollama create phi3-legal -f Modelfile
|
47 |
+
ollama run phi3-legal
|
48 |
+
```
|
49 |
+
---
|
50 |
+
|
51 |
+
|
52 |
+
## π§Ύ Use Cases
|
53 |
+
|
54 |
+
This fine-tuned model is intended for legal document analysis and Q&A applications.
|
55 |
+
|
56 |
+
**Example questions it can answer:**
|
57 |
+
|
58 |
+
- _"Can this agreement be terminated without prior notice?"_
|
59 |
+
- _"Do I have refund rights under this policy?"_
|
60 |
+
- _"What are the obligations mentioned in clause 3?"_
|
61 |
+
- _"Is there an arbitration clause in this contract?"_
|
62 |
+
|
63 |
+
It is designed to provide helpful, non-legal-advice explanations by summarizing and interpreting clauses based on the uploaded text context.
|
64 |
+
|
65 |
+
---
|
66 |
+
|
67 |
+
## π Files
|
68 |
+
|
69 |
+
| File | Description |
|
70 |
+
|--------------------------|------------------------------------------|
|
71 |
+
| `phi3-finetuned.gguf` | The GGUF format model file for inference |
|
72 |
+
| `README.md` | Description and usage guide (this file) |
|
73 |
+
| `Modelfile` *(optional)* | Ollama model recipe (if you use Ollama) |
|
74 |
+
|
75 |
+
---
|
76 |
+
|
77 |
+
## π§ Credits
|
78 |
+
|
79 |
+
- **Project**: [DocuAnalyzer AI](https://huggingface.co/spaces/VGreatVig07/Docu_Analyzer)
|
80 |
+
- **Author**: Vighnesh M S ([@VGreatVig07](https://huggingface.co/VGreatVig07))
|
81 |
+
- **Fine-tuning**: Performed using Hugging Face `transformers`, `trl`, and `PEFT` (LoRA)
|
82 |
+
- **Conversion**: Model converted to `.gguf` format using `llama.cpp`'s `convert_hf_to_gguf.py`
|
83 |
+
|
84 |
+
Thanks to open-source contributions from:
|
85 |
+
- Microsoft (Phi-3 base model)
|
86 |
+
- Hugging Face ecosystem
|
87 |
+
- llama.cpp team
|