初始化项目,由ModelHub XC社区提供模型
Model: sethuiyer/Medichat-Llama3-8B Source: Original Platform
This commit is contained in:
35
.gitattributes
vendored
Normal file
35
.gitattributes
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
*.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
|
||||
235
README.md
Normal file
235
README.md
Normal file
@@ -0,0 +1,235 @@
|
||||
---
|
||||
base_model:
|
||||
- Undi95/Llama-3-Unholy-8B
|
||||
- Locutusque/llama-3-neural-chat-v1-8b
|
||||
- ruslanmv/Medical-Llama3-8B-16bit
|
||||
library_name: transformers
|
||||
tags:
|
||||
- mergekit
|
||||
- merge
|
||||
- medical
|
||||
license: other
|
||||
datasets:
|
||||
- mlabonne/orpo-dpo-mix-40k
|
||||
- Open-Orca/SlimOrca-Dedup
|
||||
- jondurbin/airoboros-3.2
|
||||
- microsoft/orca-math-word-problems-200k
|
||||
- m-a-p/Code-Feedback
|
||||
- MaziyarPanahi/WizardLM_evol_instruct_V2_196k
|
||||
- ruslanmv/ai-medical-chatbot
|
||||
model-index:
|
||||
- name: Medichat-Llama3-8B
|
||||
results:
|
||||
- task:
|
||||
type: text-generation
|
||||
name: Text Generation
|
||||
dataset:
|
||||
name: AI2 Reasoning Challenge (25-Shot)
|
||||
type: ai2_arc
|
||||
config: ARC-Challenge
|
||||
split: test
|
||||
args:
|
||||
num_few_shot: 25
|
||||
metrics:
|
||||
- type: acc_norm
|
||||
value: 59.13
|
||||
name: normalized accuracy
|
||||
source:
|
||||
url: >-
|
||||
https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=sethuiyer/Medichat-Llama3-8B
|
||||
name: Open LLM Leaderboard
|
||||
- task:
|
||||
type: text-generation
|
||||
name: Text Generation
|
||||
dataset:
|
||||
name: HellaSwag (10-Shot)
|
||||
type: hellaswag
|
||||
split: validation
|
||||
args:
|
||||
num_few_shot: 10
|
||||
metrics:
|
||||
- type: acc_norm
|
||||
value: 82.9
|
||||
name: normalized accuracy
|
||||
source:
|
||||
url: >-
|
||||
https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=sethuiyer/Medichat-Llama3-8B
|
||||
name: Open LLM Leaderboard
|
||||
- task:
|
||||
type: text-generation
|
||||
name: Text Generation
|
||||
dataset:
|
||||
name: MMLU (5-Shot)
|
||||
type: cais/mmlu
|
||||
config: all
|
||||
split: test
|
||||
args:
|
||||
num_few_shot: 5
|
||||
metrics:
|
||||
- type: acc
|
||||
value: 60.35
|
||||
name: accuracy
|
||||
source:
|
||||
url: >-
|
||||
https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=sethuiyer/Medichat-Llama3-8B
|
||||
name: Open LLM Leaderboard
|
||||
- task:
|
||||
type: text-generation
|
||||
name: Text Generation
|
||||
dataset:
|
||||
name: TruthfulQA (0-shot)
|
||||
type: truthful_qa
|
||||
config: multiple_choice
|
||||
split: validation
|
||||
args:
|
||||
num_few_shot: 0
|
||||
metrics:
|
||||
- type: mc2
|
||||
value: 49.65
|
||||
source:
|
||||
url: >-
|
||||
https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=sethuiyer/Medichat-Llama3-8B
|
||||
name: Open LLM Leaderboard
|
||||
- task:
|
||||
type: text-generation
|
||||
name: Text Generation
|
||||
dataset:
|
||||
name: Winogrande (5-shot)
|
||||
type: winogrande
|
||||
config: winogrande_xl
|
||||
split: validation
|
||||
args:
|
||||
num_few_shot: 5
|
||||
metrics:
|
||||
- type: acc
|
||||
value: 78.93
|
||||
name: accuracy
|
||||
source:
|
||||
url: >-
|
||||
https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=sethuiyer/Medichat-Llama3-8B
|
||||
name: Open LLM Leaderboard
|
||||
- task:
|
||||
type: text-generation
|
||||
name: Text Generation
|
||||
dataset:
|
||||
name: GSM8k (5-shot)
|
||||
type: gsm8k
|
||||
config: main
|
||||
split: test
|
||||
args:
|
||||
num_few_shot: 5
|
||||
metrics:
|
||||
- type: acc
|
||||
value: 60.35
|
||||
name: accuracy
|
||||
source:
|
||||
url: >-
|
||||
https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=sethuiyer/Medichat-Llama3-8B
|
||||
name: Open LLM Leaderboard
|
||||
language:
|
||||
- en
|
||||
---
|
||||
|
||||
### Medichat-Llama3-8B
|
||||
|
||||
Built upon the powerful LLaMa-3 architecture and fine-tuned on an extensive dataset of health information, this model leverages its vast medical knowledge to offer clear, comprehensive answers.
|
||||
|
||||
This model is generally better for accurate and informative responses, particularly for users seeking in-depth medical advice.
|
||||
|
||||
|
||||
The following YAML configuration was used to produce this model:
|
||||
|
||||
```yaml
|
||||
|
||||
models:
|
||||
- model: Undi95/Llama-3-Unholy-8B
|
||||
parameters:
|
||||
weight: [0.25, 0.35, 0.45, 0.35, 0.25]
|
||||
density: [0.1, 0.25, 0.5, 0.25, 0.1]
|
||||
- model: Locutusque/llama-3-neural-chat-v1-8b
|
||||
- model: ruslanmv/Medical-Llama3-8B-16bit
|
||||
parameters:
|
||||
weight: [0.55, 0.45, 0.35, 0.45, 0.55]
|
||||
density: [0.1, 0.25, 0.5, 0.25, 0.1]
|
||||
merge_method: dare_ties
|
||||
base_model: Locutusque/llama-3-neural-chat-v1-8b
|
||||
parameters:
|
||||
int8_mask: true
|
||||
dtype: bfloat16
|
||||
|
||||
```
|
||||
|
||||
# Comparision Against Dr.Samantha 7B
|
||||
|
||||
| Subject | Medichat-Llama3-8B Accuracy (%) | Dr. Samantha Accuracy (%) |
|
||||
|-------------------------|---------------------------------|---------------------------|
|
||||
| Clinical Knowledge | 71.70 | 52.83 |
|
||||
| Medical Genetics | 78.00 | 49.00 |
|
||||
| Human Aging | 70.40 | 58.29 |
|
||||
| Human Sexuality | 73.28 | 55.73 |
|
||||
| College Medicine | 62.43 | 38.73 |
|
||||
| Anatomy | 64.44 | 41.48 |
|
||||
| College Biology | 72.22 | 52.08 |
|
||||
| High School Biology | 77.10 | 53.23 |
|
||||
| Professional Medicine | 63.97 | 38.73 |
|
||||
| Nutrition | 73.86 | 50.33 |
|
||||
| Professional Psychology | 68.95 | 46.57 |
|
||||
| Virology | 54.22 | 41.57 |
|
||||
| High School Psychology | 83.67 | 66.60 |
|
||||
| **Average** | **70.33** | **48.85** |
|
||||
|
||||
|
||||
The current model demonstrates a substantial improvement over the previous [Dr. Samantha](sethuiyer/Dr_Samantha-7b) model in terms of subject-specific knowledge and accuracy.
|
||||
|
||||
### Usage:
|
||||
```python
|
||||
import torch
|
||||
from transformers import AutoTokenizer, AutoModelForCausalLM
|
||||
|
||||
class MedicalAssistant:
|
||||
def __init__(self, model_name="sethuiyer/Medichat-Llama3-8B", device="cuda"):
|
||||
self.device = device
|
||||
self.tokenizer = AutoTokenizer.from_pretrained(model_name)
|
||||
self.model = AutoModelForCausalLM.from_pretrained(model_name).to(self.device)
|
||||
self.sys_message = '''
|
||||
You are an AI Medical Assistant trained on a vast dataset of health information. Please be thorough and
|
||||
provide an informative answer. If you don't know the answer to a specific medical inquiry, advise seeking professional help.
|
||||
'''
|
||||
|
||||
def format_prompt(self, question):
|
||||
messages = [
|
||||
{"role": "system", "content": self.sys_message},
|
||||
{"role": "user", "content": question}
|
||||
]
|
||||
prompt = self.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
||||
return prompt
|
||||
|
||||
def generate_response(self, question, max_new_tokens=512):
|
||||
prompt = self.format_prompt(question)
|
||||
inputs = self.tokenizer(prompt, return_tensors="pt").to(self.device)
|
||||
with torch.no_grad():
|
||||
outputs = self.model.generate(**inputs, max_new_tokens=max_new_tokens, use_cache=True)
|
||||
answer = self.tokenizer.batch_decode(outputs, skip_special_tokens=True)[0].strip()
|
||||
return answer
|
||||
|
||||
if __name__ == "__main__":
|
||||
assistant = MedicalAssistant()
|
||||
question = '''
|
||||
Symptoms:
|
||||
Dizziness, headache, and nausea.
|
||||
|
||||
What is the differential diagnosis?
|
||||
'''
|
||||
response = assistant.generate_response(question)
|
||||
print(response)
|
||||
|
||||
```
|
||||
|
||||
## Quants
|
||||
Thanks to [Quant Factory](https://huggingface.co/QuantFactory), the quantized version of this model is available at [QuantFactory/Medichat-Llama3-8B-GGUF](https://huggingface.co/QuantFactory/Medichat-Llama3-8B-GGUF),
|
||||
|
||||
|
||||
## Ollama
|
||||
This model is now also available on Ollama. You can use it by running the command ```ollama run monotykamary/medichat-llama3``` in your
|
||||
terminal. If you have limited computing resources, check out this [video](https://www.youtube.com/watch?v=Qa1h7ygwQq8) to learn how to run it on
|
||||
a Google Colab backend.
|
||||
28
config.json
Normal file
28
config.json
Normal file
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"_name_or_path": "Locutusque/llama-3-neural-chat-v1-8b",
|
||||
"architectures": [
|
||||
"LlamaForCausalLM"
|
||||
],
|
||||
"attention_bias": false,
|
||||
"attention_dropout": 0.0,
|
||||
"bos_token_id": 128000,
|
||||
"eos_token_id": 128001,
|
||||
"hidden_act": "silu",
|
||||
"hidden_size": 4096,
|
||||
"initializer_range": 0.02,
|
||||
"intermediate_size": 14336,
|
||||
"max_position_embeddings": 8192,
|
||||
"model_type": "llama",
|
||||
"num_attention_heads": 32,
|
||||
"num_hidden_layers": 32,
|
||||
"num_key_value_heads": 8,
|
||||
"pretraining_tp": 1,
|
||||
"rms_norm_eps": 1e-05,
|
||||
"rope_scaling": null,
|
||||
"rope_theta": 500000.0,
|
||||
"tie_word_embeddings": false,
|
||||
"torch_dtype": "bfloat16",
|
||||
"transformers_version": "4.40.0",
|
||||
"use_cache": true,
|
||||
"vocab_size": 128256
|
||||
}
|
||||
BIN
medichat_llam3.webp
Normal file
BIN
medichat_llam3.webp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 259 KiB |
16
mergekit_config.yml
Normal file
16
mergekit_config.yml
Normal file
@@ -0,0 +1,16 @@
|
||||
|
||||
models:
|
||||
- model: Undi95/Llama-3-Unholy-8B
|
||||
parameters:
|
||||
weight: [0.25, 0.35, 0.45, 0.35, 0.25]
|
||||
density: [0.1, 0.25, 0.5, 0.25, 0.1]
|
||||
- model: Locutusque/llama-3-neural-chat-v1-8b
|
||||
- model: ruslanmv/Medical-Llama3-8B-16bit
|
||||
parameters:
|
||||
weight: [0.55, 0.45, 0.35, 0.45, 0.55]
|
||||
density: [0.1, 0.25, 0.5, 0.25, 0.1]
|
||||
merge_method: dare_ties
|
||||
base_model: Locutusque/llama-3-neural-chat-v1-8b
|
||||
parameters:
|
||||
int8_mask: true
|
||||
dtype: bfloat16
|
||||
3
model-00001-of-00009.safetensors
Normal file
3
model-00001-of-00009.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:eab9512c5226850c1905a70cb2b12492ee8d5d2348a99407e77a896bac176c55
|
||||
size 1973455376
|
||||
3
model-00002-of-00009.safetensors
Normal file
3
model-00002-of-00009.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:79f95a818381175d9997fdc17d24c7073fa60de366b4e502e1bf086cf757bee4
|
||||
size 1895895336
|
||||
3
model-00003-of-00009.safetensors
Normal file
3
model-00003-of-00009.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:4b2dd862fc36e8d7819d849fe83f99d4b43adcb4797babd58f7e9ef1f9e8aa7d
|
||||
size 1979798040
|
||||
3
model-00004-of-00009.safetensors
Normal file
3
model-00004-of-00009.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:becba07adeaa93e687d248563b073a7a4e3c209c011005193fce80ce176ec3be
|
||||
size 1946227368
|
||||
3
model-00005-of-00009.safetensors
Normal file
3
model-00005-of-00009.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:204eecb20cecec984f8296647ef448f292f791c0e6385936c1c0ea1658da4600
|
||||
size 1979798064
|
||||
3
model-00006-of-00009.safetensors
Normal file
3
model-00006-of-00009.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:efad6634ca90b7826d0cd9e5c29330346e095c5248e58e419f5efed711e11194
|
||||
size 1946227368
|
||||
3
model-00007-of-00009.safetensors
Normal file
3
model-00007-of-00009.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:323629c214632eb63f264bdb86ae3b400fb7b16e9ebcf989c0d64bbaca10bb29
|
||||
size 1979806352
|
||||
3
model-00008-of-00009.safetensors
Normal file
3
model-00008-of-00009.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:7f0dc970cb5402b513f8975ffda0df561f6eeefc672284e351068dbf5e824e96
|
||||
size 1308675136
|
||||
3
model-00009-of-00009.safetensors
Normal file
3
model-00009-of-00009.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:e1772d401c0f7f378924cf5cdd60a73bbee0dbd2f463d52bb89509ddf00d5460
|
||||
size 1050673280
|
||||
1
model.safetensors.index.json
Normal file
1
model.safetensors.index.json
Normal file
File diff suppressed because one or more lines are too long
23
special_tokens_map.json
Normal file
23
special_tokens_map.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"bos_token": {
|
||||
"content": "<|begin_of_text|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false
|
||||
},
|
||||
"eos_token": {
|
||||
"content": "<|end_of_text|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false
|
||||
},
|
||||
"pad_token": {
|
||||
"content": "<|end_of_text|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false
|
||||
}
|
||||
}
|
||||
410518
tokenizer.json
Normal file
410518
tokenizer.json
Normal file
File diff suppressed because it is too large
Load Diff
2070
tokenizer_config.json
Normal file
2070
tokenizer_config.json
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user