HelpMum-Personal commited on
Commit
42f8dac
·
verified ·
1 Parent(s): 4df2dd0

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +27 -46
README.md CHANGED
@@ -11,20 +11,20 @@ language:
11
 
12
  # Model Card for HelpMum Vax-Llama-1
13
 
14
- The HelpMum Vax-Llama-1 is an advanced language model designed to provide accurate and relevant information about vaccinations and immunizations. It is fine-tuned from the Llama3 model and built using the Hugging Face Transformers framework. This model has 8 billion parameters and is optimized for delivering precise responses to queries related to vaccination safety, schedules, and more.
15
 
16
  ## Model Details
17
 
18
  ### Model Description
19
 
20
- The HelpMum Vax-Llama-1 model is a specialized chatbot model developed to enhance the dissemination of vaccination-related information. It has been fine-tuned from the Llama3 base model with 8 billion parameters, using a diverse dataset of vaccination queries and responses. This model aims to provide reliable information to users, helping them make informed decisions about vaccinations.
21
 
22
  - **Developed by:** HelpMum
23
  - **Funded by:** HelpMum
24
  - **Shared by:** HelpMum
25
  - **Model type:** Transformer-based language model
26
  - **Language(s) (NLP):** English
27
- - **Finetuned from model:** Llama3
28
 
29
  ### Model Sources
30
 
@@ -57,30 +57,28 @@ Users should ensure that the model is used in contexts where it can provide valu
57
  Use the following code to get started with the Vax-Llama-1 model:
58
 
59
  ```python
60
- from transformers import AutoModel, AutoTokenizer
61
-
62
- tokenizer = AutoTokenizer.from_pretrained("HelpMumHQ/vax-llama-1")
63
- model = AutoModel.from_pretrained("HelpMumHQ/vax-llama-1")
64
-
65
- messages = [
66
- {
67
- "role": "user",
68
- "content": "Are vaccines safe for pregnant women?"
69
- }
70
- ]
71
-
72
- prompt = tokenizer.apply_chat_template(messages, tokenize=False,
73
- add_generation_prompt=True)
74
-
75
- inputs = tokenizer(prompt, return_tensors='pt', padding=True,
76
- truncation=True).to("cuda")
77
-
78
- outputs = model.generate(**inputs, max_length=150,
79
- num_return_sequences=1)
80
-
81
- text = tokenizer.decode(outputs[0], skip_special_tokens=True)
82
-
83
- print(text.split("assistant")[1])
84
  ```
85
 
86
  ## Training Details
@@ -88,21 +86,6 @@ print(text.split("assistant")[1])
88
  ### Training Data
89
 
90
  The data for this model was collected from HelpMum's extensive database of vaccination-related queries and responses, which includes real-world interactions and expert-verified information.
91
- ### Training Procedure
92
-
93
- The model was fine-tuned on the vaccination dataset using the following hyperparameters:
94
-
95
- - **Fine-Tuning Epochs:** 3
96
- - **Batch Size:** 1 (per device for training and evaluation)
97
- - **Learning Rate:** 2e-4
98
- - **Max Tokens per Response:** 512
99
-
100
-
101
- #### Preprocessing
102
-
103
- The data was cleaned and tokenized to ensure high-quality input for the model training process.
104
-
105
- ## Evaluation
106
 
107
  ### Testing Data, Factors & Metrics
108
 
@@ -120,7 +103,6 @@ The evaluation considered various factors, including the accuracy and relevance
120
  - **Runtime:** 195.8647 seconds
121
  - **Samples per Second:** 0.735
122
 
123
-
124
  ### Results
125
 
126
  The Vax-Llama-1 model performed well in delivering accurate and relevant responses to vaccination queries, with high user satisfaction and efficiency.
@@ -137,11 +119,10 @@ The model underwent rigorous testing and evaluation to ensure it meets the desir
137
 
138
  ### Model Architecture and Objective
139
 
140
- The Vax-Llama-1 is a transformer-based language model built on the Llama3 architecture, designed to generate accurate responses to vaccination-related queries.
141
 
142
  ### Compute Infrastructure
143
 
144
-
145
  #### Software
146
 
