kiranr commited on
Commit
482ac71
1 Parent(s): def23fe

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +66 -1
README.md CHANGED
@@ -4,4 +4,69 @@ language:
4
  - en
5
  tags:
6
  - medical
7
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  - en
5
  tags:
6
  - medical
7
+ ---
8
+ # Palmyra-med-20b
9
+
10
+ ## Model description
11
+ **Palmyra-med-20b** is a 20 billion parameter Large Language Model that has been uptrained on
12
+ Palmyra-Large with a specialized custom curated medical dataset.
13
+ The main objective of this model is to enhance performance in tasks related to medical dialogue
14
+ and question-answering.
15
+
16
+ ## Usage
17
+ The model is compatible with the huggingface `AutoModelForCausalLM` and can be easily run on a single 40GB A100.
18
+
19
+ ```py
20
+ import torch
21
+ from transformers import AutoTokenizer, AutoModelForCausalLM
22
+
23
+ model_name = "Writer/palmyra-med-20b"
24
+
25
+ tokenizer = AutoTokenizer.from_pretrained(model_name, use_fast=False)
26
+
27
+ model = AutoModelForCausalLM.from_pretrained(
28
+ model_name,
29
+ device_map="auto"
30
+ torch_dtype=torch.float16,
31
+ )
32
+
33
+ prompt = "Can you explain in simple terms how vaccines help our body fight diseases?"
34
+
35
+ input_text = (
36
+ "A chat between a curious user and an artificial intelligence assistant. "
37
+ "The assistant gives helpful, detailed, and polite answers to the user's questions. "
38
+ "USER: {prompt} "
39
+ "ASSISTANT:"
40
+ )
41
+
42
+ model_inputs = tokenizer(input_text.format(prompt=prompt), return_tensors="pt").to(
43
+ "cuda"
44
+ )
45
+
46
+ gen_conf = {
47
+ "temperature": 0.7,
48
+ "repetition_penalty": 1.0,
49
+ "max_new_tokens": 100,
50
+ "do_sample": True,
51
+ }
52
+
53
+ out_tokens = model.generate(**model_inputs, **gen_conf)
54
+
55
+ response_ids = out_tokens[0][len(model_inputs.input_ids[0]) :]
56
+ output = tokenizer.decode(response_ids, skip_special_tokens=True)
57
+
58
+ print(output)
59
+ ## output ##
60
+ # Vaccines stimulate the production of antibodies by the body's immune system.
61
+ # Antibodies are proteins produced by B lymphocytes in response to foreign substances,such as viruses and bacteria.
62
+ # The antibodies produced by the immune system can bind to and neutralize the pathogens, preventing them from invading and damaging the host cells.
63
+ # Vaccines work by introducing antigens, which are components of the pathogen, into the body.
64
+ # The immune system then produces antibodies against the antigens, which can recognize and neutralize the pathogen if it enters the body in the future.
65
+ # The use of vaccines has led to a significant reduction in the incidence and severity of many diseases, including measles, mumps, rubella, and polio.
66
+ ```
67
+
68
+ ## Limitation
69
+ The model may not operate efficiently beyond the confines of the healthcare field.
70
+ Since it has not been subjected to practical scenarios, its real-time efficacy and precision remain undetermined.
71
+ Under no circumstances should it replace the advice of a medical professional, and it must be regarded solely as a tool for research purposes.
72
+