mirror of
https://github.com/acon96/home-llm.git
synced 2026-01-08 05:14:02 -05:00
finalize new model version
This commit is contained in:
46
LICENSES.txt
46
LICENSES.txt
@@ -651,4 +651,48 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
SOFTWARE.
|
||||
---
|
||||
|
||||
STABILITY AI NON-COMMERCIAL RESEARCH COMMUNITY LICENSE AGREEMENT
|
||||
Dated: December 06, 2023
|
||||
|
||||
By using or distributing any portion or element of the Models, Software, Software Products or Derivative Works, you agree to be bound by this Agreement.
|
||||
|
||||
"Agreement" means this Stable Non-Commercial Research Community License Agreement.
|
||||
|
||||
“AUP” means the Stability AI Acceptable Use Policy available at https://stability.ai/use-policy, as may be updated from time to time.
|
||||
|
||||
"Derivative Work(s)” means (a) any derivative work of the Software Products as recognized by U.S. copyright laws and (b) any modifications to a Model, and any other model created which is based on or derived from the Model or the Model’s output. For clarity, Derivative Works do not include the output of any Model.
|
||||
|
||||
“Documentation” means any specifications, manuals, documentation, and other written information provided by Stability AI related to the Software.
|
||||
|
||||
"Licensee" or "you" means you, or your employer or any other person or entity (if you are entering into this Agreement on such person or entity's behalf), of the age required under applicable laws, rules or regulations to provide legal consent and that has legal authority to bind your employer or such other person or entity if you are entering in this Agreement on their behalf.
|
||||
|
||||
“Model(s)" means, collectively, Stability AI’s proprietary models and algorithms, including machine-learning models, trained model weights and other elements of the foregoing, made available under this Agreement.
|
||||
|
||||
“Non-Commercial Uses” means exercising any of the rights granted herein for the purpose of research or non-commercial purposes. Non-Commercial Uses does not include any production use of the Software Products or any Derivative Works.
|
||||
|
||||
"Stability AI" or "we" means Stability AI Ltd. and its affiliates.
|
||||
|
||||
|
||||
"Software" means Stability AI’s proprietary software made available under this Agreement.
|
||||
|
||||
“Software Products” means the Models, Software and Documentation, individually or in any combination.
|
||||
|
||||
|
||||
|
||||
1. License Rights and Redistribution.
|
||||
a. Subject to your compliance with this Agreement, the AUP (which is hereby incorporated herein by reference), and the Documentation, Stability AI grants you a non-exclusive, worldwide, non-transferable, non-sublicensable, revocable, royalty free and limited license under Stability AI’s intellectual property or other rights owned or controlled by Stability AI embodied in the Software Products to use, reproduce, distribute, and create Derivative Works of, the Software Products, in each case for Non-Commercial Uses only.
|
||||
b. You may not use the Software Products or Derivative Works to enable third parties to use the Software Products or Derivative Works as part of your hosted service or via your APIs, whether you are adding substantial additional functionality thereto or not. Merely distributing the Software Products or Derivative Works for download online without offering any related service (ex. by distributing the Models on HuggingFace) is not a violation of this subsection. If you wish to use the Software Products or any Derivative Works for commercial or production use or you wish to make the Software Products or any Derivative Works available to third parties via your hosted service or your APIs, contact Stability AI at https://stability.ai/contact.
|
||||
c. If you distribute or make the Software Products, or any Derivative Works thereof, available to a third party, the Software Products, Derivative Works, or any portion thereof, respectively, will remain subject to this Agreement and you must (i) provide a copy of this Agreement to such third party, and (ii) retain the following attribution notice within a "Notice" text file distributed as a part of such copies: "This Stability AI Model is licensed under the Stability AI Non-Commercial Research Community License, Copyright (c) Stability AI Ltd. All Rights Reserved.” If you create a Derivative Work of a Software Product, you may add your own attribution notices to the Notice file included with the Software Product, provided that you clearly indicate which attributions apply to the Software Product and you must state in the NOTICE file that you changed the Software Product and how it was modified.
|
||||
2. Disclaimer of Warranty. UNLESS REQUIRED BY APPLICABLE LAW, THE SOFTWARE PRODUCTS AND ANY OUTPUT AND RESULTS THEREFROM ARE PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. YOU ARE SOLELY RESPONSIBLE FOR DETERMINING THE APPROPRIATENESS OF USING OR REDISTRIBUTING THE SOFTWARE PRODUCTS, DERIVATIVE WORKS OR ANY OUTPUT OR RESULTS AND ASSUME ANY RISKS ASSOCIATED WITH YOUR USE OF THE SOFTWARE PRODUCTS, DERIVATIVE WORKS AND ANY OUTPUT AND RESULTS.
|
||||
3. Limitation of Liability. IN NO EVENT WILL STABILITY AI OR ITS AFFILIATES BE LIABLE UNDER ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, TORT, NEGLIGENCE, PRODUCTS LIABILITY, OR OTHERWISE, ARISING OUT OF THIS AGREEMENT, FOR ANY LOST PROFITS OR ANY DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL, EXEMPLARY OR PUNITIVE DAMAGES, EVEN IF STABILITY AI OR ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF ANY OF THE FOREGOING.
|
||||
4. Intellectual Property.
|
||||
a. No trademark licenses are granted under this Agreement, and in connection with the Software Products or Derivative Works, neither Stability AI nor Licensee may use any name or mark owned by or associated with the other or any of its affiliates, except as required for reasonable and customary use in describing and redistributing the Software Products or Derivative Works.
|
||||
b. Subject to Stability AI’s ownership of the Software Products and Derivative Works made by or for Stability AI, with respect to any Derivative Works that are made by you, as between you and Stability AI, you are and will be the owner of such Derivative Works
|
||||
c. If you institute litigation or other proceedings against Stability AI (including a cross-claim or counterclaim in a lawsuit) alleging that the Software Products, Derivative Works or associated outputs or results, or any portion of any of the foregoing, constitutes infringement of intellectual property or other rights owned or licensable by you, then any licenses granted to you under this Agreement shall terminate as of the date such litigation or claim is filed or instituted. You will indemnify and hold harmless Stability AI from and against any claim by any third party arising out of or related to your use or distribution of the Software Products or Derivative Works in violation of this Agreement.
|
||||
5. Term and Termination. The term of this Agreement will commence upon your acceptance of this Agreement or access to the Software Products and will continue in full force and effect until terminated in accordance with the terms and conditions herein. Stability AI may terminate this Agreement if you are in breach of any term or condition of this Agreement. Upon termination of this Agreement, you shall delete and cease use of any Software Products or Derivative Works. Sections 2-4 shall survive the termination of this Agreement.
|
||||
|
||||
6. Governing Law. This Agreement will be governed by and construed in accordance with the laws of the United States and the State of California without regard to choice of law
|
||||
principles.
|
||||
|
||||
@@ -5,13 +5,14 @@ This project provides the required "glue" components to control your Home Assist
|
||||
The "Home" models are a fine tuning of the Phi model series 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 synthetic dataset](./data) designed to teach the model function calling based on the device information in the context.
|
||||
|
||||
The latest models can be found on HuggingFace:
|
||||
3B v2 (Based on Phi-2): https://huggingface.co/acon96/Home-3B-v2-GGUF
|
||||
3B v3 (Based on StableLM-Zephyr-3B): https://huggingface.co/acon96/Home-3B-v3-GGUF
|
||||
1B v2 (Based on Phi-1.5): https://huggingface.co/acon96/Home-1B-v2-GGUF
|
||||
|
||||
<details>
|
||||
|
||||
<summary>Old Models</summary>
|
||||
|
||||
3B v2 (Based on Phi-2): https://huggingface.co/acon96/Home-3B-v2-GGUF
|
||||
3B v1 (Based on Phi-2): https://huggingface.co/acon96/Home-3B-v1-GGUF
|
||||
1B v1 (Based on Phi-1.5): https://huggingface.co/acon96/Home-1B-v1-GGUF
|
||||
|
||||
|
||||
@@ -22,10 +22,11 @@ The dataset is generated from the different CSV "piles". The "piles" contain dif
|
||||
|
||||
## Generating the dataset from piles
|
||||
|
||||
`python3 generate_home_assistant_data.py --train --test --large`
|
||||
`python3 generate_home_assistant_data.py --train --test --large --sharegpt`
|
||||
|
||||
Supported dataset splits are `--test`, `--train`, & `--sample`
|
||||
Arguments to set the train dataset size are `--small`, `--medium`, `--large`, & `--xl`.
|
||||
Supported formats are `--raw_corpus` (chatml formatted) & `--sharegpt`
|
||||
|
||||
## Merging with other instruct-datasets for training
|
||||
|
||||
|
||||
@@ -65,9 +65,39 @@
|
||||
- 3200: 0.948134092346616
|
||||
- 3600: 0.963314358001265
|
||||
- 4000: 0.9614168247944339
|
||||
- Final: 0.9538266919671095
|
||||
- Final (~4200): 0.9538266919671095
|
||||
|
||||
# rev4
|
||||
- lora rank: 64, alpha: 128
|
||||
- dataset size: large (with new device types)
|
||||
+ evaluation results:
|
||||
+ evaluation results:
|
||||
- 400: 0.867914979757085
|
||||
- 800: 0.9316801619433198
|
||||
- 1200: 0.9215587044534413
|
||||
- 1600: 0.9686234817813765
|
||||
- 2000: 0.9772267206477733
|
||||
- 2400: 0.9752024291497976
|
||||
- 2800: 0.9802631578947368
|
||||
- 3200: 0.9777327935222672
|
||||
- 3600: 0.9812753036437247
|
||||
- 4000: 0.979251012145749
|
||||
- 4400: 0.978744939271255
|
||||
- 4800: 0.9777327935222672
|
||||
- Final (5234): 0.9782388663967612
|
||||
+ overfit
|
||||
|
||||
# rev5
|
||||
- lora rank: 64, alpha: 128
|
||||
- dataset size: medium (with new device types)
|
||||
+ evaluation results:
|
||||
- 400: 0.8709514170040485
|
||||
- 800: 0.9316801619433198
|
||||
- 1200: 0.9544534412955465
|
||||
- 1600: 0.9559716599190283
|
||||
- 2000: 0.9671052631578947
|
||||
- 2400: 0.9671052631578947
|
||||
- 2800: 0.9701417004048583
|
||||
- 3200: 0.9696356275303644
|
||||
- 3600: 0.9736842105263158
|
||||
- 4000: 0.9706477732793523
|
||||
- Final: 0.9711538461538461
|
||||
|
||||
14
evaluate.py
14
evaluate.py
@@ -9,6 +9,20 @@ from tqdm import tqdm
|
||||
|
||||
CTX_SIZE = 2048
|
||||
|
||||
"""
|
||||
python3 evaluate.py stablehome-3b-rev1/checkpoint-400 --batch-size 4 --lora && \
|
||||
python3 evaluate.py stablehome-3b-rev1/checkpoint-800 --batch-size 4 --lora && \
|
||||
python3 evaluate.py stablehome-3b-rev1/checkpoint-1200 --batch-size 4 --lora && \
|
||||
python3 evaluate.py stablehome-3b-rev1/checkpoint-1600 --batch-size 4 --lora && \
|
||||
python3 evaluate.py stablehome-3b-rev1/checkpoint-2000 --batch-size 4 --lora && \
|
||||
python3 evaluate.py stablehome-3b-rev1/checkpoint-2400 --batch-size 4 --lora && \
|
||||
python3 evaluate.py stablehome-3b-rev1/checkpoint-2800 --batch-size 4 --lora && \
|
||||
python3 evaluate.py stablehome-3b-rev1/checkpoint-3200 --batch-size 4 --lora && \
|
||||
python3 evaluate.py stablehome-3b-rev1/checkpoint-3600 --batch-size 4 --lora && \
|
||||
python3 evaluate.py stablehome-3b-rev1/checkpoint-4000 --batch-size 4 --lora && \
|
||||
python3 evaluate.py stablehome-3b-rev1 --batch-size 4 --lora
|
||||
"""
|
||||
|
||||
def tokenize(tokenizer, prompt):
|
||||
return tokenizer(prompt, return_tensors="pt", padding=True, truncation=True, max_length=CTX_SIZE)
|
||||
|
||||
|
||||
@@ -6,3 +6,4 @@ bitsandbytes
|
||||
webcolors
|
||||
pandas
|
||||
# flash-attn
|
||||
sentencepiece
|
||||
4
train.py
4
train.py
@@ -67,7 +67,7 @@ python3 train.py \
|
||||
|
||||
"""
|
||||
python3 train.py \
|
||||
--run_name stablehome-3b-rev4 \
|
||||
--run_name stablehome-3b-rev5 \
|
||||
--base_model stabilityai/stablelm-zephyr-3b \
|
||||
--bf16 \
|
||||
--train_dataset data/home_assistant_train.jsonl \
|
||||
@@ -207,6 +207,8 @@ if model.get_input_embeddings().num_embeddings < embeddings_len:
|
||||
else:
|
||||
model.tie_weights()
|
||||
|
||||
# model.tie_weights()
|
||||
|
||||
if training_run_args.use_lora:
|
||||
from peft import LoraConfig, TaskType, get_peft_model, prepare_model_for_kbit_training
|
||||
print("Creating LoRA for model...")
|
||||
|
||||
Reference in New Issue
Block a user