147
  - **Framework:** Transformers (Hugging Face)
@@ -178,4 +159,4 @@ HelpMum Tech Team
178
 
179
  ## Model Card Contact
180
 
181
- For questions or feedback, please contact [HelpMum](mailto:[email protected]).
 
11
 
12
  # Model Card for HelpMum Vax-Llama-1
13
 
14
+ The HelpMum Vax-Llama-1 is an advanced language model designed to provide accurate and relevant information about vaccinations and immunizations. It is fine-tuned from the Llama 3.1 8B model and built using the Hugging Face Transformers framework. This model has 8 billion parameters and is optimized for delivering precise responses to queries related to vaccination safety, schedules, and more.
15
 
16
  ## Model Details
17
 
18
  ### Model Description
19
 
20
+ The HelpMum Vax-Llama-1 model is a specialized chatbot model developed to enhance the dissemination of vaccination-related information. It has been fine-tuned from the Llama 3.1 8B base model, using a diverse dataset of vaccination queries and responses. This model aims to provide reliable information to users, helping them make informed decisions about vaccinations.
21
 
22
  - **Developed by:** HelpMum
23
  - **Funded by:** HelpMum
24
  - **Shared by:** HelpMum
25
  - **Model type:** Transformer-based language model
26
  - **Language(s) (NLP):** English
27
+ - **Finetuned from model:** Llama 3.1 8B
28
 
29
  ### Model Sources
30
 
 
57
  Use the following code to get started with the Vax-Llama-1 model:
58
 
59
  ```python
60
+ !pip install -q -U transformers
61
+ !pip install -q -U bitsandbytes
62
+
63
+ from transformers import AutoModelForCausalLM, AutoTokenizer
64
+
65
+ tokenizer = AutoTokenizer.from_pretrained('HelpMumHQ/vax-llama-1')
66
+ model = AutoModelForCausalLM.from_pretrained('HelpMumHQ/vax-llama-1')
67
+
68
+ def generate_response(user_message):
69
+ tokenizer.chat_template = "{%- for message in messages %}{{ bos_token + '[INST] ' + message['content'] + ' [/INST]' if message['role'] == 'user' else ' ' + message['content'] + ' ' + eos_token }}{%- endfor %}"
70
+ messages = [{"role": "user", "content": user_message}]
71
+ prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
72
+ inputs = tokenizer(prompt, return_tensors='pt', truncation=True).to("cuda")
73
+ outputs = model.generate(**inputs, max_length=150, num_return_sequences=1)
74
+ text = tokenizer.decode(outputs[0], skip_special_tokens=True)
75
+ response = (text[text.find('[/INST]') + len('[/INST]'):text.find('[INST]', text.find('[/INST]') + len('[/INST]'))] if text.find('[INST]', text.find('[/INST]') + len('[/INST]')) != -1 else text[text.find('[/INST]') + len('[/INST]'):]).strip().split('[/INST]')[0].strip()
76
+ return response
77
+
78
+ # Sample usage
79
+ user_message = "Are vaccines safe for pregnant women?"
80
+ response = generate_response(user_message)
81
+ print(response)
 
 
82
  ```
83
 
84
  ## Training Details
 
86
  ### Training Data
87
 
88
  The data for this model was collected from HelpMum's extensive database of vaccination-related queries and responses, which includes real-world interactions and expert-verified information.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
 
90
  ### Testing Data, Factors & Metrics
91
 
 
103
  - **Runtime:** 195.8647 seconds
104
  - **Samples per Second:** 0.735
105
 
 
106
  ### Results
107
 
108
  The Vax-Llama-1 model performed well in delivering accurate and relevant responses to vaccination queries, with high user satisfaction and efficiency.
 
119
 
120
  ### Model Architecture and Objective
121
 
122
+ The Vax-Llama-1 is a transformer-based language model built on the Llama 3.1 architecture, designed to generate accurate responses to vaccination-related queries.
123
 
124
  ### Compute Infrastructure
125
 
 
126
  #### Software
127
 
128
  - **Framework:** Transformers (Hugging Face)
 
159
 
160
  ## Model Card Contact
161
 
162
+ For questions or feedback, please contact [HelpMum](mailto:[email protected]).