mirror of
https://github.com/acon96/home-llm.git
synced 2026-01-08 05:14:02 -05:00
clean up readme and add new model
This commit is contained in:
88
README.md
88
README.md
@@ -37,7 +37,7 @@ The latest models can be found on HuggingFace:
|
||||
|
||||
**Gemma3**:
|
||||
1B: TBD
|
||||
270M: TBD
|
||||
270M: https://huggingface.co/acon96/Home-FunctionGemma-270m
|
||||
|
||||
<details>
|
||||
|
||||
@@ -61,101 +61,17 @@ NOTE: The models below are only compatible with version 0.2.17 and older!
|
||||
|
||||
The model is quantized using Llama.cpp in order to enable running the model in super low resource environments that are common with Home Assistant installations such as Raspberry Pis.
|
||||
|
||||
The model can be used as an "instruct" type model using the [ChatML](https://github.com/MicrosoftDocs/azure-docs/blob/main/articles/ai-services/openai/includes/chat-markup-language.md) or [Zephyr](https://huggingface.co/HuggingFaceH4/zephyr-7b-alpha/discussions/3) prompt format (depends on the model). The system prompt is used to provide information about the state of the Home Assistant installation including available devices and callable services.
|
||||
|
||||
Example "system" prompt:
|
||||
```
|
||||
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.
|
||||
The current time and date is 08:12 AM on Thursday March 14, 2024
|
||||
Services: light.turn_off(), light.turn_on(brightness,rgb_color), fan.turn_on(), fan.turn_off()
|
||||
Devices:
|
||||
light.office 'Office Light' = on;80%
|
||||
fan.office 'Office fan' = off
|
||||
light.kitchen 'Kitchen Light' = on;80%;red
|
||||
light.bedroom 'Bedroom Light' = off
|
||||
```
|
||||
|
||||
For more about how the model is prompted see [Model Prompting](/docs/Model%20Prompting.md)
|
||||
|
||||
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:
|
||||
|
||||
`````
|
||||
turning on the kitchen lights for you now
|
||||
```homeassistant
|
||||
{ "service": "light.turn_on", "target_device": "light.kitchen" }
|
||||
```
|
||||
`````
|
||||
|
||||
Due to the mix of data used during fine tuning, the 3B 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 (Zephyr prompt format shown):
|
||||
|
||||
```
|
||||
<|system|>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.
|
||||
*snip*
|
||||
<|endoftext|>
|
||||
<|user|>
|
||||
if mary is 7 years old, and I am 3 years older than her. how old am I?<|endoftext|>
|
||||
<|assistant|>
|
||||
If Mary is 7 years old, then you are 10 years old (7+3=10).<|endoftext|>
|
||||
```
|
||||
|
||||
### Synthetic Dataset
|
||||
The synthetic dataset is aimed at covering basic day to day operations in home assistant such as turning devices on and off.
|
||||
The supported entity types are: light, fan, cover, lock, media_player, climate, switch
|
||||
|
||||
The dataset is available on HuggingFace: https://huggingface.co/datasets/acon96/Home-Assistant-Requests
|
||||
The dataset is available on HuggingFace: https://huggingface.co/datasets/acon96/Home-Assistant-Requests-V2
|
||||
The source for the dataset is in the [data](/data) of this repository.
|
||||
|
||||
### Training
|
||||
|
||||
If you want to prepare your own training environment, see the details on how to do it in the [Training Guide](./docs/Training.md) document.
|
||||
|
||||
<details>
|
||||
|
||||
<summary>Training Details</summary>
|
||||
|
||||
The 3B model was trained as a full fine-tuning on 2x RTX 4090 (48GB). Training time took approximately 28 hours. It was trained on the `--large` dataset variant.
|
||||
|
||||
```console
|
||||
accelerate launch --config_file fsdp_config.yaml train.py \
|
||||
--run_name home-3b \
|
||||
--base_model stabilityai/stablelm-zephyr-3b \
|
||||
--bf16 \
|
||||
--train_dataset data/home_assistant_train.jsonl \
|
||||
--learning_rate 1e-5 \
|
||||
--batch_size 64 \
|
||||
--epochs 1 \
|
||||
--micro_batch_size 2 \
|
||||
--gradient_checkpointing \
|
||||
--group_by_length \
|
||||
--ctx_size 2048 \
|
||||
--save_steps 50 \
|
||||
--save_total_limit 10 \
|
||||
--eval_steps 100 \
|
||||
--logging_steps 2
|
||||
```
|
||||
|
||||
The 1B model was trained as a full fine-tuning on an RTX 3090 (24GB). Training took approximately 2 hours. It was trained on the `--medium` dataset variant.
|
||||
|
||||
```console
|
||||
python3 train.py \
|
||||
--run_name home-1b \
|
||||
--base_model TinyLlama/TinyLlama-1.1B-Chat-v1.0 \
|
||||
--bf16 \
|
||||
--train_dataset data/home_assistant_train.jsonl \
|
||||
--test_dataset data/home_assistant_test.jsonl \
|
||||
--learning_rate 2e-5 \
|
||||
--batch_size 32 \
|
||||
--micro_batch_size 8 \
|
||||
--gradient_checkpointing \
|
||||
--group_by_length \
|
||||
--ctx_size 2048 \
|
||||
--save_steps 100 \
|
||||
--save_total_limit 10
|
||||
--prefix_ids 29966,29989,465,22137,29989,29958,13 \
|
||||
--suffix_ids 2
|
||||
```
|
||||
</details>
|
||||
|
||||
|
||||
## Version History
|
||||
| Version | Description |
|
||||
|
||||
@@ -9,20 +9,24 @@ tags:
|
||||
- assistant
|
||||
language:
|
||||
- en
|
||||
pretty_name: Home Assistant Requests
|
||||
pretty_name: Home Assistant Requests V2
|
||||
size_categories:
|
||||
- 10K<n<100k
|
||||
---
|
||||
|
||||
# Home Assistant Requests Dataset
|
||||
# Home Assistant Requests V2 Dataset
|
||||
|
||||
This dataset contains a list of requests and responses for a user interacting with a personal assistant that controls an instance of [Home Assistant](https://www.home-assistant.io/).
|
||||
|
||||
This dataset is NOT distributed as a static file, but as a Python script. This is due to the multitude of different formats that are used in the LLM fine-tuning ecosystem. The goal is to be able to support using this dataset to fine-tune any desired model, and to support that, you need to be able to generate the dataset in the exact format that matches the model you want to fine-tune.
|
||||
The updated V2 of the dataset is now multilingual, containing data in English, German, French, Spanish, and Polish. The dataset also contains multiple "personalities" for the assistant to respond in, such as a formal assistant, a sarcastic assistant, and a friendly assistant. Lastly, the dataset has been updated to fully support modern tool-calling formats.
|
||||
|
||||
## Assembling the dataset
|
||||
|
||||
> NOTE: If you are viewing this dataset on HuggingFace, you can download the "small" dataset variant directly from the "Files and versions" tab.
|
||||
|
||||
The dataset is generated from the different CSV "piles". The "piles" contain different chunks of requests that are assembled into a final context that is presented to the LLM. For example, `piles/<language>/pile_of_device_names.csv` contains only names of various devices to be used as part of context as well as inserted into `piles/<language>/pile_of_templated_actions.csv` and `piles/<language>/pile_of_status_requests.csv`. The logic for assembling the final dataset from the piles is contained in [generate_data.py](./generate_data.py).
|
||||
|
||||
## Prepare environment
|
||||
### Prepare environment
|
||||
|
||||
Start by installing system dependencies:
|
||||
`sudo apt-get install python3-dev`
|
||||
@@ -34,24 +38,14 @@ source .generate_data/bin/activate
|
||||
pip3 install -r requirements.txt
|
||||
```
|
||||
|
||||
## Generating the dataset from piles
|
||||
### Generating the dataset from piles
|
||||
|
||||
`python3 generate_data.py --train --test --large --sharegpt`
|
||||
`python3 generate_data.py --train --test --small --language english german french spanish polish`
|
||||
|
||||
Supported dataset splits are `--test`, `--train`, & `--sample`
|
||||
Arguments to set the train dataset size are `--small`, `--medium`, `--large`, & `--xl`.
|
||||
Languages can be enabled using `--language english german french spanish polish`
|
||||
|
||||
## Merging with other instruct-datasets for training
|
||||
|
||||
`python3 generate_data.py --merge <dataset>`
|
||||
|
||||
Supported datasets right now are:
|
||||
- `alpaca`
|
||||
- `wizardlm70k`
|
||||
|
||||
Please note that the supported datasets all have different licenses. Be aware that the license of the resulting data mixture might be different that the license of this dataset alone.
|
||||
|
||||
## Adding a new personality
|
||||
In order to add a new personality, you need to define a new system prompt and new set of responses for the assistant. The system prompt is the description of the assistant's behavior that occurs at the start of the context. The responses are what is said back to the user when performing a task. The model should still respond with the correct service call no matter what the assistant's response is. The list of system prompts are stored in `pile_of_system_prompts.csv`, and the list of responses are stored in `pile_of_responses.csv`
|
||||
|
||||
|
||||
Reference in New Issue
Block a user