Upload README.md with huggingface_hub
Browse files
README.md
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
datasets:
|
3 |
+
- yahma/alpaca-cleaned
|
4 |
+
license: other
|
5 |
+
license_name: microsoft-research-license
|
6 |
+
license_link: https://huggingface.co/microsoft/phi-2/resolve/main/LICENSE
|
7 |
+
language:
|
8 |
+
- en
|
9 |
+
tags:
|
10 |
+
- automation
|
11 |
+
- home
|
12 |
+
- assistant
|
13 |
+
pipeline_tag: text-generation
|
14 |
+
---
|
15 |
+
|
16 |
+
# Home 3B
|
17 |
+
The "Home" model is a fine tuning of the Phi-2 model from Microsoft. The model is able to control devices in the user's house as well as perform basic question and answering. The fine tuning dataset is a combination of the [Cleaned Stanford Alpaca Dataset](https://huggingface.co/datasets/yahma/alpaca-cleaned) as well as a [custom curated dataset](./data) designed to teach the model function calling.
|
18 |
+
|
19 |
+
The model is quantized using Lama.cpp in order to enable running the model in super low resource environments that are common with Home Assistant installations such as Rapsberry Pis.
|
20 |
+
|
21 |
+
The model can be used as an "instruct" type model using the ChatML prompt format. The system prompt is used to provide information about the state of the Home Assistant installation including available devices and callable services.
|
22 |
+
|
23 |
+
Example "system" prompt:
|
24 |
+
```
|
25 |
+
You are 'Al', a helpful AI Assistant that controls the devices in a house. Complete the following task as instructed with the information provided only.
|
26 |
+
Services: light.turn_off, light.turn_on, fan.turn_on, fan.turn_off
|
27 |
+
Devices:
|
28 |
+
light.office 'Office Light' = on
|
29 |
+
fan.office 'Office fan' = off
|
30 |
+
light.kitchen 'Kitchen Light' = on
|
31 |
+
```
|
32 |
+
|
33 |
+
Output from the model will consist of a response that should be relayed back to the user, along with an optional code block that will invoke different Home Assistant "services". The output format from the model for function calling is as follows:
|
34 |
+
|
35 |
+
`````
|
36 |
+
turning on the kitchen lights for you now
|
37 |
+
```homeassistant
|
38 |
+
light.turn_on(light.kitchen)
|
39 |
+
```
|
40 |
+
`````
|
41 |
+
|
42 |
+
Due to the mix of data used during fine tuning, the model is also capable of basic instruct and QA tasks. For example, the model is able to perform basic logic tasks such as the following:
|
43 |
+
|
44 |
+
```
|
45 |
+
user if mary is 7 years old, and I am 3 years older than her. how old am I?
|
46 |
+
assistant If Mary is 7 years old, then you are 10 years old (7+3=10).
|
47 |
+
```
|
48 |
+
|
49 |
+
## Training
|
50 |
+
The model was trained as a LoRA on an RTX 3090 (24GB) using a custom training script to enable gradient checkpointing. The LoRA has rank = 32, alpha = 64, targets the `fc1,fc2,Wqkv,out_proj` modules and "saves" the `wte,lm_head.linear` modules The embedding weights were "saved" and trained normally along with the rank matricies in order to train the newly added tokens to the embeddings. The full model is merged together at the end.
|
51 |
+
|
52 |
+
## Datasets
|
53 |
+
Snythetic Dataset for SFT - https://github.com/acon96/home-llm
|
54 |
+
Stanford Alpaca Cleaned - https://huggingface.co/datasets/yahma/alpaca-cleaned
|
55 |
+
|
56 |
+
## License
|
57 |
+
This model is a fine-tuning of the Microsoft Phi model series and as such is licensed under the Microsoft Research License. The fine-tuned model is shared FOR RESEARCH PURPOSES ONLY. It is not to be used in any sort of commercial capacity.
|