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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"cells": [
|
3 |
+
{
|
4 |
+
"cell_type": "code",
|
5 |
+
"execution_count": null,
|
6 |
+
"metadata": {
|
7 |
+
"colab": {
|
8 |
+
"base_uri": "https://localhost:8080/"
|
9 |
+
},
|
10 |
+
"id": "QyqHXpfzNTi5",
|
11 |
+
"outputId": "9612f9b9-1b51-4469-e50c-d0a0ffdc8e9c"
|
12 |
+
},
|
13 |
+
"outputs": [
|
14 |
+
{
|
15 |
+
"name": "stdout",
|
16 |
+
"output_type": "stream",
|
17 |
+
"text": [
|
18 |
+
" Installing build dependencies ... \u001b[?25l\u001b[?25hdone\n",
|
19 |
+
" Getting requirements to build wheel ... \u001b[?25l\u001b[?25hdone\n",
|
20 |
+
" Preparing metadata (pyproject.toml) ... \u001b[?25l\u001b[?25hdone\n"
|
21 |
+
]
|
22 |
+
}
|
23 |
+
],
|
24 |
+
"source": [
|
25 |
+
"!pip install gradio==3.41.0 transformers==4.32.0 langchain==0.0.273 -Uqqq\n",
|
26 |
+
"!pip install accelerate==0.12.0 bitsandbytes==0.41.1 einops==0.7.0 peft==0.5.0 -Uqqq"
|
27 |
+
]
|
28 |
+
},
|
29 |
+
{
|
30 |
+
"cell_type": "code",
|
31 |
+
"execution_count": null,
|
32 |
+
"metadata": {
|
33 |
+
"id": "7uflzy2_OAjL"
|
34 |
+
},
|
35 |
+
"outputs": [],
|
36 |
+
"source": [
|
37 |
+
"import gradio as gr\n",
|
38 |
+
"import torch\n",
|
39 |
+
"import re, os, warnings\n",
|
40 |
+
"from langchain import PromptTemplate, LLMChain\n",
|
41 |
+
"from langchain.llms.base import LLM\n",
|
42 |
+
"from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig, GenerationConfig\n",
|
43 |
+
"from peft import LoraConfig, get_peft_model, PeftConfig, PeftModel\n",
|
44 |
+
"warnings.filterwarnings(\"ignore\")"
|
45 |
+
]
|
46 |
+
},
|
47 |
+
{
|
48 |
+
"cell_type": "code",
|
49 |
+
"execution_count": null,
|
50 |
+
"metadata": {
|
51 |
+
"id": "OYx4Jyh2OV17"
|
52 |
+
},
|
53 |
+
"outputs": [],
|
54 |
+
"source": [
|
55 |
+
"# initialize and load PEFT model and tokenizer\n",
|
56 |
+
"def init_model_and_tokenizer(PEFT_MODEL):\n",
|
57 |
+
" config = PeftConfig.from_pretrained(PEFT_MODEL)\n",
|
58 |
+
" bnb_config = BitsAndBytesConfig(\n",
|
59 |
+
" load_in_4bit=True,\n",
|
60 |
+
" bnb_4bit_quant_type=\"nf4\",\n",
|
61 |
+
" bnb_4bit_use_double_quant=True,\n",
|
62 |
+
" bnb_4bit_compute_dtype=torch.float16,\n",
|
63 |
+
" )\n",
|
64 |
+
"\n",
|
65 |
+
" peft_base_model = AutoModelForCausalLM.from_pretrained(\n",
|
66 |
+
" config.base_model_name_or_path,\n",
|
67 |
+
" return_dict=True,\n",
|
68 |
+
" quantization_config=bnb_config,\n",
|
69 |
+
" device_map=\"auto\",\n",
|
70 |
+
" trust_remote_code=True,\n",
|
71 |
+
" )\n",
|
72 |
+
"\n",
|
73 |
+
" peft_model = PeftModel.from_pretrained(peft_base_model, PEFT_MODEL)\n",
|
74 |
+
"\n",
|
75 |
+
" peft_tokenizer = AutoTokenizer.from_pretrained(config.base_model_name_or_path)\n",
|
76 |
+
" peft_tokenizer.pad_token = peft_tokenizer.eos_token\n",
|
77 |
+
"\n",
|
78 |
+
" return peft_model, peft_tokenizer"
|
79 |
+
]
|
80 |
+
},
|
81 |
+
{
|
82 |
+
"cell_type": "code",
|
83 |
+
"execution_count": null,
|
84 |
+
"metadata": {
|
85 |
+
"id": "Azg2zEW2OkP7"
|
86 |
+
},
|
87 |
+
"outputs": [],
|
88 |
+
"source": [
|
89 |
+
"# custom LLM chain to generate answer from PEFT model for each query\n",
|
90 |
+
"def init_llm_chain(peft_model, peft_tokenizer):\n",
|
91 |
+
" class CustomLLM(LLM):\n",
|
92 |
+
" def _call(self, prompt: str, stop=None, run_manager=None) -> str:\n",
|
93 |
+
" device = \"cuda:0\"\n",
|
94 |
+
" peft_encoding = peft_tokenizer(prompt, return_tensors=\"pt\").to(device)\n",
|
95 |
+
" peft_outputs = peft_model.generate(input_ids=peft_encoding.input_ids, generation_config=GenerationConfig(max_new_tokens=256, pad_token_id = peft_tokenizer.eos_token_id, \\\n",
|
96 |
+
" eos_token_id = peft_tokenizer.eos_token_id, attention_mask = peft_encoding.attention_mask, \\\n",
|
97 |
+
" temperature=0.4, top_p=0.6, repetition_penalty=1.3, num_return_sequences=1,))\n",
|
98 |
+
" peft_text_output = peft_tokenizer.decode(peft_outputs[0], skip_special_tokens=True)\n",
|
99 |
+
" return peft_text_output\n",
|
100 |
+
"\n",
|
101 |
+
" @property\n",
|
102 |
+
" def _llm_type(self) -> str:\n",
|
103 |
+
" return \"custom\"\n",
|
104 |
+
"\n",
|
105 |
+
" llm = CustomLLM()\n",
|
106 |
+
"\n",
|
107 |
+
" template = \"\"\"Answer the following question truthfully.\n",
|
108 |
+
" If you don't know the answer, respond 'Sorry, I don't know the answer to this question.'.\n",
|
109 |
+
" If the question is too complex, respond 'Kindly, consult a psychiatrist for further queries.'.\n",
|
110 |
+
"\n",
|
111 |
+
" Example Format:\n",
|
112 |
+
" <HUMAN>: question here\n",
|
113 |
+
" <ASSISTANT>: answer here\n",
|
114 |
+
"\n",
|
115 |
+
" Begin!\n",
|
116 |
+
"\n",
|
117 |
+
" <HUMAN>: {query}\n",
|
118 |
+
" <ASSISTANT>:\"\"\"\n",
|
119 |
+
"\n",
|
120 |
+
" prompt = PromptTemplate(template=template, input_variables=[\"query\"])\n",
|
121 |
+
" llm_chain = LLMChain(prompt=prompt, llm=llm)\n",
|
122 |
+
"\n",
|
123 |
+
" return llm_chain"
|
124 |
+
]
|
125 |
+
},
|
126 |
+
{
|
127 |
+
"cell_type": "code",
|
128 |
+
"execution_count": null,
|
129 |
+
"metadata": {
|
130 |
+
"id": "10h_KVGilk2J"
|
131 |
+
},
|
132 |
+
"outputs": [],
|
133 |
+
"source": [
|
134 |
+
"def user(user_message, history):\n",
|
135 |
+
" return \"\", history + [[user_message, None]]"
|
136 |
+
]
|
137 |
+
},
|
138 |
+
{
|
139 |
+
"cell_type": "code",
|
140 |
+
"execution_count": null,
|
141 |
+
"metadata": {
|
142 |
+
"id": "QeFE1qZnluMm"
|
143 |
+
},
|
144 |
+
"outputs": [],
|
145 |
+
"source": [
|
146 |
+
"def bot(history):\n",
|
147 |
+
" if len(history) >= 2:\n",
|
148 |
+
" query = history[-2][0] + \"\\n\" + history[-2][1] + \"\\nHere, is the next QUESTION: \" + history[-1][0]\n",
|
149 |
+
" else:\n",
|
150 |
+
" query = history[-1][0]\n",
|
151 |
+
"\n",
|
152 |
+
" bot_message = llm_chain.run(query)\n",
|
153 |
+
" bot_message = post_process_chat(bot_message)\n",
|
154 |
+
"\n",
|
155 |
+
" history[-1][1] = \"\"\n",
|
156 |
+
" history[-1][1] += bot_message\n",
|
157 |
+
" return history"
|
158 |
+
]
|
159 |
+
},
|
160 |
+
{
|
161 |
+
"cell_type": "code",
|
162 |
+
"execution_count": null,
|
163 |
+
"metadata": {
|
164 |
+
"id": "aae3uAD5lyXN"
|
165 |
+
},
|
166 |
+
"outputs": [],
|
167 |
+
"source": [
|
168 |
+
"def post_process_chat(bot_message):\n",
|
169 |
+
" try:\n",
|
170 |
+
" bot_message = re.findall(r\"<ASSISTANT>:.*?Begin!\", bot_message, re.DOTALL)[1]\n",
|
171 |
+
" except IndexError:\n",
|
172 |
+
" pass\n",
|
173 |
+
"\n",
|
174 |
+
" bot_message = re.split(r'<ASSISTANT>\\:?\\s?', bot_message)[-1].split(\"Begin!\")[0]\n",
|
175 |
+
"\n",
|
176 |
+
" bot_message = re.sub(r\"^(.*?\\.)(?=\\n|$)\", r\"\\1\", bot_message, flags=re.DOTALL)\n",
|
177 |
+
" try:\n",
|
178 |
+
" bot_message = re.search(r\"(.*\\.)\", bot_message, re.DOTALL).group(1)\n",
|
179 |
+
" except AttributeError:\n",
|
180 |
+
" pass\n",
|
181 |
+
"\n",
|
182 |
+
" bot_message = re.sub(r\"\\n\\d.$\", \"\", bot_message)\n",
|
183 |
+
" bot_message = re.split(r\"(Goodbye|Take care|Best Wishes)\", bot_message, flags=re.IGNORECASE)[0].strip()\n",
|
184 |
+
" bot_message = bot_message.replace(\"\\n\\n\", \"\\n\")\n",
|
185 |
+
"\n",
|
186 |
+
" return bot_message"
|
187 |
+
]
|
188 |
+
},
|
189 |
+
{
|
190 |
+
"cell_type": "code",
|
191 |
+
"execution_count": null,
|
192 |
+
"metadata": {
|
193 |
+
"colab": {
|
194 |
+
"base_uri": "https://localhost:8080/",
|
195 |
+
"height": 49,
|
196 |
+
"referenced_widgets": [
|
197 |
+
"34b559e7dcc245d59cf63059f89854e1",
|
198 |
+
"c6e4d63554564591ab38a4e633f60ba4",
|
199 |
+
"822036e3276b40a98c989dd7af3b690d",
|
200 |
+
"e9c50bc4ec04407386d5a4dea42a18bd",
|
201 |
+
"350fa3821e104536b42c1f70985f1ee4",
|
202 |
+
"075c92e6397242e495834f5dbdd074fe",
|
203 |
+
"06c033e936fb4b9faaa2a13150855a04",
|
204 |
+
"3306aab2825e424db73536be38fe774e",
|
205 |
+
"9c6feacfae344692b5c71d16d687c74e",
|
206 |
+
"20c8b95e503a44de81905b652b9291c7",
|
207 |
+
"b05c18c3366a48bf81c1260e553995ff"
|
208 |
+
]
|
209 |
+
},
|
210 |
+
"id": "cjZ9ENNnSpeY",
|
211 |
+
"outputId": "671b81ea-4789-4555-e96a-c69797cb6a13"
|
212 |
+
},
|
213 |
+
"outputs": [
|
214 |
+
{
|
215 |
+
"data": {
|
216 |
+
"application/vnd.jupyter.widget-view+json": {
|
217 |
+
"model_id": "34b559e7dcc245d59cf63059f89854e1",
|
218 |
+
"version_major": 2,
|
219 |
+
"version_minor": 0
|
220 |
+
},
|
221 |
+
"text/plain": [
|
222 |
+
"Loading checkpoint shards: 0%| | 0/8 [00:00<?, ?it/s]"
|
223 |
+
]
|
224 |
+
},
|
225 |
+
"metadata": {},
|
226 |
+
"output_type": "display_data"
|
227 |
+
}
|
228 |
+
],
|
229 |
+
"source": [
|
230 |
+
"model = \"heliosbrahma/falcon-7b-sharded-bf16-finetuned-mental-health-conversational\"\n",
|
231 |
+
"peft_model, peft_tokenizer = init_model_and_tokenizer(PEFT_MODEL = model)"
|
232 |
+
]
|
233 |
+
},
|
234 |
+
{
|
235 |
+
"cell_type": "code",
|
236 |
+
"execution_count": null,
|
237 |
+
"metadata": {
|
238 |
+
"id": "7v4BVOyxQeik"
|
239 |
+
},
|
240 |
+
"outputs": [],
|
241 |
+
"source": [
|
242 |
+
"with gr.Blocks() as demo:\n",
|
243 |
+
" gr.HTML(\"\"\"<h1>Welcome to Mental Health Conversational AI</h1>\"\"\")\n",
|
244 |
+
" gr.Markdown(\n",
|
245 |
+
" \"\"\"Chatbot specifically designed to provide psychoeducation, offer non-judgemental and empathetic support, self-assessment and monitoring.<br>\n",
|
246 |
+
" Get instant response for any mental health related queries. If the chatbot seems you need external support, then it will respond appropriately.<br>\"\"\"\n",
|
247 |
+
" )\n",
|
248 |
+
"\n",
|
249 |
+
" chatbot = gr.Chatbot()\n",
|
250 |
+
" query = gr.Textbox(label=\"Type your query here, then press 'enter' and scroll up for response\")\n",
|
251 |
+
" clear = gr.Button(value=\"Clear Chat History!\")\n",
|
252 |
+
" clear.style(size=\"sm\")\n",
|
253 |
+
"\n",
|
254 |
+
" llm_chain = init_llm_chain(peft_model, peft_tokenizer)\n",
|
255 |
+
"\n",
|
256 |
+
" query.submit(user, [query, chatbot], [query, chatbot], queue=False).then(bot, chatbot, chatbot)\n",
|
257 |
+
" clear.click(lambda: None, None, chatbot, queue=False)\n",
|
258 |
+
"\n",
|
259 |
+
"demo.queue().launch()"
|
260 |
+
]
|
261 |
+
},
|
262 |
+
{
|
263 |
+
"cell_type": "code",
|
264 |
+
"execution_count": null,
|
265 |
+
"metadata": {
|
266 |
+
"id": "bl3UYt3dUF6H"
|
267 |
+
},
|
268 |
+
"outputs": [],
|
269 |
+
"source": []
|
270 |
+
}
|
271 |
+
],
|
272 |
+
"metadata": {
|
273 |
+
"accelerator": "GPU",
|
274 |
+
"colab": {
|
275 |
+
"gpuType": "T4",
|
276 |
+
"machine_shape": "hm",
|
277 |
+
"provenance": []
|
278 |
+
},
|
279 |
+
"kernelspec": {
|
280 |
+
"display_name": "Python 3",
|
281 |
+
"name": "python3"
|
282 |
+
},
|
283 |
+
"widgets": {
|
284 |
+
"application/vnd.jupyter.widget-state+json": {
|
285 |
+
"06c033e936fb4b9faaa2a13150855a04": {
|
286 |
+
"model_module": "@jupyter-widgets/controls",
|
287 |
+
"model_module_version": "1.5.0",
|
288 |
+
"model_name": "DescriptionStyleModel",
|
289 |
+
"state": {
|
290 |
+
"_model_module": "@jupyter-widgets/controls",
|
291 |
+
"_model_module_version": "1.5.0",
|
292 |
+
"_model_name": "DescriptionStyleModel",
|
293 |
+
"_view_count": null,
|
294 |
+
"_view_module": "@jupyter-widgets/base",
|
295 |
+
"_view_module_version": "1.2.0",
|
296 |
+
"_view_name": "StyleView",
|
297 |
+
"description_width": ""
|
298 |
+
}
|
299 |
+
},
|
300 |
+
"075c92e6397242e495834f5dbdd074fe": {
|
301 |
+
"model_module": "@jupyter-widgets/base",
|
302 |
+
"model_module_version": "1.2.0",
|
303 |
+
"model_name": "LayoutModel",
|
304 |
+
"state": {
|
305 |
+
"_model_module": "@jupyter-widgets/base",
|
306 |
+
"_model_module_version": "1.2.0",
|
307 |
+
"_model_name": "LayoutModel",
|
308 |
+
"_view_count": null,
|
309 |
+
"_view_module": "@jupyter-widgets/base",
|
310 |
+
"_view_module_version": "1.2.0",
|
311 |
+
"_view_name": "LayoutView",
|
312 |
+
"align_content": null,
|
313 |
+
"align_items": null,
|
314 |
+
"align_self": null,
|
315 |
+
"border": null,
|
316 |
+
"bottom": null,
|
317 |
+
"display": null,
|
318 |
+
"flex": null,
|
319 |
+
"flex_flow": null,
|
320 |
+
"grid_area": null,
|
321 |
+
"grid_auto_columns": null,
|
322 |
+
"grid_auto_flow": null,
|
323 |
+
"grid_auto_rows": null,
|
324 |
+
"grid_column": null,
|
325 |
+
"grid_gap": null,
|
326 |
+
"grid_row": null,
|
327 |
+
"grid_template_areas": null,
|
328 |
+
"grid_template_columns": null,
|
329 |
+
"grid_template_rows": null,
|
330 |
+
"height": null,
|
331 |
+
"justify_content": null,
|
332 |
+
"justify_items": null,
|
333 |
+
"left": null,
|
334 |
+
"margin": null,
|
335 |
+
"max_height": null,
|
336 |
+
"max_width": null,
|
337 |
+
"min_height": null,
|
338 |
+
"min_width": null,
|
339 |
+
"object_fit": null,
|
340 |
+
"object_position": null,
|
341 |
+
"order": null,
|
342 |
+
"overflow": null,
|
343 |
+
"overflow_x": null,
|
344 |
+
"overflow_y": null,
|
345 |
+
"padding": null,
|
346 |
+
"right": null,
|
347 |
+
"top": null,
|
348 |
+
"visibility": null,
|
349 |
+
"width": null
|
350 |
+
}
|
351 |
+
},
|
352 |
+
"20c8b95e503a44de81905b652b9291c7": {
|
353 |
+
"model_module": "@jupyter-widgets/base",
|
354 |
+
"model_module_version": "1.2.0",
|
355 |
+
"model_name": "LayoutModel",
|
356 |
+
"state": {
|
357 |
+
"_model_module": "@jupyter-widgets/base",
|
358 |
+
"_model_module_version": "1.2.0",
|
359 |
+
"_model_name": "LayoutModel",
|
360 |
+
"_view_count": null,
|
361 |
+
"_view_module": "@jupyter-widgets/base",
|
362 |
+
"_view_module_version": "1.2.0",
|
363 |
+
"_view_name": "LayoutView",
|
364 |
+
"align_content": null,
|
365 |
+
"align_items": null,
|
366 |
+
"align_self": null,
|
367 |
+
"border": null,
|
368 |
+
"bottom": null,
|
369 |
+
"display": null,
|
370 |
+
"flex": null,
|
371 |
+
"flex_flow": null,
|
372 |
+
"grid_area": null,
|
373 |
+
"grid_auto_columns": null,
|
374 |
+
"grid_auto_flow": null,
|
375 |
+
"grid_auto_rows": null,
|
376 |
+
"grid_column": null,
|
377 |
+
"grid_gap": null,
|
378 |
+
"grid_row": null,
|
379 |
+
"grid_template_areas": null,
|
380 |
+
"grid_template_columns": null,
|
381 |
+
"grid_template_rows": null,
|
382 |
+
"height": null,
|
383 |
+
"justify_content": null,
|
384 |
+
"justify_items": null,
|
385 |
+
"left": null,
|
386 |
+
"margin": null,
|
387 |
+
"max_height": null,
|
388 |
+
"max_width": null,
|
389 |
+
"min_height": null,
|
390 |
+
"min_width": null,
|
391 |
+
"object_fit": null,
|
392 |
+
"object_position": null,
|
393 |
+
"order": null,
|
394 |
+
"overflow": null,
|
395 |
+
"overflow_x": null,
|
396 |
+
"overflow_y": null,
|
397 |
+
"padding": null,
|
398 |
+
"right": null,
|
399 |
+
"top": null,
|
400 |
+
"visibility": null,
|
401 |
+
"width": null
|
402 |
+
}
|
403 |
+
},
|
404 |
+
"3306aab2825e424db73536be38fe774e": {
|
405 |
+
"model_module": "@jupyter-widgets/base",
|
406 |
+
"model_module_version": "1.2.0",
|
407 |
+
"model_name": "LayoutModel",
|
408 |
+
"state": {
|
409 |
+
"_model_module": "@jupyter-widgets/base",
|
410 |
+
"_model_module_version": "1.2.0",
|
411 |
+
"_model_name": "LayoutModel",
|
412 |
+
"_view_count": null,
|
413 |
+
"_view_module": "@jupyter-widgets/base",
|
414 |
+
"_view_module_version": "1.2.0",
|
415 |
+
"_view_name": "LayoutView",
|
416 |
+
"align_content": null,
|
417 |
+
"align_items": null,
|
418 |
+
"align_self": null,
|
419 |
+
"border": null,
|
420 |
+
"bottom": null,
|
421 |
+
"display": null,
|
422 |
+
"flex": null,
|
423 |
+
"flex_flow": null,
|
424 |
+
"grid_area": null,
|
425 |
+
"grid_auto_columns": null,
|
426 |
+
"grid_auto_flow": null,
|
427 |
+
"grid_auto_rows": null,
|
428 |
+
"grid_column": null,
|
429 |
+
"grid_gap": null,
|
430 |
+
"grid_row": null,
|
431 |
+
"grid_template_areas": null,
|
432 |
+
"grid_template_columns": null,
|
433 |
+
"grid_template_rows": null,
|
434 |
+
"height": null,
|
435 |
+
"justify_content": null,
|
436 |
+
"justify_items": null,
|
437 |
+
"left": null,
|
438 |
+
"margin": null,
|
439 |
+
"max_height": null,
|
440 |
+
"max_width": null,
|
441 |
+
"min_height": null,
|
442 |
+
"min_width": null,
|
443 |
+
"object_fit": null,
|
444 |
+
"object_position": null,
|
445 |
+
"order": null,
|
446 |
+
"overflow": null,
|
447 |
+
"overflow_x": null,
|
448 |
+
"overflow_y": null,
|
449 |
+
"padding": null,
|
450 |
+
"right": null,
|
451 |
+
"top": null,
|
452 |
+
"visibility": null,
|
453 |
+
"width": null
|
454 |
+
}
|
455 |
+
},
|
456 |
+
"34b559e7dcc245d59cf63059f89854e1": {
|
457 |
+
"model_module": "@jupyter-widgets/controls",
|
458 |
+
"model_module_version": "1.5.0",
|
459 |
+
"model_name": "HBoxModel",
|
460 |
+
"state": {
|
461 |
+
"_dom_classes": [],
|
462 |
+
"_model_module": "@jupyter-widgets/controls",
|
463 |
+
"_model_module_version": "1.5.0",
|
464 |
+
"_model_name": "HBoxModel",
|
465 |
+
"_view_count": null,
|
466 |
+
"_view_module": "@jupyter-widgets/controls",
|
467 |
+
"_view_module_version": "1.5.0",
|
468 |
+
"_view_name": "HBoxView",
|
469 |
+
"box_style": "",
|
470 |
+
"children": [
|
471 |
+
"IPY_MODEL_c6e4d63554564591ab38a4e633f60ba4",
|
472 |
+
"IPY_MODEL_822036e3276b40a98c989dd7af3b690d",
|
473 |
+
"IPY_MODEL_e9c50bc4ec04407386d5a4dea42a18bd"
|
474 |
+
],
|
475 |
+
"layout": "IPY_MODEL_350fa3821e104536b42c1f70985f1ee4"
|
476 |
+
}
|
477 |
+
},
|
478 |
+
"350fa3821e104536b42c1f70985f1ee4": {
|
479 |
+
"model_module": "@jupyter-widgets/base",
|
480 |
+
"model_module_version": "1.2.0",
|
481 |
+
"model_name": "LayoutModel",
|
482 |
+
"state": {
|
483 |
+
"_model_module": "@jupyter-widgets/base",
|
484 |
+
"_model_module_version": "1.2.0",
|
485 |
+
"_model_name": "LayoutModel",
|
486 |
+
"_view_count": null,
|
487 |
+
"_view_module": "@jupyter-widgets/base",
|
488 |
+
"_view_module_version": "1.2.0",
|
489 |
+
"_view_name": "LayoutView",
|
490 |
+
"align_content": null,
|
491 |
+
"align_items": null,
|
492 |
+
"align_self": null,
|
493 |
+
"border": null,
|
494 |
+
"bottom": null,
|
495 |
+
"display": null,
|
496 |
+
"flex": null,
|
497 |
+
"flex_flow": null,
|
498 |
+
"grid_area": null,
|
499 |
+
"grid_auto_columns": null,
|
500 |
+
"grid_auto_flow": null,
|
501 |
+
"grid_auto_rows": null,
|
502 |
+
"grid_column": null,
|
503 |
+
"grid_gap": null,
|
504 |
+
"grid_row": null,
|
505 |
+
"grid_template_areas": null,
|
506 |
+
"grid_template_columns": null,
|
507 |
+
"grid_template_rows": null,
|
508 |
+
"height": null,
|
509 |
+
"justify_content": null,
|
510 |
+
"justify_items": null,
|
511 |
+
"left": null,
|
512 |
+
"margin": null,
|
513 |
+
"max_height": null,
|
514 |
+
"max_width": null,
|
515 |
+
"min_height": null,
|
516 |
+
"min_width": null,
|
517 |
+
"object_fit": null,
|
518 |
+
"object_position": null,
|
519 |
+
"order": null,
|
520 |
+
"overflow": null,
|
521 |
+
"overflow_x": null,
|
522 |
+
"overflow_y": null,
|
523 |
+
"padding": null,
|
524 |
+
"right": null,
|
525 |
+
"top": null,
|
526 |
+
"visibility": null,
|
527 |
+
"width": null
|
528 |
+
}
|
529 |
+
},
|
530 |
+
"822036e3276b40a98c989dd7af3b690d": {
|
531 |
+
"model_module": "@jupyter-widgets/controls",
|
532 |
+
"model_module_version": "1.5.0",
|
533 |
+
"model_name": "FloatProgressModel",
|
534 |
+
"state": {
|
535 |
+
"_dom_classes": [],
|
536 |
+
"_model_module": "@jupyter-widgets/controls",
|
537 |
+
"_model_module_version": "1.5.0",
|
538 |
+
"_model_name": "FloatProgressModel",
|
539 |
+
"_view_count": null,
|
540 |
+
"_view_module": "@jupyter-widgets/controls",
|
541 |
+
"_view_module_version": "1.5.0",
|
542 |
+
"_view_name": "ProgressView",
|
543 |
+
"bar_style": "success",
|
544 |
+
"description": "",
|
545 |
+
"description_tooltip": null,
|
546 |
+
"layout": "IPY_MODEL_3306aab2825e424db73536be38fe774e",
|
547 |
+
"max": 8,
|
548 |
+
"min": 0,
|
549 |
+
"orientation": "horizontal",
|
550 |
+
"style": "IPY_MODEL_9c6feacfae344692b5c71d16d687c74e",
|
551 |
+
"value": 8
|
552 |
+
}
|
553 |
+
},
|
554 |
+
"9c6feacfae344692b5c71d16d687c74e": {
|
555 |
+
"model_module": "@jupyter-widgets/controls",
|
556 |
+
"model_module_version": "1.5.0",
|
557 |
+
"model_name": "ProgressStyleModel",
|
558 |
+
"state": {
|
559 |
+
"_model_module": "@jupyter-widgets/controls",
|
560 |
+
"_model_module_version": "1.5.0",
|
561 |
+
"_model_name": "ProgressStyleModel",
|
562 |
+
"_view_count": null,
|
563 |
+
"_view_module": "@jupyter-widgets/base",
|
564 |
+
"_view_module_version": "1.2.0",
|
565 |
+
"_view_name": "StyleView",
|
566 |
+
"bar_color": null,
|
567 |
+
"description_width": ""
|
568 |
+
}
|
569 |
+
},
|
570 |
+
"b05c18c3366a48bf81c1260e553995ff": {
|
571 |
+
"model_module": "@jupyter-widgets/controls",
|
572 |
+
"model_module_version": "1.5.0",
|
573 |
+
"model_name": "DescriptionStyleModel",
|
574 |
+
"state": {
|
575 |
+
"_model_module": "@jupyter-widgets/controls",
|
576 |
+
"_model_module_version": "1.5.0",
|
577 |
+
"_model_name": "DescriptionStyleModel",
|
578 |
+
"_view_count": null,
|
579 |
+
"_view_module": "@jupyter-widgets/base",
|
580 |
+
"_view_module_version": "1.2.0",
|
581 |
+
"_view_name": "StyleView",
|
582 |
+
"description_width": ""
|
583 |
+
}
|
584 |
+
},
|
585 |
+
"c6e4d63554564591ab38a4e633f60ba4": {
|
586 |
+
"model_module": "@jupyter-widgets/controls",
|
587 |
+
"model_module_version": "1.5.0",
|
588 |
+
"model_name": "HTMLModel",
|
589 |
+
"state": {
|
590 |
+
"_dom_classes": [],
|
591 |
+
"_model_module": "@jupyter-widgets/controls",
|
592 |
+
"_model_module_version": "1.5.0",
|
593 |
+
"_model_name": "HTMLModel",
|
594 |
+
"_view_count": null,
|
595 |
+
"_view_module": "@jupyter-widgets/controls",
|
596 |
+
"_view_module_version": "1.5.0",
|
597 |
+
"_view_name": "HTMLView",
|
598 |
+
"description": "",
|
599 |
+
"description_tooltip": null,
|
600 |
+
"layout": "IPY_MODEL_075c92e6397242e495834f5dbdd074fe",
|
601 |
+
"placeholder": "",
|
602 |
+
"style": "IPY_MODEL_06c033e936fb4b9faaa2a13150855a04",
|
603 |
+
"value": "Loading checkpoint shards: 100%"
|
604 |
+
}
|
605 |
+
},
|
606 |
+
"e9c50bc4ec04407386d5a4dea42a18bd": {
|
607 |
+
"model_module": "@jupyter-widgets/controls",
|
608 |
+
"model_module_version": "1.5.0",
|
609 |
+
"model_name": "HTMLModel",
|
610 |
+
"state": {
|
611 |
+
"_dom_classes": [],
|
612 |
+
"_model_module": "@jupyter-widgets/controls",
|
613 |
+
"_model_module_version": "1.5.0",
|
614 |
+
"_model_name": "HTMLModel",
|
615 |
+
"_view_count": null,
|
616 |
+
"_view_module": "@jupyter-widgets/controls",
|
617 |
+
"_view_module_version": "1.5.0",
|
618 |
+
"_view_name": "HTMLView",
|
619 |
+
"description": "",
|
620 |
+
"description_tooltip": null,
|
621 |
+
"layout": "IPY_MODEL_20c8b95e503a44de81905b652b9291c7",
|
622 |
+
"placeholder": "",
|
623 |
+
"style": "IPY_MODEL_b05c18c3366a48bf81c1260e553995ff",
|
624 |
+
"value": " 8/8 [01:32<00:00, 9.87s/it]"
|
625 |
+
}
|
626 |
+
}
|
627 |
+
}
|
628 |
+
}
|
629 |
+
},
|
630 |
+
"nbformat": 4,
|
631 |
+
"nbformat_minor": 0
|
632 |
+
}
|