SandLogicTechnologies
commited on
Commit
•
50728ae
1
Parent(s):
19c04b6
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,146 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language:
|
3 |
+
- en
|
4 |
+
pipeline_tag: text-generation
|
5 |
+
tags:
|
6 |
+
- Pytorch
|
7 |
+
- Llama3
|
8 |
+
- M42
|
9 |
+
- Health
|
10 |
+
- HealthCare
|
11 |
+
---
|
12 |
+
|
13 |
+
# SandLogic Technology - Quantized Llama3-Med42-8B Models
|
14 |
+
|
15 |
+
## Model Description
|
16 |
+
|
17 |
+
We have quantized the Llama3-Med42-8B model into two variants:
|
18 |
+
|
19 |
+
1. Q5_KM
|
20 |
+
2. Q4_KM
|
21 |
+
|
22 |
+
These quantized models offer improved efficiency while maintaining performance.
|
23 |
+
|
24 |
+
## Original Model Information
|
25 |
+
|
26 |
+
- **Name**: [Llama3-Med42-8B](https://huggingface.co/m42-health/Llama3-Med42-8B)
|
27 |
+
- **Developer**: M42 Health AI Team
|
28 |
+
- **Base Model**: [Llama3-8B-Instruct](https://huggingface.co/meta-llama/Meta-Llama-3-8B-Instruct)
|
29 |
+
- **Model Type**: Clinical large language model (LLM)
|
30 |
+
- **Parameters**: 8 billion
|
31 |
+
- **Context Length**: 8k tokens
|
32 |
+
- **Input**: Text only
|
33 |
+
- **Output**: Text only
|
34 |
+
- **License**: Llama 3 Community License Agreement
|
35 |
+
|
36 |
+
## Model Capabilities
|
37 |
+
|
38 |
+
Llama3-Med42-8B is designed for medical and healthcare-related tasks, including:
|
39 |
+
|
40 |
+
- Medical question answering
|
41 |
+
- Patient record summarization
|
42 |
+
- Aiding medical diagnosis
|
43 |
+
- General health Q&A
|
44 |
+
|
45 |
+
## Training Data
|
46 |
+
|
47 |
+
The model was instruction-tuned using a dataset of approximately 1 billion tokens compiled from various open-access and high-quality sources, including:
|
48 |
+
|
49 |
+
- Medical flashcards
|
50 |
+
- Exam questions
|
51 |
+
- Open-domain dialogues
|
52 |
+
|
53 |
+
## Important Limitations and Safe Use
|
54 |
+
|
55 |
+
**DISCLAIMER: This model is not yet ready for clinical use without further testing and validation. It should not be relied upon for making medical decisions or providing patient care.**
|
56 |
+
|
57 |
+
- Potential for generating incorrect or harmful information
|
58 |
+
- Risk of perpetuating biases in training data
|
59 |
+
- Requires extensive human evaluation to ensure safety
|
60 |
+
|
61 |
+
## Use Cases
|
62 |
+
|
63 |
+
While not ready for real clinical use, potential applications include:
|
64 |
+
|
65 |
+
1. **Medical Education**: Assist in studying and understanding medical concepts
|
66 |
+
2. **Research Support**: Aid in literature review and hypothesis generation
|
67 |
+
3. **Health Information**: Provide general health information (with appropriate disclaimers)
|
68 |
+
4. **Clinical Decision Support**: (Future potential) Enhance clinical decision-making processes
|
69 |
+
|
70 |
+
## Model Variants
|
71 |
+
|
72 |
+
We offer two quantized versions of the Llama3-Med42-8B model:
|
73 |
+
|
74 |
+
1. **Q5_KM**: 5-bit quantization using the KM method
|
75 |
+
2. **Q4_KM**: 4-bit quantization using the KM method
|
76 |
+
|
77 |
+
These quantized models aim to reduce model size and improve inference speed while maintaining performance as close to the original model as possible.
|
78 |
+
|
79 |
+
## Usage
|
80 |
+
|
81 |
+
```bash
|
82 |
+
pip install llama-cpp-python
|
83 |
+
```
|
84 |
+
Please refer to the llama-cpp-python [documentation](https://llama-cpp-python.readthedocs.io/en/latest/) to install with GPU support.
|
85 |
+
|
86 |
+
### Basic Text Completion
|
87 |
+
Here's an example demonstrating how to use the high-level API for basic text completion:
|
88 |
+
|
89 |
+
```bash
|
90 |
+
from llama_cpp import Llama
|
91 |
+
|
92 |
+
llm = Llama(
|
93 |
+
model_path="./models/7B/Llama3-Med42-8B.gguf",
|
94 |
+
verbose=False,
|
95 |
+
# n_gpu_layers=-1, # Uncomment to use GPU acceleration
|
96 |
+
# n_ctx=2048, # Uncomment to increase the context window
|
97 |
+
)
|
98 |
+
|
99 |
+
output = llm.create_chat_completion(
|
100 |
+
messages =[
|
101 |
+
{
|
102 |
+
"role": "system",
|
103 |
+
"content": (
|
104 |
+
"You are a helpful, respectful and honest medical assistant. You are a second version of Med42 developed by the AI team at M42, UAE. "
|
105 |
+
"Always answer as helpfully as possible, while being safe. "
|
106 |
+
"Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. "
|
107 |
+
"Please ensure that your responses are socially unbiased and positive in nature. If a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. "
|
108 |
+
"If you don’t know the answer to a question, please don’t share false information."
|
109 |
+
),
|
110 |
+
},
|
111 |
+
{"role": "user", "content": "What are the symptoms of diabetes?"},
|
112 |
+
]
|
113 |
+
)
|
114 |
+
|
115 |
+
print(output["choices"][0]['message']['content'])
|
116 |
+
```
|
117 |
+
|
118 |
+
## Download
|
119 |
+
You can download `Llama` models in `gguf` format directly from Hugging Face using the `from_pretrained` method. This feature requires the `huggingface-hub` package.
|
120 |
+
|
121 |
+
To install it, run: `pip install huggingface-hub`
|
122 |
+
|
123 |
+
```bash
|
124 |
+
from llama_cpp import Llama
|
125 |
+
|
126 |
+
llm = Llama.from_pretrained(
|
127 |
+
repo_id="SandLogicTechnologies/Llama3-Med42-8B-GGUF",
|
128 |
+
filename="*Llama3-Med42-8B-Q5_K_M.gguf",
|
129 |
+
verbose=False
|
130 |
+
)
|
131 |
+
```
|
132 |
+
By default, from_pretrained will download the model to the Hugging Face cache directory. You can manage installed model files using the huggingface-cli tool.
|
133 |
+
|
134 |
+
|
135 |
+
## Ethical Considerations
|
136 |
+
|
137 |
+
Users must be aware of the model's limitations and potential biases. It should not be used for direct medical advice or decision-making without proper validation and human oversight.
|
138 |
+
|
139 |
+
|
140 |
+
## Acknowledgements
|
141 |
+
|
142 |
+
We thank the M42 Health AI Team and the creators of Llama3 for their contributions to the field of medical AI.Special thanks to Georgi Gerganov and the entire llama.cpp development team for their outstanding contributions.
|
143 |
+
|
144 |
+
## Contact
|
145 |
+
|
146 |
+
For any inquiries or support, please contact us at [email protected] or visit our [support page](https://www.sandlogic.com/LingoForge/support).
|