Question Answering
PEFT
English
medical
Tonic commited on
Commit
bd33414
1 Parent(s): 4268279

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +14 -8
README.md CHANGED
@@ -25,10 +25,10 @@ This is a medical fine tuned model from the [Falcon-7b-Instruction](https://hugg
25
  - **License:** MIT
26
  - **Finetuned from model:**[tiiuae/falcon-7b-instruct](https://huggingface.co/tiiuae/falcon-7b-instruct)
27
  -
28
- ### Model Sources [optional]
29
 
30
  - **Repository:** [Github](https://github.com/Josephrp/AI-challenge-hackathon/blob/master/falcon_7b_instruct_GaiaMiniMed_dataset.ipynb)
31
- - **Demo [optional]:** {{ demo | default("[More Information Needed]", true)}}
32
 
33
  ## Uses
34
 
@@ -81,8 +81,14 @@ tokenizer = AutoTokenizer.from_pretrained(base_model_id, trust_remote_code=True,
81
  tokenizer.pad_token = tokenizer.eos_token
82
  tokenizer.padding_side = 'left'
83
 
84
- # Load the Falcon model with the specified configuration
85
- falcon_model = AutoModelForCausalLM.from_pretrained("tiiuae/falcon-7b-instruct")
 
 
 
 
 
 
86
 
87
  # Class to encapsulate the Falcon chatbot
88
  class FalconChatBot:
@@ -113,7 +119,7 @@ class FalconChatBot:
113
  for message in processed_history:
114
  user_message = message["user"]
115
  assistant_message = message["assistant"]
116
- conversation += f"User: {user_message}\nFalcon:{' ' + assistant_message if assistant_message else ''}\n"
117
 
118
  # Encode the formatted conversation using the tokenizer
119
  input_ids = tokenizer.encode(conversation, return_tensors="pt", add_special_tokens=False)
@@ -130,8 +136,8 @@ class FalconChatBot:
130
  falcon_bot = FalconChatBot()
131
 
132
  # Define the Gradio interface
133
- title = "👋🏻Welcome to Falcon's Medical Expert Chat🚀"
134
- description = "You can use this Space to test out the Falcon model [(tiiuae/falcon-7b-instruct)](https://huggingface.co/tiiuae/falcon-7b-instruct) or duplicate this Space and use it locally or on 🤗HuggingFace. [Join me on Discord to build together](https://discord.gg/VqTxc76K3u)."
135
  examples = [{
136
  "preprompt": "system message",
137
  "history": [{
@@ -149,7 +155,7 @@ iface = gr.Interface(
149
  description=description,
150
  examples=examples,
151
  inputs=[
152
- gr.inputs.Textbox(label="Input Data", type="json),
153
  ],
154
  outputs="text",
155
  theme="ParityError/Anime"
 
25
  - **License:** MIT
26
  - **Finetuned from model:**[tiiuae/falcon-7b-instruct](https://huggingface.co/tiiuae/falcon-7b-instruct)
27
  -
28
+ ### Model Sources
29
 
30
  - **Repository:** [Github](https://github.com/Josephrp/AI-challenge-hackathon/blob/master/falcon_7b_instruct_GaiaMiniMed_dataset.ipynb)
31
+ - **Demo :** [pseudolab/gaiaminimed](https://huggingface.co/spaces/pseudolab/gaiaminimed) & [tonic/gaiaminimed](https://huggingface.com/spaces/tonic/gaiaminimed)
32
 
33
  ## Uses
34
 
 
81
  tokenizer.pad_token = tokenizer.eos_token
82
  tokenizer.padding_side = 'left'
83
 
84
+
85
+ # Load the GaiaMiniMed model with the specified configuration
86
+ # Load the Peft model with a specific configuration
87
+ peft_config = PeftConfig.from_pretrained("Tonic/GaiaMiniMed")
88
+ peft_model = PeftModel.from_pretrained("Tonic/GaiaMiniMed", config=peft_config)
89
+
90
+ # Now you can use peft_model without any NameError
91
+ peft_model = peft_model.to_bettertransformer("tiiuae/falcon-7b-instruct")
92
 
93
  # Class to encapsulate the Falcon chatbot
94
  class FalconChatBot:
 
119
  for message in processed_history:
120
  user_message = message["user"]
121
  assistant_message = message["assistant"]
122
+ conversation += f"Falcon:{' ' + assistant_message if assistant_message else ''} User: {user_message}\n Falcon:\n"
123
 
124
  # Encode the formatted conversation using the tokenizer
125
  input_ids = tokenizer.encode(conversation, return_tensors="pt", add_special_tokens=False)
 
136
  falcon_bot = FalconChatBot()
137
 
138
  # Define the Gradio interface
139
+ title = "👋🏻Welcome to Tonic's 🦅Falcon's Medical👨🏻‍⚕️Expert Chat🚀"
140
+ description = "You can use this Space to test out the GaiaMiniMed model [(Tonic/GaiaMiniMed)](https://huggingface.co/Tonic/GaiaMiniMed) or duplicate this Space and use it locally or on 🤗HuggingFace. [Join me on Discord to build together](https://discord.gg/VqTxc76K3u)."
141
  examples = [{
142
  "preprompt": "system message",
143
  "history": [{
 
155
  description=description,
156
  examples=examples,
157
  inputs=[
158
+ gr.inputs.Textbox(label="Input Data", type="json"),
159
  ],
160
  outputs="text",
161
  theme="ParityError/Anime"