commit 87ed9a14da61513a3498fbe12e52a01c3e122d2e Author: ModelHub XC Date: Wed Aug 26 09:04:16 2026 +0800 初始化项目,由ModelHub XC社区提供模型 Model: deccan-ai/phi-2-insurance_qa-sft-lora-gguf-f16 Source: Original Platform diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..a4cc060 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,36 @@ +*.7z filter=lfs diff=lfs merge=lfs -text +*.arrow filter=lfs diff=lfs merge=lfs -text +*.bin filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.ckpt filter=lfs diff=lfs merge=lfs -text +*.ftz filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.h5 filter=lfs diff=lfs merge=lfs -text +*.joblib filter=lfs diff=lfs merge=lfs -text +*.lfs.* filter=lfs diff=lfs merge=lfs -text +*.mlmodel filter=lfs diff=lfs merge=lfs -text +*.model filter=lfs diff=lfs merge=lfs -text +*.msgpack filter=lfs diff=lfs merge=lfs -text +*.npy filter=lfs diff=lfs merge=lfs -text +*.npz filter=lfs diff=lfs merge=lfs -text +*.onnx filter=lfs diff=lfs merge=lfs -text +*.ot filter=lfs diff=lfs merge=lfs -text +*.parquet filter=lfs diff=lfs merge=lfs -text +*.pb filter=lfs diff=lfs merge=lfs -text +*.pickle filter=lfs diff=lfs merge=lfs -text +*.pkl filter=lfs diff=lfs merge=lfs -text +*.pt filter=lfs diff=lfs merge=lfs -text +*.pth filter=lfs diff=lfs merge=lfs -text +*.rar filter=lfs diff=lfs merge=lfs -text +*.safetensors filter=lfs diff=lfs merge=lfs -text +saved_model/**/* filter=lfs diff=lfs merge=lfs -text +*.tar.* filter=lfs diff=lfs merge=lfs -text +*.tar filter=lfs diff=lfs merge=lfs -text +*.tflite filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.wasm filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text +*tfevents* filter=lfs diff=lfs merge=lfs -text +ggml-model-f16.gguf filter=lfs diff=lfs merge=lfs -text diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..48a5ef3 --- /dev/null +++ b/LICENSE @@ -0,0 +1,22 @@ +Soul AI +Copyright (c) Soul AI Whisperers Inc. + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +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. \ No newline at end of file diff --git a/NOTICE.md b/NOTICE.md new file mode 100644 index 0000000..2e7e2f5 --- /dev/null +++ b/NOTICE.md @@ -0,0 +1,30 @@ +## NOTICES AND INFORMATION Do Not Translate or Localize + + +### I. Microsoft's Open Source License/Copyright Notice: +> This software utlises an MIT licensed software copyrighted by Microsoft Corporation. + +``` +Microsoft. +Copyright (c) Microsoft Corporation. + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +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. +``` diff --git a/README.md b/README.md new file mode 100644 index 0000000..f1c56d8 --- /dev/null +++ b/README.md @@ -0,0 +1,94 @@ +--- +license: mit +license_link: >- + https://huggingface.co/deccan-ai/phi-2-insurance_qa-sft-lora-gguf-f16/resolve/main/LICENSE +language: +- en +pipeline_tag: text-generation +tags: +- nlp +- insurance +- lora +- llm +- phi-2 +- transformers +- qa +- sft +- ggml +- gguf +datasets: +- deccan-ai/insuranceQA-v2 +widget: +- text: |- + ### Instruction: What is the difference between health and life insurance? + #### Response: +- text: |- + ### Instruction: Does Homeowners Insurance Cover Death Of Owner? + #### Response: +--- +## Model Summary +This model builds on the architecture of Microsoft's Phi-2, incorporating the LoRA [[1]](#1) paradigm for supervised fine-tuning on a high quality question answering dataset in the insurance domain. +Thus, `deccan-ai/phi-2-insurance_qa-sft-lora-gguf-f16` serves as a text generation model capable of answering questions around insurance. + +## Dataset +We utilise the InsuranceQA dataset [[2]](#2), which comprises 27.96K QA pairs related to the insurance domain. +The content of this dataset consists of questions from real world users, the answers with high quality were composed by insurance professionals with deep domain knowledge. +Since the dataset isn't available in a readable format on the web, we make it available on huggingface in a `jsonl` format, at deccan-ai/insuranceQA-v2. + + +## Usage +You can use the llama.cpp library to infer from this model. Download the model weights and setup the llama.cpp library. + +### Input Format +``` +### Instruction: +### Response: +``` + +For instance: +``` +### Instruction: What does Basic Homeowners Insurance Cover? +### Response: +``` + +### Inference Code + +```bash +./main -m ggml-model-f16.gguf -p "### Instruction: What does Basic Homeowners Insurance Cover?\n### Response: " --temp 0.1 --top_p 0.95 +``` + +## Training + +### Model +* Architecture: Phi-2, with LoRA modifications for efficient Insurance domain-specific fine-tuning. +* Context length: 2048 tokens +* Modifications: Added `<|eostoken|>` for end-of-response learning - to help the model learn the end of responses, facilitating its use in dialogue systems. + +### Configuration +* Hyperparameters: + * learning_rate=2e-5, + * batch_size=8, + * epochs=10, + * lora_r=32, + * lora_alpha=64. +* Infrastructure: Trained on an NVIDIA A40 and utilized the `FullyShardedDataParallelPlugin` for CPU offloading. + +## Evaluation +Coming Soon! + +## Limitations of `deccan-ai/phi-2-insurance_qa-sft-lora` +* Generate Inaccurate Facts: The model may produce incorrect code snippets and statements. Users should treat these outputs as suggestions or starting points, not as definitive or accurate solutions. +* Unreliable Responses to Instruction: It may struggle or fail to adhere to intricate or nuanced instructions provided by users. +* Language Limitations: The model is primarily designed to understand standard English. Informal English, slang, or any other languages might pose challenges to its comprehension, leading to potential misinterpretations or errors in response. +* Potential Societal Biases: Phi-2 is not entirely free from societal biases despite efforts in assuring training data safety. There's a possibility it may generate content that mirrors these societal biases, particularly if prompted or instructed to do so. We urge users to be aware of this and to exercise caution and critical thinking when interpreting model outputs. +* Toxicity: Despite being trained with carefully selected data, the model can still produce harmful content if explicitly prompted or instructed to do so. We chose to release the model to help the open-source community develop the most effective ways to reduce the toxicity of a model directly after pretraining. +* Verbosity: Phi-2 being a base model often produces irrelevant or extra text and responses following its first answer to user prompts within a single turn. This is due to its training dataset being primarily textbooks, which results in textbook-like responses. + + +## License +The model is licensed under the [MIT license](https://huggingface.co/deccan-ai/phi-2-insurance_qa-sft-lora-gguf-f16/blob/main/LICENSE). + + +## Citations +[1] Hu, Edward J., et al. "Lora: Low-rank adaptation of large language models." arXiv preprint arXiv:2106.09685 (2021).
+[2] Feng, Minwei, et al. "Applying deep learning to answer selection: A study and an open task." 2015 IEEE workshop on automatic speech recognition and understanding (ASRU). IEEE, 2015. \ No newline at end of file diff --git a/config.json b/config.json new file mode 100644 index 0000000..85f3d4c --- /dev/null +++ b/config.json @@ -0,0 +1,34 @@ +{ + "_name_or_path": "soulhq-ai/phi-2-insurance_qa-sft-lora", + "architectures": [ + "PhiForCausalLM" + ], + "attention_dropout": 0.0, + "auto_map": { + "AutoConfig": "microsoft/phi-2--configuration_phi.PhiConfig", + "AutoModelForCausalLM": "microsoft/phi-2--modeling_phi.PhiForCausalLM" + }, + "bos_token_id": 50256, + "embd_pdrop": 0.0, + "eos_token_id": 50256, + "hidden_act": "gelu_new", + "hidden_size": 2560, + "initializer_range": 0.02, + "intermediate_size": 10240, + "layer_norm_eps": 1e-05, + "max_position_embeddings": 2048, + "model_type": "phi", + "num_attention_heads": 32, + "num_hidden_layers": 32, + "num_key_value_heads": 32, + "partial_rotary_factor": 0.4, + "qk_layernorm": false, + "resid_pdrop": 0.1, + "rope_scaling": null, + "rope_theta": 10000.0, + "tie_word_embeddings": false, + "torch_dtype": "bfloat16", + "transformers_version": "4.38.2", + "use_cache": true, + "vocab_size": 51200 +} diff --git a/ggml-model-f16.gguf b/ggml-model-f16.gguf new file mode 100644 index 0000000..8162d7e --- /dev/null +++ b/ggml-model-f16.gguf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:778e08150097e47ed05aab2fcf73f867a2babe1c403f063fc35d9bf4af9f7594 +size 5563095552