Sandiago21 commited on
Commit
e47fa78
1 Parent(s): 0feb34f

commit cleaned notebook

Browse files
Files changed (1) hide show
  1. notebooks/HuggingFace-Inference.ipynb +308 -493
notebooks/HuggingFace-Inference.ipynb CHANGED
@@ -1,8 +1,83 @@
1
  {
2
  "cells": [
 
 
 
 
 
 
 
 
3
  {
4
  "cell_type": "code",
5
- "execution_count": 5,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  "id": "9837afb7",
7
  "metadata": {},
8
  "outputs": [],
@@ -27,6 +102,34 @@
27
  "### Response:\"\"\""
28
  ]
29
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  {
31
  "cell_type": "code",
32
  "execution_count": 4,
@@ -43,7 +146,7 @@
43
  {
44
  "data": {
45
  "application/vnd.jupyter.widget-view+json": {
46
- "model_id": "bff8fb0a005e4635a07ecf6fe0fdba88",
47
  "version_major": 2,
48
  "version_minor": 0
49
  },
@@ -53,223 +156,9 @@
53
  },
54
  "metadata": {},
55
  "output_type": "display_data"
56
- },
57
- {
58
- "data": {
59
- "text/html": [
60
- "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #800000; text-decoration-color: #800000\">╭─────────────────────────────── </span><span style=\"color: #800000; text-decoration-color: #800000; font-weight: bold\">Traceback </span><span style=\"color: #bf7f7f; text-decoration-color: #bf7f7f; font-weight: bold\">(most recent call last)</span><span style=\"color: #800000; text-decoration-color: #800000\"> ────────────────────────────────╮</span>\n",
61
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #bfbf7f; text-decoration-color: #bfbf7f\">/opt/conda/envs/media-reco-env-3-8/lib/python3.8/site-packages/transformers/</span><span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\">modeling_utils.py</span>:<span style=\"color: #0000ff; text-decoration-color: #0000ff\">45</span> <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
62
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #0000ff; text-decoration-color: #0000ff\">9</span> in <span style=\"color: #00ff00; text-decoration-color: #00ff00\">load_state_dict</span> <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
63
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
64
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\"> 456 </span><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">│ │ │ </span>) <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
65
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\"> 457 </span><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">│ │ </span><span style=\"color: #0000ff; text-decoration-color: #0000ff\">return</span> safe_load_file(checkpoint_file) <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
66
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\"> 458 </span><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">│ </span><span style=\"color: #0000ff; text-decoration-color: #0000ff\">try</span>: <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
67
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #800000; text-decoration-color: #800000\">❱ </span> 459 <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">│ │ </span><span style=\"color: #0000ff; text-decoration-color: #0000ff\">return</span> torch.load(checkpoint_file, map_location=<span style=\"color: #808000; text-decoration-color: #808000\">\"cpu\"</span>) <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
68
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\"> 460 </span><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">│ </span><span style=\"color: #0000ff; text-decoration-color: #0000ff\">except</span> <span style=\"color: #00ffff; text-decoration-color: #00ffff\">Exception</span> <span style=\"color: #0000ff; text-decoration-color: #0000ff\">as</span> e: <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
69
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\"> 461 </span><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">│ │ </span><span style=\"color: #0000ff; text-decoration-color: #0000ff\">try</span>: <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
70
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\"> 462 </span><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">│ │ │ </span><span style=\"color: #0000ff; text-decoration-color: #0000ff\">with</span> <span style=\"color: #00ffff; text-decoration-color: #00ffff\">open</span>(checkpoint_file) <span style=\"color: #0000ff; text-decoration-color: #0000ff\">as</span> f: <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
71
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
72
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #bfbf7f; text-decoration-color: #bfbf7f\">/opt/conda/envs/media-reco-env-3-8/lib/python3.8/site-packages/torch/</span><span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\">serialization.py</span>:<span style=\"color: #0000ff; text-decoration-color: #0000ff\">791</span> in <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
73
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #00ff00; text-decoration-color: #00ff00\">load</span> <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
74
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
75
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\"> 788 </span><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">│ </span><span style=\"color: #0000ff; text-decoration-color: #0000ff\">if</span> <span style=\"color: #808000; text-decoration-color: #808000\">'encoding'</span> <span style=\"color: #ff00ff; text-decoration-color: #ff00ff\">not</span> <span style=\"color: #ff00ff; text-decoration-color: #ff00ff\">in</span> pickle_load_args.keys(): <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
76
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\"> 789 </span><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">│ │ </span>pickle_load_args[<span style=\"color: #808000; text-decoration-color: #808000\">'encoding'</span>] = <span style=\"color: #808000; text-decoration-color: #808000\">'utf-8'</span> <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
77
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\"> 790 </span><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">│ </span> <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
78
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #800000; text-decoration-color: #800000\">❱ </span> 791 <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">│ </span><span style=\"color: #0000ff; text-decoration-color: #0000ff\">with</span> _open_file_like(f, <span style=\"color: #808000; text-decoration-color: #808000\">'rb'</span>) <span style=\"color: #0000ff; text-decoration-color: #0000ff\">as</span> opened_file: <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
79
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\"> 792 </span><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">│ │ </span><span style=\"color: #0000ff; text-decoration-color: #0000ff\">if</span> _is_zipfile(opened_file): <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
80
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\"> 793 </span><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">│ │ │ </span><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\"># The zipfile reader is going to advance the current file position.</span> <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
81
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\"> 794 </span><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">│ │ │ </span><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\"># If we want to actually tail call to torch.jit.load, we need to</span> <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
82
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
83
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #bfbf7f; text-decoration-color: #bfbf7f\">/opt/conda/envs/media-reco-env-3-8/lib/python3.8/site-packages/torch/</span><span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\">serialization.py</span>:<span style=\"color: #0000ff; text-decoration-color: #0000ff\">271</span> in <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
84
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #00ff00; text-decoration-color: #00ff00\">_open_file_like</span> <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
85
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
86
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\"> 268 </span> <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
87
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\"> 269 </span><span style=\"color: #0000ff; text-decoration-color: #0000ff\">def</span> <span style=\"color: #00ff00; text-decoration-color: #00ff00\">_open_file_like</span>(name_or_buffer, mode): <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
88
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\"> 270 </span><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">│ </span><span style=\"color: #0000ff; text-decoration-color: #0000ff\">if</span> _is_path(name_or_buffer): <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
89
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #800000; text-decoration-color: #800000\">❱ </span> 271 <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">│ │ </span><span style=\"color: #0000ff; text-decoration-color: #0000ff\">return</span> _open_file(name_or_buffer, mode) <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
90
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\"> 272 </span><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">│ </span><span style=\"color: #0000ff; text-decoration-color: #0000ff\">else</span>: <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
91
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\"> 273 </span><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">│ │ </span><span style=\"color: #0000ff; text-decoration-color: #0000ff\">if</span> <span style=\"color: #808000; text-decoration-color: #808000\">'w'</span> <span style=\"color: #ff00ff; text-decoration-color: #ff00ff\">in</span> mode: <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
92
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\"> 274 </span><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">│ │ │ </span><span style=\"color: #0000ff; text-decoration-color: #0000ff\">return</span> _open_buffer_writer(name_or_buffer) <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
93
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
94
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #bfbf7f; text-decoration-color: #bfbf7f\">/opt/conda/envs/media-reco-env-3-8/lib/python3.8/site-packages/torch/</span><span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\">serialization.py</span>:<span style=\"color: #0000ff; text-decoration-color: #0000ff\">252</span> in <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
95
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #00ff00; text-decoration-color: #00ff00\">__init__</span> <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
96
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
97
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\"> 249 </span> <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
98
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\"> 250 </span><span style=\"color: #0000ff; text-decoration-color: #0000ff\">class</span> <span style=\"color: #00ff00; text-decoration-color: #00ff00; text-decoration: underline\">_open_file</span>(_opener): <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
99
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\"> 251 </span><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">│ </span><span style=\"color: #0000ff; text-decoration-color: #0000ff\">def</span> <span style=\"color: #00ff00; text-decoration-color: #00ff00\">__init__</span>(<span style=\"color: #00ffff; text-decoration-color: #00ffff\">self</span>, name, mode): <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
100
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #800000; text-decoration-color: #800000\">❱ </span> 252 <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">│ │ </span><span style=\"color: #00ffff; text-decoration-color: #00ffff\">super</span>().<span style=\"color: #00ff00; text-decoration-color: #00ff00\">__init__</span>(<span style=\"color: #00ffff; text-decoration-color: #00ffff\">open</span>(name, mode)) <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
101
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\"> 253 </span><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">│ </span> <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
102
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\"> 254 </span><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">│ </span><span style=\"color: #0000ff; text-decoration-color: #0000ff\">def</span> <span style=\"color: #00ff00; text-decoration-color: #00ff00\">__exit__</span>(<span style=\"color: #00ffff; text-decoration-color: #00ffff\">self</span>, *args): <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
103
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\"> 255 </span><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">│ │ </span><span style=\"color: #00ffff; text-decoration-color: #00ffff\">self</span>.file_like.close() <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
104
- "<span style=\"color: #800000; text-decoration-color: #800000\">╰──────────────────────────────────────────────────────────────────────────────────────────────────╯</span>\n",
105
- "<span style=\"color: #ff0000; text-decoration-color: #ff0000; font-weight: bold\">FileNotFoundError: </span><span style=\"font-weight: bold\">[</span>Errno <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">2</span><span style=\"font-weight: bold\">]</span> No such file or directory: \n",
106
- "<span style=\"color: #008000; text-decoration-color: #008000\">'../decapoda-research/llama-7b-hf/pytorch_model-00001-of-00033.bin'</span>\n",
107
- "\n",
108
- "<span style=\"font-style: italic\">During handling of the above exception, another exception occurred:</span>\n",
109
- "\n",
110
- "<span style=\"color: #800000; text-decoration-color: #800000\">╭─────────────────────────────── </span><span style=\"color: #800000; text-decoration-color: #800000; font-weight: bold\">Traceback </span><span style=\"color: #bf7f7f; text-decoration-color: #bf7f7f; font-weight: bold\">(most recent call last)</span><span style=\"color: #800000; text-decoration-color: #800000\"> ────────────────────────────────╮</span>\n",
111
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> in <span style=\"color: #00ff00; text-decoration-color: #00ff00\">&lt;module&gt;</span>:<span style=\"color: #0000ff; text-decoration-color: #0000ff\">16</span> <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
112
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
113
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">13 </span> <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
114
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">14 </span>tokenizer = LlamaTokenizer.from_pretrained(MODEL_NAME) <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
115
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">15 </span> <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
116
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #800000; text-decoration-color: #800000\">❱ </span>16 model = LlamaForCausalLM.from_pretrained( <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
117
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">17 </span><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">│ </span>BASE_MODEL, <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
118
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">18 </span><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">│ </span>load_in_8bit=<span style=\"color: #0000ff; text-decoration-color: #0000ff\">True</span>, <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
119
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">19 </span><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">│ </span>torch_dtype=torch.float16, <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
120
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
121
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #bfbf7f; text-decoration-color: #bfbf7f\">/opt/conda/envs/media-reco-env-3-8/lib/python3.8/site-packages/transformers/</span><span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\">modeling_utils.py</span>:<span style=\"color: #0000ff; text-decoration-color: #0000ff\">28</span> <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
122
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #0000ff; text-decoration-color: #0000ff\">70</span> in <span style=\"color: #00ff00; text-decoration-color: #00ff00\">from_pretrained</span> <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
123
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
124
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">2867 </span><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">│ │ │ │ </span>mismatched_keys, <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
125
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">2868 </span><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">│ │ │ │ </span>offload_index, <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
126
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">2869 </span><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">│ │ │ │ </span>error_msgs, <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
127
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #800000; text-decoration-color: #800000\">❱ </span>2870 <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">│ │ │ </span>) = <span style=\"color: #00ffff; text-decoration-color: #00ffff\">cls</span>._load_pretrained_model( <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
128
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">2871 </span><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">│ │ │ │ </span>model, <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
129
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">2872 </span><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">│ │ │ │ </span>state_dict, <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
130
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">2873 </span><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">│ │ │ │ </span>loaded_state_dict_keys, <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\"># XXX: rename?</span> <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
131
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
132
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #bfbf7f; text-decoration-color: #bfbf7f\">/opt/conda/envs/media-reco-env-3-8/lib/python3.8/site-packages/transformers/</span><span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\">modeling_utils.py</span>:<span style=\"color: #0000ff; text-decoration-color: #0000ff\">32</span> <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
133
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #0000ff; text-decoration-color: #0000ff\">02</span> in <span style=\"color: #00ff00; text-decoration-color: #00ff00\">_load_pretrained_model</span> <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
134
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
135
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">3199 </span><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">│ │ │ │ </span><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\"># Skip the load for shards that only contain disk-offloaded weights when</span> <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
136
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">3200 </span><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">│ │ │ │ </span><span style=\"color: #0000ff; text-decoration-color: #0000ff\">if</span> shard_file <span style=\"color: #ff00ff; text-decoration-color: #ff00ff\">in</span> disk_only_shard_files: <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
137
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">3201 </span><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">│ │ │ │ │ </span><span style=\"color: #0000ff; text-decoration-color: #0000ff\">continue</span> <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
138
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #800000; text-decoration-color: #800000\">❱ </span>3202 <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">│ │ │ │ </span>state_dict = load_state_dict(shard_file) <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
139
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">3203 </span><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">│ │ │ │ </span> <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
140
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">3204 </span><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">│ │ │ │ </span><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\"># Mistmatched keys contains tuples key/shape1/shape2 of weights in the c</span> <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
141
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">3205 </span><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">│ │ │ │ </span><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\"># matching the weights in the model.</span> <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
142
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
143
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #bfbf7f; text-decoration-color: #bfbf7f\">/opt/conda/envs/media-reco-env-3-8/lib/python3.8/site-packages/transformers/</span><span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\">modeling_utils.py</span>:<span style=\"color: #0000ff; text-decoration-color: #0000ff\">46</span> <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
144
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #0000ff; text-decoration-color: #0000ff\">2</span> in <span style=\"color: #00ff00; text-decoration-color: #00ff00\">load_state_dict</span> <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
145
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
146
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\"> 459 </span><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">│ │ </span><span style=\"color: #0000ff; text-decoration-color: #0000ff\">return</span> torch.load(checkpoint_file, map_location=<span style=\"color: #808000; text-decoration-color: #808000\">\"cpu\"</span>) <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
147
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\"> 460 </span><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">│ </span><span style=\"color: #0000ff; text-decoration-color: #0000ff\">except</span> <span style=\"color: #00ffff; text-decoration-color: #00ffff\">Exception</span> <span style=\"color: #0000ff; text-decoration-color: #0000ff\">as</span> e: <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
148
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\"> 461 </span><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">│ │ </span><span style=\"color: #0000ff; text-decoration-color: #0000ff\">try</span>: <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
149
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #800000; text-decoration-color: #800000\">❱ </span> 462 <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">│ │ │ </span><span style=\"color: #0000ff; text-decoration-color: #0000ff\">with</span> <span style=\"color: #00ffff; text-decoration-color: #00ffff\">open</span>(checkpoint_file) <span style=\"color: #0000ff; text-decoration-color: #0000ff\">as</span> f: <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
150
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\"> 463 </span><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">│ │ │ │ </span><span style=\"color: #0000ff; text-decoration-color: #0000ff\">if</span> f.read(<span style=\"color: #0000ff; text-decoration-color: #0000ff\">7</span>) == <span style=\"color: #808000; text-decoration-color: #808000\">\"version\"</span>: <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
151
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\"> 464 </span><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">│ │ │ │ │ </span><span style=\"color: #0000ff; text-decoration-color: #0000ff\">raise</span> <span style=\"color: #00ffff; text-decoration-color: #00ffff\">OSError</span>( <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
152
- "<span style=\"color: #800000; text-decoration-color: #800000\">│</span> <span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\"> 465 </span><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">│ │ │ │ │ │ </span><span style=\"color: #808000; text-decoration-color: #808000\">\"You seem to have cloned a repository without having git-lfs ins</span> <span style=\"color: #800000; text-decoration-color: #800000\">│</span>\n",
153
- "<span style=\"color: #800000; text-decoration-color: #800000\">╰──────────────────────────────────────────────────────────────────────────────────────────────────╯</span>\n",
154
- "<span style=\"color: #ff0000; text-decoration-color: #ff0000; font-weight: bold\">FileNotFoundError: </span><span style=\"font-weight: bold\">[</span>Errno <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">2</span><span style=\"font-weight: bold\">]</span> No such file or directory: \n",
155
- "<span style=\"color: #008000; text-decoration-color: #008000\">'../decapoda-research/llama-7b-hf/pytorch_model-00001-of-00033.bin'</span>\n",
156
- "</pre>\n"
157
- ],
158
- "text/plain": [
159
- "\u001b[31m╭─\u001b[0m\u001b[31m──────────────────────────────\u001b[0m\u001b[31m \u001b[0m\u001b[1;31mTraceback \u001b[0m\u001b[1;2;31m(most recent call last)\u001b[0m\u001b[31m \u001b[0m\u001b[31m───────────────────────────────\u001b[0m\u001b[31m─╮\u001b[0m\n",
160
- "\u001b[31m│\u001b[0m \u001b[2;33m/opt/conda/envs/media-reco-env-3-8/lib/python3.8/site-packages/transformers/\u001b[0m\u001b[1;33mmodeling_utils.py\u001b[0m:\u001b[94m45\u001b[0m \u001b[31m│\u001b[0m\n",
161
- "\u001b[31m│\u001b[0m \u001b[94m9\u001b[0m in \u001b[92mload_state_dict\u001b[0m \u001b[31m│\u001b[0m\n",
162
- "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n",
163
- "\u001b[31m│\u001b[0m \u001b[2m 456 \u001b[0m\u001b[2m│ │ │ \u001b[0m) \u001b[31m│\u001b[0m\n",
164
- "\u001b[31m│\u001b[0m \u001b[2m 457 \u001b[0m\u001b[2m│ │ \u001b[0m\u001b[94mreturn\u001b[0m safe_load_file(checkpoint_file) \u001b[31m│\u001b[0m\n",
165
- "\u001b[31m│\u001b[0m \u001b[2m 458 \u001b[0m\u001b[2m│ \u001b[0m\u001b[94mtry\u001b[0m: \u001b[31m│\u001b[0m\n",
166
- "\u001b[31m│\u001b[0m \u001b[31m❱ \u001b[0m 459 \u001b[2m│ │ \u001b[0m\u001b[94mreturn\u001b[0m torch.load(checkpoint_file, map_location=\u001b[33m\"\u001b[0m\u001b[33mcpu\u001b[0m\u001b[33m\"\u001b[0m) \u001b[31m│\u001b[0m\n",
167
- "\u001b[31m│\u001b[0m \u001b[2m 460 \u001b[0m\u001b[2m│ \u001b[0m\u001b[94mexcept\u001b[0m \u001b[96mException\u001b[0m \u001b[94mas\u001b[0m e: \u001b[31m│\u001b[0m\n",
168
- "\u001b[31m│\u001b[0m \u001b[2m 461 \u001b[0m\u001b[2m│ │ \u001b[0m\u001b[94mtry\u001b[0m: \u001b[31m│\u001b[0m\n",
169
- "\u001b[31m│\u001b[0m \u001b[2m 462 \u001b[0m\u001b[2m│ │ │ \u001b[0m\u001b[94mwith\u001b[0m \u001b[96mopen\u001b[0m(checkpoint_file) \u001b[94mas\u001b[0m f: \u001b[31m│\u001b[0m\n",
170
- "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n",
171
- "\u001b[31m│\u001b[0m \u001b[2;33m/opt/conda/envs/media-reco-env-3-8/lib/python3.8/site-packages/torch/\u001b[0m\u001b[1;33mserialization.py\u001b[0m:\u001b[94m791\u001b[0m in \u001b[31m│\u001b[0m\n",
172
- "\u001b[31m│\u001b[0m \u001b[92mload\u001b[0m \u001b[31m│\u001b[0m\n",
173
- "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n",
174
- "\u001b[31m│\u001b[0m \u001b[2m 788 \u001b[0m\u001b[2m│ \u001b[0m\u001b[94mif\u001b[0m \u001b[33m'\u001b[0m\u001b[33mencoding\u001b[0m\u001b[33m'\u001b[0m \u001b[95mnot\u001b[0m \u001b[95min\u001b[0m pickle_load_args.keys(): \u001b[31m│\u001b[0m\n",
175
- "\u001b[31m│\u001b[0m \u001b[2m 789 \u001b[0m\u001b[2m│ │ \u001b[0mpickle_load_args[\u001b[33m'\u001b[0m\u001b[33mencoding\u001b[0m\u001b[33m'\u001b[0m] = \u001b[33m'\u001b[0m\u001b[33mutf-8\u001b[0m\u001b[33m'\u001b[0m \u001b[31m│\u001b[0m\n",
176
- "\u001b[31m│\u001b[0m \u001b[2m 790 \u001b[0m\u001b[2m│ \u001b[0m \u001b[31m│\u001b[0m\n",
177
- "\u001b[31m│\u001b[0m \u001b[31m❱ \u001b[0m 791 \u001b[2m│ \u001b[0m\u001b[94mwith\u001b[0m _open_file_like(f, \u001b[33m'\u001b[0m\u001b[33mrb\u001b[0m\u001b[33m'\u001b[0m) \u001b[94mas\u001b[0m opened_file: \u001b[31m│\u001b[0m\n",
178
- "\u001b[31m│\u001b[0m \u001b[2m 792 \u001b[0m\u001b[2m│ │ \u001b[0m\u001b[94mif\u001b[0m _is_zipfile(opened_file): \u001b[31m│\u001b[0m\n",
179
- "\u001b[31m│\u001b[0m \u001b[2m 793 \u001b[0m\u001b[2m│ │ │ \u001b[0m\u001b[2m# The zipfile reader is going to advance the current file position.\u001b[0m \u001b[31m│\u001b[0m\n",
180
- "\u001b[31m│\u001b[0m \u001b[2m 794 \u001b[0m\u001b[2m│ │ │ \u001b[0m\u001b[2m# If we want to actually tail call to torch.jit.load, we need to\u001b[0m \u001b[31m│\u001b[0m\n",
181
- "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n",
182
- "\u001b[31m│\u001b[0m \u001b[2;33m/opt/conda/envs/media-reco-env-3-8/lib/python3.8/site-packages/torch/\u001b[0m\u001b[1;33mserialization.py\u001b[0m:\u001b[94m271\u001b[0m in \u001b[31m│\u001b[0m\n",
183
- "\u001b[31m│\u001b[0m \u001b[92m_open_file_like\u001b[0m \u001b[31m│\u001b[0m\n",
184
- "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n",
185
- "\u001b[31m│\u001b[0m \u001b[2m 268 \u001b[0m \u001b[31m│\u001b[0m\n",
186
- "\u001b[31m│\u001b[0m \u001b[2m 269 \u001b[0m\u001b[94mdef\u001b[0m \u001b[92m_open_file_like\u001b[0m(name_or_buffer, mode): \u001b[31m│\u001b[0m\n",
187
- "\u001b[31m│\u001b[0m \u001b[2m 270 \u001b[0m\u001b[2m│ \u001b[0m\u001b[94mif\u001b[0m _is_path(name_or_buffer): \u001b[31m│\u001b[0m\n",
188
- "\u001b[31m│\u001b[0m \u001b[31m❱ \u001b[0m 271 \u001b[2m│ │ \u001b[0m\u001b[94mreturn\u001b[0m _open_file(name_or_buffer, mode) \u001b[31m│\u001b[0m\n",
189
- "\u001b[31m│\u001b[0m \u001b[2m 272 \u001b[0m\u001b[2m│ \u001b[0m\u001b[94melse\u001b[0m: \u001b[31m│\u001b[0m\n",
190
- "\u001b[31m│\u001b[0m \u001b[2m 273 \u001b[0m\u001b[2m│ │ \u001b[0m\u001b[94mif\u001b[0m \u001b[33m'\u001b[0m\u001b[33mw\u001b[0m\u001b[33m'\u001b[0m \u001b[95min\u001b[0m mode: \u001b[31m│\u001b[0m\n",
191
- "\u001b[31m│\u001b[0m \u001b[2m 274 \u001b[0m\u001b[2m│ │ │ \u001b[0m\u001b[94mreturn\u001b[0m _open_buffer_writer(name_or_buffer) \u001b[31m│\u001b[0m\n",
192
- "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n",
193
- "\u001b[31m│\u001b[0m \u001b[2;33m/opt/conda/envs/media-reco-env-3-8/lib/python3.8/site-packages/torch/\u001b[0m\u001b[1;33mserialization.py\u001b[0m:\u001b[94m252\u001b[0m in \u001b[31m│\u001b[0m\n",
194
- "\u001b[31m│\u001b[0m \u001b[92m__init__\u001b[0m \u001b[31m│\u001b[0m\n",
195
- "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n",
196
- "\u001b[31m│\u001b[0m \u001b[2m 249 \u001b[0m \u001b[31m│\u001b[0m\n",
197
- "\u001b[31m│\u001b[0m \u001b[2m 250 \u001b[0m\u001b[94mclass\u001b[0m \u001b[4;92m_open_file\u001b[0m(_opener): \u001b[31m│\u001b[0m\n",
198
- "\u001b[31m│\u001b[0m \u001b[2m 251 \u001b[0m\u001b[2m│ \u001b[0m\u001b[94mdef\u001b[0m \u001b[92m__init__\u001b[0m(\u001b[96mself\u001b[0m, name, mode): \u001b[31m│\u001b[0m\n",
199
- "\u001b[31m│\u001b[0m \u001b[31m❱ \u001b[0m 252 \u001b[2m│ │ \u001b[0m\u001b[96msuper\u001b[0m().\u001b[92m__init__\u001b[0m(\u001b[96mopen\u001b[0m(name, mode)) \u001b[31m│\u001b[0m\n",
200
- "\u001b[31m│\u001b[0m \u001b[2m 253 \u001b[0m\u001b[2m│ \u001b[0m \u001b[31m│\u001b[0m\n",
201
- "\u001b[31m│\u001b[0m \u001b[2m 254 \u001b[0m\u001b[2m│ \u001b[0m\u001b[94mdef\u001b[0m \u001b[92m__exit__\u001b[0m(\u001b[96mself\u001b[0m, *args): \u001b[31m│\u001b[0m\n",
202
- "\u001b[31m│\u001b[0m \u001b[2m 255 \u001b[0m\u001b[2m│ │ \u001b[0m\u001b[96mself\u001b[0m.file_like.close() \u001b[31m│\u001b[0m\n",
203
- "\u001b[31m╰──────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m\n",
204
- "\u001b[1;91mFileNotFoundError: \u001b[0m\u001b[1m[\u001b[0mErrno \u001b[1;36m2\u001b[0m\u001b[1m]\u001b[0m No such file or directory: \n",
205
- "\u001b[32m'../decapoda-research/llama-7b-hf/pytorch_model-00001-of-00033.bin'\u001b[0m\n",
206
- "\n",
207
- "\u001b[3mDuring handling of the above exception, another exception occurred:\u001b[0m\n",
208
- "\n",
209
- "\u001b[31m╭─\u001b[0m\u001b[31m──────────────────────────────\u001b[0m\u001b[31m \u001b[0m\u001b[1;31mTraceback \u001b[0m\u001b[1;2;31m(most recent call last)\u001b[0m\u001b[31m \u001b[0m\u001b[31m───────────────────────────────\u001b[0m\u001b[31m─╮\u001b[0m\n",
210
- "\u001b[31m│\u001b[0m in \u001b[92m<module>\u001b[0m:\u001b[94m16\u001b[0m \u001b[31m│\u001b[0m\n",
211
- "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n",
212
- "\u001b[31m│\u001b[0m \u001b[2m13 \u001b[0m \u001b[31m│\u001b[0m\n",
213
- "\u001b[31m│\u001b[0m \u001b[2m14 \u001b[0mtokenizer = LlamaTokenizer.from_pretrained(MODEL_NAME) \u001b[31m│\u001b[0m\n",
214
- "\u001b[31m│\u001b[0m \u001b[2m15 \u001b[0m \u001b[31m│\u001b[0m\n",
215
- "\u001b[31m│\u001b[0m \u001b[31m❱ \u001b[0m16 model = LlamaForCausalLM.from_pretrained( \u001b[31m│\u001b[0m\n",
216
- "\u001b[31m│\u001b[0m \u001b[2m17 \u001b[0m\u001b[2m│ \u001b[0mBASE_MODEL, \u001b[31m│\u001b[0m\n",
217
- "\u001b[31m│\u001b[0m \u001b[2m18 \u001b[0m\u001b[2m│ \u001b[0mload_in_8bit=\u001b[94mTrue\u001b[0m, \u001b[31m│\u001b[0m\n",
218
- "\u001b[31m│\u001b[0m \u001b[2m19 \u001b[0m\u001b[2m│ \u001b[0mtorch_dtype=torch.float16, \u001b[31m│\u001b[0m\n",
219
- "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n",
220
- "\u001b[31m│\u001b[0m \u001b[2;33m/opt/conda/envs/media-reco-env-3-8/lib/python3.8/site-packages/transformers/\u001b[0m\u001b[1;33mmodeling_utils.py\u001b[0m:\u001b[94m28\u001b[0m \u001b[31m│\u001b[0m\n",
221
- "\u001b[31m│\u001b[0m \u001b[94m70\u001b[0m in \u001b[92mfrom_pretrained\u001b[0m \u001b[31m│\u001b[0m\n",
222
- "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n",
223
- "\u001b[31m│\u001b[0m \u001b[2m2867 \u001b[0m\u001b[2m│ │ │ │ \u001b[0mmismatched_keys, \u001b[31m│\u001b[0m\n",
224
- "\u001b[31m│\u001b[0m \u001b[2m2868 \u001b[0m\u001b[2m│ │ │ │ \u001b[0moffload_index, \u001b[31m│\u001b[0m\n",
225
- "\u001b[31m│\u001b[0m \u001b[2m2869 \u001b[0m\u001b[2m│ │ │ │ \u001b[0merror_msgs, \u001b[31m│\u001b[0m\n",
226
- "\u001b[31m│\u001b[0m \u001b[31m❱ \u001b[0m2870 \u001b[2m│ │ │ \u001b[0m) = \u001b[96mcls\u001b[0m._load_pretrained_model( \u001b[31m│\u001b[0m\n",
227
- "\u001b[31m│\u001b[0m \u001b[2m2871 \u001b[0m\u001b[2m│ │ │ │ \u001b[0mmodel, \u001b[31m│\u001b[0m\n",
228
- "\u001b[31m│\u001b[0m \u001b[2m2872 \u001b[0m\u001b[2m│ │ │ │ \u001b[0mstate_dict, \u001b[31m│\u001b[0m\n",
229
- "\u001b[31m│\u001b[0m \u001b[2m2873 \u001b[0m\u001b[2m│ │ │ │ \u001b[0mloaded_state_dict_keys, \u001b[2m# XXX: rename?\u001b[0m \u001b[31m│\u001b[0m\n",
230
- "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n",
231
- "\u001b[31m│\u001b[0m \u001b[2;33m/opt/conda/envs/media-reco-env-3-8/lib/python3.8/site-packages/transformers/\u001b[0m\u001b[1;33mmodeling_utils.py\u001b[0m:\u001b[94m32\u001b[0m \u001b[31m│\u001b[0m\n",
232
- "\u001b[31m│\u001b[0m \u001b[94m02\u001b[0m in \u001b[92m_load_pretrained_model\u001b[0m \u001b[31m│\u001b[0m\n",
233
- "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n",
234
- "\u001b[31m│\u001b[0m \u001b[2m3199 \u001b[0m\u001b[2m│ │ │ │ \u001b[0m\u001b[2m# Skip the load for shards that only contain disk-offloaded weights when\u001b[0m \u001b[31m│\u001b[0m\n",
235
- "\u001b[31m│\u001b[0m \u001b[2m3200 \u001b[0m\u001b[2m│ │ │ │ \u001b[0m\u001b[94mif\u001b[0m shard_file \u001b[95min\u001b[0m disk_only_shard_files: \u001b[31m│\u001b[0m\n",
236
- "\u001b[31m│\u001b[0m \u001b[2m3201 \u001b[0m\u001b[2m│ │ │ │ │ \u001b[0m\u001b[94mcontinue\u001b[0m \u001b[31m│\u001b[0m\n",
237
- "\u001b[31m│\u001b[0m \u001b[31m❱ \u001b[0m3202 \u001b[2m│ │ │ │ \u001b[0mstate_dict = load_state_dict(shard_file) \u001b[31m│\u001b[0m\n",
238
- "\u001b[31m│\u001b[0m \u001b[2m3203 \u001b[0m\u001b[2m│ │ │ │ \u001b[0m \u001b[31m│\u001b[0m\n",
239
- "\u001b[31m│\u001b[0m \u001b[2m3204 \u001b[0m\u001b[2m│ │ │ │ \u001b[0m\u001b[2m# Mistmatched keys contains tuples key/shape1/shape2 of weights in the c\u001b[0m \u001b[31m│\u001b[0m\n",
240
- "\u001b[31m│\u001b[0m \u001b[2m3205 \u001b[0m\u001b[2m│ │ │ │ \u001b[0m\u001b[2m# matching the weights in the model.\u001b[0m \u001b[31m│\u001b[0m\n",
241
- "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n",
242
- "\u001b[31m│\u001b[0m \u001b[2;33m/opt/conda/envs/media-reco-env-3-8/lib/python3.8/site-packages/transformers/\u001b[0m\u001b[1;33mmodeling_utils.py\u001b[0m:\u001b[94m46\u001b[0m \u001b[31m│\u001b[0m\n",
243
- "\u001b[31m│\u001b[0m \u001b[94m2\u001b[0m in \u001b[92mload_state_dict\u001b[0m \u001b[31m│\u001b[0m\n",
244
- "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n",
245
- "\u001b[31m│\u001b[0m \u001b[2m 459 \u001b[0m\u001b[2m│ │ \u001b[0m\u001b[94mreturn\u001b[0m torch.load(checkpoint_file, map_location=\u001b[33m\"\u001b[0m\u001b[33mcpu\u001b[0m\u001b[33m\"\u001b[0m) \u001b[31m│\u001b[0m\n",
246
- "\u001b[31m│\u001b[0m \u001b[2m 460 \u001b[0m\u001b[2m│ \u001b[0m\u001b[94mexcept\u001b[0m \u001b[96mException\u001b[0m \u001b[94mas\u001b[0m e: \u001b[31m│\u001b[0m\n",
247
- "\u001b[31m│\u001b[0m \u001b[2m 461 \u001b[0m\u001b[2m│ │ \u001b[0m\u001b[94mtry\u001b[0m: \u001b[31m│\u001b[0m\n",
248
- "\u001b[31m│\u001b[0m \u001b[31m❱ \u001b[0m 462 \u001b[2m│ │ │ \u001b[0m\u001b[94mwith\u001b[0m \u001b[96mopen\u001b[0m(checkpoint_file) \u001b[94mas\u001b[0m f: \u001b[31m│\u001b[0m\n",
249
- "\u001b[31m│\u001b[0m \u001b[2m 463 \u001b[0m\u001b[2m│ │ │ │ \u001b[0m\u001b[94mif\u001b[0m f.read(\u001b[94m7\u001b[0m) == \u001b[33m\"\u001b[0m\u001b[33mversion\u001b[0m\u001b[33m\"\u001b[0m: \u001b[31m│\u001b[0m\n",
250
- "\u001b[31m│\u001b[0m \u001b[2m 464 \u001b[0m\u001b[2m│ │ │ │ │ \u001b[0m\u001b[94mraise\u001b[0m \u001b[96mOSError\u001b[0m( \u001b[31m│\u001b[0m\n",
251
- "\u001b[31m│\u001b[0m \u001b[2m 465 \u001b[0m\u001b[2m│ │ │ │ │ │ \u001b[0m\u001b[33m\"\u001b[0m\u001b[33mYou seem to have cloned a repository without having git-lfs ins\u001b[0m \u001b[31m│\u001b[0m\n",
252
- "\u001b[31m╰──────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m\n",
253
- "\u001b[1;91mFileNotFoundError: \u001b[0m\u001b[1m[\u001b[0mErrno \u001b[1;36m2\u001b[0m\u001b[1m]\u001b[0m No such file or directory: \n",
254
- "\u001b[32m'../decapoda-research/llama-7b-hf/pytorch_model-00001-of-00033.bin'\u001b[0m\n"
255
- ]
256
- },
257
- "metadata": {},
258
- "output_type": "display_data"
259
  }
260
  ],
261
  "source": [
262
- "import torch\n",
263
- "from transformers import GenerationConfig, LlamaTokenizer, LlamaForCausalLM\n",
264
- "from peft import PeftModel, PeftConfig\n",
265
- "\n",
266
- "\n",
267
- "MODEL_NAME = \"../\"\n",
268
- "BASE_MODEL = \"../decapoda-research/llama-7b-hf\"\n",
269
- "# MODEL_NAME = f\"lora-alpaca/conversations/GPU/{MODEL_NAME}\"\n",
270
- "# MODEL_NAME = \"chainyo/alpaca-lora-7b\"\n",
271
- "# MODEL_NAME = \"decapoda-research/llama-7b-hf\"\n",
272
- "\n",
273
  "config = PeftConfig.from_pretrained(MODEL_NAME)\n",
274
  "\n",
275
  "tokenizer = LlamaTokenizer.from_pretrained(MODEL_NAME)\n",
@@ -280,25 +169,23 @@
280
  " torch_dtype=torch.float16,\n",
281
  " device_map=\"auto\",\n",
282
  ")\n",
283
- "\n",
284
- "# model = PeftModel.from_pretrained(model, MODEL_NAME)"
 
 
285
  ]
286
  },
287
  {
288
- "cell_type": "code",
289
- "execution_count": null,
290
- "id": "71dfae0f",
291
  "metadata": {},
292
- "outputs": [],
293
  "source": [
294
- "model.eval()\n",
295
- "if torch.__version__ >= \"2\":\n",
296
- " model = torch.compile(model)"
297
  ]
298
  },
299
  {
300
  "cell_type": "code",
301
- "execution_count": null,
302
  "id": "10372ae3",
303
  "metadata": {},
304
  "outputs": [],
@@ -313,12 +200,35 @@
313
  ")"
314
  ]
315
  },
 
 
 
 
 
 
 
 
316
  {
317
  "cell_type": "code",
318
- "execution_count": null,
319
  "id": "a84a4f9e",
320
  "metadata": {},
321
- "outputs": [],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
322
  "source": [
323
  "instruction = \"I have two pieces of apples and 3 pieces of oranges. How many pieces of fruits do I have?\"\n",
324
  "input_ctxt = None # For some tasks, you can provide an input context to help the model generate a better response.\n",
@@ -340,39 +250,36 @@
340
  ]
341
  },
342
  {
343
- "cell_type": "code",
344
- "execution_count": null,
345
- "id": "65117ac7",
346
  "metadata": {},
347
- "outputs": [],
348
  "source": [
349
- "instruction = \"What is the capital city of Greece and with which countries does Greece border?\"\n",
350
- "input_ctxt = None # For some tasks, you can provide an input context to help the model generate a better response.\n",
351
- "\n",
352
- "prompt = generate_prompt(instruction, input_ctxt)\n",
353
- "input_ids = tokenizer(prompt, return_tensors=\"pt\").input_ids\n",
354
- "input_ids = input_ids.to(model.device)\n",
355
- "\n",
356
- "with torch.no_grad():\n",
357
- " outputs = model.generate(\n",
358
- " input_ids=input_ids,\n",
359
- " generation_config=generation_config,\n",
360
- " return_dict_in_generate=True,\n",
361
- " output_scores=True,\n",
362
- " )\n",
363
- "\n",
364
- "response = tokenizer.decode(outputs.sequences[0], skip_special_tokens=True)\n",
365
- "print(response)"
366
  ]
367
  },
368
  {
369
  "cell_type": "code",
370
- "execution_count": null,
371
- "id": "2ff7a5e5",
372
  "metadata": {},
373
- "outputs": [],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
374
  "source": [
375
- "instruction = \"How can I cook Adobo?\"\n",
376
  "input_ctxt = None # For some tasks, you can provide an input context to help the model generate a better response.\n",
377
  "\n",
378
  "prompt = generate_prompt(instruction, input_ctxt)\n",
@@ -392,39 +299,35 @@
392
  ]
393
  },
394
  {
395
- "cell_type": "code",
396
- "execution_count": null,
397
- "id": "b2b504da",
398
- "metadata": {},
399
- "outputs": [],
400
- "source": []
401
- },
402
- {
403
- "cell_type": "code",
404
- "execution_count": null,
405
- "id": "9cba7db1",
406
- "metadata": {},
407
- "outputs": [],
408
- "source": []
409
- },
410
- {
411
- "cell_type": "code",
412
- "execution_count": null,
413
- "id": "af3a477a",
414
  "metadata": {},
415
- "outputs": [],
416
- "source": []
 
417
  },
418
  {
419
  "cell_type": "code",
420
- "execution_count": null,
421
- "id": "44fdd7ee",
422
  "metadata": {},
423
- "outputs": [],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
424
  "source": [
425
- "%%time\n",
426
- "\n",
427
- "instruction = \"Which are the tags of the following article: 'A year ago, Russia invaded Ukraine in a major escalation of the Russo-Ukrainian War, which had begun in 2014. The invasion has resulted in thousands of deaths, and instigated Europe's largest refugee crisis since World War II.\"\n",
428
  "input_ctxt = None # For some tasks, you can provide an input context to help the model generate a better response.\n",
429
  "\n",
430
  "prompt = generate_prompt(instruction, input_ctxt)\n",
@@ -444,43 +347,35 @@
444
  ]
445
  },
446
  {
447
- "cell_type": "code",
448
- "execution_count": null,
449
- "id": "1f3a96aa",
450
  "metadata": {},
451
- "outputs": [],
452
  "source": [
453
- "%%time\n",
454
- "\n",
455
- "instruction = \"Translate the following text from English to Greek: 'My name is George. I am 22 years old and I live with my parents.'\"\n",
456
- "input_ctxt = None # For some tasks, you can provide an input context to help the model generate a better response.\n",
457
- "\n",
458
- "prompt = generate_prompt(instruction, input_ctxt)\n",
459
- "input_ids = tokenizer(prompt, return_tensors=\"pt\").input_ids\n",
460
- "input_ids = input_ids.to(model.device)\n",
461
- "\n",
462
- "with torch.no_grad():\n",
463
- " outputs = model.generate(\n",
464
- " input_ids=input_ids,\n",
465
- " generation_config=generation_config,\n",
466
- " return_dict_in_generate=True,\n",
467
- " output_scores=True,\n",
468
- " )\n",
469
- "\n",
470
- "response = tokenizer.decode(outputs.sequences[0], skip_special_tokens=True)\n",
471
- "print(response)"
472
  ]
473
  },
474
  {
475
  "cell_type": "code",
476
- "execution_count": null,
477
- "id": "b87f4120",
478
  "metadata": {},
479
- "outputs": [],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
480
  "source": [
481
- "%%time\n",
482
- "\n",
483
- "instruction = \"Ποιά είναι η πρωτεύουσα της Ελλάδας?\"\n",
484
  "input_ctxt = None # For some tasks, you can provide an input context to help the model generate a better response.\n",
485
  "\n",
486
  "prompt = generate_prompt(instruction, input_ctxt)\n",
@@ -500,111 +395,55 @@
500
  ]
501
  },
502
  {
503
- "cell_type": "code",
504
- "execution_count": null,
505
- "id": "520edf24",
506
- "metadata": {},
507
- "outputs": [],
508
- "source": []
509
- },
510
- {
511
- "cell_type": "code",
512
- "execution_count": null,
513
- "id": "a2fdfc6b",
514
  "metadata": {},
515
- "outputs": [],
516
  "source": [
517
- "%%time\n",
518
- "\n",
519
- "instruction = \"Translate the following text from Italian to English: 'Alla vigilia della sfida contro l'Inter, Luciano Spalletti risponde alle recenti parole del presidente De Laurentiis che ha messo in dubbio il suo futuro sulla panchina del Napoli.'\"\n",
520
- "input_ctxt = None # For some tasks, you can provide an input context to help the model generate a better response.\n",
521
- "\n",
522
- "prompt = generate_prompt(instruction, input_ctxt)\n",
523
- "input_ids = tokenizer(prompt, return_tensors=\"pt\").input_ids\n",
524
- "input_ids = input_ids.to(model.device)\n",
525
- "\n",
526
- "with torch.no_grad():\n",
527
- " outputs = model.generate(\n",
528
- " input_ids=input_ids,\n",
529
- " generation_config=generation_config,\n",
530
- " return_dict_in_generate=True,\n",
531
- " output_scores=True,\n",
532
- " )\n",
533
- "\n",
534
- "response = tokenizer.decode(outputs.sequences[0], skip_special_tokens=True)\n",
535
- "print(response)"
536
  ]
537
  },
538
  {
539
  "cell_type": "code",
540
- "execution_count": null,
541
- "id": "6b87cfde",
542
- "metadata": {
543
- "scrolled": true
544
- },
545
  "outputs": [],
546
  "source": [
547
- "%%time\n",
548
- "\n",
549
- "instruction = \"What is the capital city of Greece and with which countries does Greece border?\"\n",
550
- "input_ctxt = None # For some tasks, you can provide an input context to help the model generate a better response.\n",
551
- "\n",
552
- "prompt = generate_prompt(instruction, input_ctxt)\n",
553
- "input_ids = tokenizer(prompt, return_tensors=\"pt\").input_ids\n",
554
- "input_ids = input_ids.to(model.device)\n",
555
- "\n",
556
- "with torch.no_grad():\n",
557
- " outputs = model.generate(\n",
558
- " input_ids=input_ids,\n",
559
- " generation_config=generation_config,\n",
560
- " return_dict_in_generate=True,\n",
561
- " output_scores=True,\n",
562
- " )\n",
563
- "\n",
564
- "response = tokenizer.decode(outputs.sequences[0], skip_special_tokens=True)\n",
565
- "print(response)"
566
  ]
567
  },
568
  {
569
- "cell_type": "code",
570
- "execution_count": null,
571
- "id": "08f25326",
572
  "metadata": {},
573
- "outputs": [],
574
  "source": [
575
- "%%time\n",
576
- "\n",
577
- "instruction = \"I have two oranges and 3 apples. How many pieces of fruits I have in total?\"\n",
578
- "input_ctxt = \"Question Answering\" # For some tasks, you can provide an input context to help the model generate a better response.\n",
579
- "\n",
580
- "prompt = generate_prompt(instruction, input_ctxt)\n",
581
- "input_ids = tokenizer(prompt, return_tensors=\"pt\").input_ids\n",
582
- "input_ids = input_ids.to(model.device)\n",
583
- "\n",
584
- "with torch.no_grad():\n",
585
- " outputs = model.generate(\n",
586
- " input_ids=input_ids,\n",
587
- " generation_config=generation_config,\n",
588
- " return_dict_in_generate=True,\n",
589
- " output_scores=True,\n",
590
- " )\n",
591
- "\n",
592
- "response = tokenizer.decode(outputs.sequences[0], skip_special_tokens=True)\n",
593
- "print(response)"
594
  ]
595
  },
596
  {
597
  "cell_type": "code",
598
- "execution_count": null,
599
- "id": "218815c4",
600
- "metadata": {
601
- "scrolled": true
602
- },
603
- "outputs": [],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
604
  "source": [
605
- "%%time\n",
606
- "\n",
607
- "instruction = \"Which are the tags of the following article: 'Prozess in Winterthur: Handwerker (69) wegen uraltem Sex-Heftli vor Gericht. Ein 69-jähriger Handwerker stand in Winterthur vor Gericht, weil bei ihm ein 35 Jahre altes Heftchen mit explizitem Inhalt gefunden wurde. Die Anklage scheiterte. Die Polizei führte bei einem Winterthurer eine Hausdurchsuchung durch, nachdem US-Behörden den Schweizer Behörden einen Hinweis auf ein verbotenes pornografisches Bild gaben. Allerdings fand sich auf den elektronischen Geräten des Mannes nicht der kleinste Hinweis auf weitere Bilder oder Videos im Zusammenhang mit Kinderpornografie, Sex mit Tieren oder mit Gewaltdarstellungen. Das Strafverfahren wurde eingestellt. «Jung und froh mit nacktem Po». Aber: Bei der Hausdurchsuchung stellten die Beamten ein 35 Jahre altes Sexheftli des Orion-Verlags in den Lagerräumen des Handwerkers sicher, wie der «Tages-Anzeiger» berichtet. Das Heftchen «Jung und froh mit nacktem Po» enthielt auf mehr als zehn Seiten ganzseitige Fotos nackter Mädchen und Jungen im Alter von drei bis fünfzehn Jahren.'?\"\n",
608
  "input_ctxt = None # For some tasks, you can provide an input context to help the model generate a better response.\n",
609
  "\n",
610
  "prompt = generate_prompt(instruction, input_ctxt)\n",
@@ -624,44 +463,36 @@
624
  ]
625
  },
626
  {
627
- "cell_type": "code",
628
- "execution_count": null,
629
- "id": "4fdd7591",
630
  "metadata": {},
631
- "outputs": [],
632
  "source": [
633
- "%%time\n",
634
- "\n",
635
- "instruction = \"Which are the tags of the following article: 'For those now grappling with Alzheimer’s, lecanemab holds out the promise of slowing the disease’s progress. Are the modest benefits worth the risks? (C1)\\nAfter many decades of little or no progress in treating the dementia associated with Alzheimer’s, a new drug now offers hope to patients and caregivers. Lecanemab, announced late last month, was found in clinical trials to slow cognitive decline in early-stage Alzheimer’s patients. “It’s an extremely encouraging result,” says Dr. David Wolk, co-director of the University of Pennsylvania’s Penn Memory Center'?\"\n",
636
- "input_ctxt = \"Question Answering\" # For some tasks, you can provide an input context to help the model generate a better response.\n",
637
- "\n",
638
- "prompt = generate_prompt(instruction, input_ctxt)\n",
639
- "input_ids = tokenizer(prompt, return_tensors=\"pt\").input_ids\n",
640
- "input_ids = input_ids.to(model.device)\n",
641
- "\n",
642
- "with torch.no_grad():\n",
643
- " outputs = model.generate(\n",
644
- " input_ids=input_ids,\n",
645
- " generation_config=generation_config,\n",
646
- " return_dict_in_generate=True,\n",
647
- " output_scores=True,\n",
648
- " )\n",
649
- "\n",
650
- "response = tokenizer.decode(outputs.sequences[0], skip_special_tokens=True)\n",
651
- "print(response)"
652
  ]
653
  },
654
  {
655
  "cell_type": "code",
656
- "execution_count": null,
657
- "id": "0ff82833",
658
  "metadata": {},
659
- "outputs": [],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
660
  "source": [
661
- "%%time\n",
662
- "\n",
663
- "instruction = \"Which characteristic is least likely to be affected by an individual's environment? (A) height (B) weight (C) skin color (D) eye color\"\n",
664
- "input_ctxt = \"Tags\" # For some tasks, you can provide an input context to help the model generate a better response.\n",
665
  "\n",
666
  "prompt = generate_prompt(instruction, input_ctxt)\n",
667
  "input_ids = tokenizer(prompt, return_tensors=\"pt\").input_ids\n",
@@ -680,44 +511,42 @@
680
  ]
681
  },
682
  {
683
- "cell_type": "code",
684
- "execution_count": null,
685
- "id": "840e70c5",
686
  "metadata": {},
687
- "outputs": [],
688
  "source": [
689
- "%%time\n",
690
- "\n",
691
- "instruction = \"A student mixed some yellow sulfur powder with some iron filings. She was able to take the iron out of the sulfur by using a magnet. She then remixed the iron and sulfur in a test tube and heated it. After it cooled, she removed the substance from the test tube but could not separate the iron from the sulfur using the magnet. Which type of change occurred in the material when it was heated? (A) a physical change because the iron reacted with the sulfur (B) a chemical change because a new substance was formed (C) a physical change because a compound was formed (D) a chemical change because a magnet had to be used\"\n",
692
- "input_ctxt = None # For some tasks, you can provide an input context to help the model generate a better response.\n",
693
- "\n",
694
- "prompt = generate_prompt(instruction, input_ctxt)\n",
695
- "input_ids = tokenizer(prompt, return_tensors=\"pt\").input_ids\n",
696
- "input_ids = input_ids.to(model.device)\n",
697
- "\n",
698
- "with torch.no_grad():\n",
699
- " outputs = model.generate(\n",
700
- " input_ids=input_ids,\n",
701
- " generation_config=generation_config,\n",
702
- " return_dict_in_generate=True,\n",
703
- " output_scores=True,\n",
704
- " )\n",
705
- "\n",
706
- "response = tokenizer.decode(outputs.sequences[0], skip_special_tokens=True)\n",
707
- "print(response)"
708
  ]
709
  },
710
  {
711
  "cell_type": "code",
712
- "execution_count": null,
713
- "id": "54139a84",
714
  "metadata": {},
715
- "outputs": [],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
716
  "source": [
717
- "%%time\n",
718
- "\n",
719
- "instruction = \"Translate the following from English to Greek: 'My name is George. I am 22 years old and I live with my parents.'\"\n",
720
- "input_ctxt = \"Question Answering\" # For some tasks, you can provide an input context to help the model generate a better response.\n",
721
  "\n",
722
  "prompt = generate_prompt(instruction, input_ctxt)\n",
723
  "input_ids = tokenizer(prompt, return_tensors=\"pt\").input_ids\n",
@@ -736,43 +565,37 @@
736
  ]
737
  },
738
  {
739
- "cell_type": "code",
740
- "execution_count": null,
741
- "id": "c88de39f",
742
  "metadata": {},
743
- "outputs": [],
744
  "source": [
745
- "%%time\n",
746
- "\n",
747
- "instruction = \"Translate the following from English to Spanish: 'My name is George. I am 22 years old and I live with my parents.'\"\n",
748
- "input_ctxt = None # For some tasks, you can provide an input context to help the model generate a better response.\n",
749
- "\n",
750
- "prompt = generate_prompt(instruction, input_ctxt)\n",
751
- "input_ids = tokenizer(prompt, return_tensors=\"pt\").input_ids\n",
752
- "input_ids = input_ids.to(model.device)\n",
753
- "\n",
754
- "with torch.no_grad():\n",
755
- " outputs = model.generate(\n",
756
- " input_ids=input_ids,\n",
757
- " generation_config=generation_config,\n",
758
- " return_dict_in_generate=True,\n",
759
- " output_scores=True,\n",
760
- " )\n",
761
- "\n",
762
- "response = tokenizer.decode(outputs.sequences[0], skip_special_tokens=True)\n",
763
- "print(response)"
764
  ]
765
  },
766
  {
767
  "cell_type": "code",
768
- "execution_count": null,
769
- "id": "fbccda31",
770
  "metadata": {},
771
- "outputs": [],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
772
  "source": [
773
- "%%time\n",
774
- "\n",
775
- "instruction = \"Translate the following from English to Tagalog: 'I love you. How is your day? Have you eaten?'\"\n",
776
  "input_ctxt = None # For some tasks, you can provide an input context to help the model generate a better response.\n",
777
  "\n",
778
  "prompt = generate_prompt(instruction, input_ctxt)\n",
@@ -791,14 +614,6 @@
791
  "print(response)"
792
  ]
793
  },
794
- {
795
- "cell_type": "code",
796
- "execution_count": null,
797
- "id": "aa6e355b",
798
- "metadata": {},
799
- "outputs": [],
800
- "source": []
801
- },
802
  {
803
  "cell_type": "code",
804
  "execution_count": null,
 
1
  {
2
  "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "id": "2e6b851c",
6
+ "metadata": {},
7
+ "source": [
8
+ "## Import Packages"
9
+ ]
10
+ },
11
  {
12
  "cell_type": "code",
13
+ "execution_count": 1,
14
+ "id": "32d8be79",
15
+ "metadata": {},
16
+ "outputs": [
17
+ {
18
+ "name": "stderr",
19
+ "output_type": "stream",
20
+ "text": [
21
+ "2023-06-09 21:59:52.885485: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX2 AVX512F AVX512_VNNI FMA\n",
22
+ "To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.\n",
23
+ "2023-06-09 21:59:53.039141: I tensorflow/core/util/port.cc:104] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.\n",
24
+ "2023-06-09 21:59:53.827918: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/local/nvidia/lib:/usr/local/nvidia/lib64\n",
25
+ "2023-06-09 21:59:53.828006: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/local/nvidia/lib:/usr/local/nvidia/lib64\n",
26
+ "2023-06-09 21:59:53.828014: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.\n"
27
+ ]
28
+ },
29
+ {
30
+ "name": "stdout",
31
+ "output_type": "stream",
32
+ "text": [
33
+ "\n",
34
+ "===================================BUG REPORT===================================\n",
35
+ "Welcome to bitsandbytes. For bug reports, please run\n",
36
+ "\n",
37
+ "python -m bitsandbytes\n",
38
+ "\n",
39
+ " and submit this information together with your error trace to: https://github.com/TimDettmers/bitsandbytes/issues\n",
40
+ "================================================================================\n",
41
+ "bin /opt/conda/envs/media-reco-env-3-8/lib/python3.8/site-packages/bitsandbytes/libbitsandbytes_cuda113_nocublaslt.so\n",
42
+ "CUDA SETUP: CUDA runtime path found: /opt/conda/envs/media-reco-env-3-8/lib/libcudart.so\n",
43
+ "CUDA SETUP: Highest compute capability among GPUs detected: 7.0\n",
44
+ "CUDA SETUP: Detected CUDA version 113\n",
45
+ "CUDA SETUP: Loading binary /opt/conda/envs/media-reco-env-3-8/lib/python3.8/site-packages/bitsandbytes/libbitsandbytes_cuda113_nocublaslt.so...\n"
46
+ ]
47
+ },
48
+ {
49
+ "name": "stderr",
50
+ "output_type": "stream",
51
+ "text": [
52
+ "/opt/conda/envs/media-reco-env-3-8/lib/python3.8/site-packages/bitsandbytes/cuda_setup/main.py:149: UserWarning: Found duplicate ['libcudart.so', 'libcudart.so.11.0', 'libcudart.so.12.0'] files: {PosixPath('/opt/conda/envs/media-reco-env-3-8/lib/libcudart.so'), PosixPath('/opt/conda/envs/media-reco-env-3-8/lib/libcudart.so.11.0')}.. We'll flip a coin and try one of these, in order to fail forward.\n",
53
+ "Either way, this might cause trouble in the future:\n",
54
+ "If you get `CUDA error: invalid device function` errors, the above might be the cause and the solution is to make sure only one ['libcudart.so', 'libcudart.so.11.0', 'libcudart.so.12.0'] in the paths that we search based on your env.\n",
55
+ " warn(msg)\n",
56
+ "/opt/conda/envs/media-reco-env-3-8/lib/python3.8/site-packages/bitsandbytes/cuda_setup/main.py:149: UserWarning: WARNING: Compute capability < 7.5 detected! Only slow 8-bit matmul is supported for your GPU!\n",
57
+ " warn(msg)\n"
58
+ ]
59
+ }
60
+ ],
61
+ "source": [
62
+ "import os\n",
63
+ "os.chdir(\"..\")\n",
64
+ "\n",
65
+ "import torch\n",
66
+ "from transformers import GenerationConfig, LlamaTokenizer, LlamaForCausalLM\n",
67
+ "from peft import PeftModel, PeftConfig"
68
+ ]
69
+ },
70
+ {
71
+ "cell_type": "markdown",
72
+ "id": "76b3d3ff",
73
+ "metadata": {},
74
+ "source": [
75
+ "## Utilities"
76
+ ]
77
+ },
78
+ {
79
+ "cell_type": "code",
80
+ "execution_count": 2,
81
  "id": "9837afb7",
82
  "metadata": {},
83
  "outputs": [],
 
102
  "### Response:\"\"\""
103
  ]
104
  },
105
+ {
106
+ "cell_type": "markdown",
107
+ "id": "0d3b0d75",
108
+ "metadata": {},
109
+ "source": [
110
+ "## Configs"
111
+ ]
112
+ },
113
+ {
114
+ "cell_type": "code",
115
+ "execution_count": 3,
116
+ "id": "fb3cba34",
117
+ "metadata": {},
118
+ "outputs": [],
119
+ "source": [
120
+ "MODEL_NAME = \".\"\n",
121
+ "BASE_MODEL = \"decapoda-research/llama-7b-hf\"\n",
122
+ "LOAD_FINETUNED = False"
123
+ ]
124
+ },
125
+ {
126
+ "cell_type": "markdown",
127
+ "id": "8dc85b3d",
128
+ "metadata": {},
129
+ "source": [
130
+ "## Load Model & Tokenizer"
131
+ ]
132
+ },
133
  {
134
  "cell_type": "code",
135
  "execution_count": 4,
 
146
  {
147
  "data": {
148
  "application/vnd.jupyter.widget-view+json": {
149
+ "model_id": "f11486f431fd48799d91ef69e586e410",
150
  "version_major": 2,
151
  "version_minor": 0
152
  },
 
156
  },
157
  "metadata": {},
158
  "output_type": "display_data"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
159
  }
160
  ],
161
  "source": [
 
 
 
 
 
 
 
 
 
 
 
162
  "config = PeftConfig.from_pretrained(MODEL_NAME)\n",
163
  "\n",
164
  "tokenizer = LlamaTokenizer.from_pretrained(MODEL_NAME)\n",
 
169
  " torch_dtype=torch.float16,\n",
170
  " device_map=\"auto\",\n",
171
  ")\n",
172
+ " \n",
173
+ "# model.eval()\n",
174
+ "# if torch.__version__ >= \"2\":\n",
175
+ "# model = torch.compile(model)"
176
  ]
177
  },
178
  {
179
+ "cell_type": "markdown",
180
+ "id": "3bb51813",
 
181
  "metadata": {},
 
182
  "source": [
183
+ "## Generation Examples"
 
 
184
  ]
185
  },
186
  {
187
  "cell_type": "code",
188
+ "execution_count": 5,
189
  "id": "10372ae3",
190
  "metadata": {},
191
  "outputs": [],
 
200
  ")"
201
  ]
202
  },
203
+ {
204
+ "cell_type": "markdown",
205
+ "id": "153062cf",
206
+ "metadata": {},
207
+ "source": [
208
+ "### Example 1"
209
+ ]
210
+ },
211
  {
212
  "cell_type": "code",
213
+ "execution_count": 6,
214
  "id": "a84a4f9e",
215
  "metadata": {},
216
+ "outputs": [
217
+ {
218
+ "name": "stdout",
219
+ "output_type": "stream",
220
+ "text": [
221
+ "Below is an instruction that describes a task. Write a response that appropriately completes the request.\n",
222
+ "\n",
223
+ "### Instruction:\n",
224
+ "I have two pieces of apples and 3 pieces of oranges. How many pieces of fruits do I have?\n",
225
+ "\n",
226
+ "### Response:\n",
227
+ "I have two pieces of apples and 3 pieces of oranges. How many pieces of fruits do I have?\n",
228
+ "I have two pieces of\n"
229
+ ]
230
+ }
231
+ ],
232
  "source": [
233
  "instruction = \"I have two pieces of apples and 3 pieces of oranges. How many pieces of fruits do I have?\"\n",
234
  "input_ctxt = None # For some tasks, you can provide an input context to help the model generate a better response.\n",
 
250
  ]
251
  },
252
  {
253
+ "cell_type": "markdown",
254
+ "id": "a4642cdb",
 
255
  "metadata": {},
 
256
  "source": [
257
+ "### Example 2"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
258
  ]
259
  },
260
  {
261
  "cell_type": "code",
262
+ "execution_count": 7,
263
+ "id": "65117ac7",
264
  "metadata": {},
265
+ "outputs": [
266
+ {
267
+ "name": "stdout",
268
+ "output_type": "stream",
269
+ "text": [
270
+ "Below is an instruction that describes a task. Write a response that appropriately completes the request.\n",
271
+ "\n",
272
+ "### Instruction:\n",
273
+ "What is the capital city of Greece and with which countries does Greece border?\n",
274
+ "\n",
275
+ "### Response:\n",
276
+ "The capital city of Greece is Athens and it borders Turkey, Bulgaria, Macedonia, Albania, and the Aegean Sea.\n",
277
+ "\n"
278
+ ]
279
+ }
280
+ ],
281
  "source": [
282
+ "instruction = \"What is the capital city of Greece and with which countries does Greece border?\"\n",
283
  "input_ctxt = None # For some tasks, you can provide an input context to help the model generate a better response.\n",
284
  "\n",
285
  "prompt = generate_prompt(instruction, input_ctxt)\n",
 
299
  ]
300
  },
301
  {
302
+ "cell_type": "markdown",
303
+ "id": "79fc59d2",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
304
  "metadata": {},
305
+ "source": [
306
+ "### Example 3"
307
+ ]
308
  },
309
  {
310
  "cell_type": "code",
311
+ "execution_count": 8,
312
+ "id": "2ff7a5e5",
313
  "metadata": {},
314
+ "outputs": [
315
+ {
316
+ "name": "stdout",
317
+ "output_type": "stream",
318
+ "text": [
319
+ "Below is an instruction that describes a task. Write a response that appropriately completes the request.\n",
320
+ "\n",
321
+ "### Instruction:\n",
322
+ "How can I cook Adobo?\n",
323
+ "\n",
324
+ "### Response:\n",
325
+ "You can cook Adobo by adding garlic, soy sauce, vinegar, bay leaves, peppercorns, and water\n"
326
+ ]
327
+ }
328
+ ],
329
  "source": [
330
+ "instruction = \"How can I cook Adobo?\"\n",
 
 
331
  "input_ctxt = None # For some tasks, you can provide an input context to help the model generate a better response.\n",
332
  "\n",
333
  "prompt = generate_prompt(instruction, input_ctxt)\n",
 
347
  ]
348
  },
349
  {
350
+ "cell_type": "markdown",
351
+ "id": "3080312d",
 
352
  "metadata": {},
 
353
  "source": [
354
+ "### Example 4"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
355
  ]
356
  },
357
  {
358
  "cell_type": "code",
359
+ "execution_count": 9,
360
+ "id": "b0e4b6f5",
361
  "metadata": {},
362
+ "outputs": [
363
+ {
364
+ "name": "stdout",
365
+ "output_type": "stream",
366
+ "text": [
367
+ "Below is an instruction that describes a task. Write a response that appropriately completes the request.\n",
368
+ "\n",
369
+ "### Instruction:\n",
370
+ "Which are the tags of the following article: 'A year ago, Russia invaded Ukraine in a major escalation of the Russo-Ukrainian War, which had begun in 2014. The invasion has resulted in thousands of deaths, and instigated Europe's largest refugee crisis since World War II.'?\n",
371
+ "\n",
372
+ "### Response:\n",
373
+ "The tags of the following article: 'A year ago, Russia invaded Ukraine in a major escalation of the Russo-Ukrainian\n"
374
+ ]
375
+ }
376
+ ],
377
  "source": [
378
+ "instruction = \"Which are the tags of the following article: 'A year ago, Russia invaded Ukraine in a major escalation of the Russo-Ukrainian War, which had begun in 2014. The invasion has resulted in thousands of deaths, and instigated Europe's largest refugee crisis since World War II.'?\"\n",
 
 
379
  "input_ctxt = None # For some tasks, you can provide an input context to help the model generate a better response.\n",
380
  "\n",
381
  "prompt = generate_prompt(instruction, input_ctxt)\n",
 
395
  ]
396
  },
397
  {
398
+ "cell_type": "markdown",
399
+ "id": "c6c7a56b",
 
 
 
 
 
 
 
 
 
400
  "metadata": {},
 
401
  "source": [
402
+ "## Let's Load the Fine-Tuned version"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
403
  ]
404
  },
405
  {
406
  "cell_type": "code",
407
+ "execution_count": 10,
408
+ "id": "9cba7db1",
409
+ "metadata": {},
 
 
410
  "outputs": [],
411
  "source": [
412
+ "model = PeftModel.from_pretrained(model, MODEL_NAME)"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
413
  ]
414
  },
415
  {
416
+ "cell_type": "markdown",
417
+ "id": "5d664394",
 
418
  "metadata": {},
 
419
  "source": [
420
+ "### Example 1"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
421
  ]
422
  },
423
  {
424
  "cell_type": "code",
425
+ "execution_count": 11,
426
+ "id": "af3a477a",
427
+ "metadata": {},
428
+ "outputs": [
429
+ {
430
+ "name": "stdout",
431
+ "output_type": "stream",
432
+ "text": [
433
+ "Below is an instruction that describes a task. Write a response that appropriately completes the request.\n",
434
+ "\n",
435
+ "### Instruction:\n",
436
+ "I have two pieces of apples and 3 pieces of oranges. How many pieces of fruits do I have?\n",
437
+ "\n",
438
+ "### Response:\n",
439
+ "If you have 2 pieces of apples and 3 pieces of oranges, then you have 5 pieces of fruits.\n",
440
+ "\n",
441
+ "###\n"
442
+ ]
443
+ }
444
+ ],
445
  "source": [
446
+ "instruction = \"I have two pieces of apples and 3 pieces of oranges. How many pieces of fruits do I have?\"\n",
 
 
447
  "input_ctxt = None # For some tasks, you can provide an input context to help the model generate a better response.\n",
448
  "\n",
449
  "prompt = generate_prompt(instruction, input_ctxt)\n",
 
463
  ]
464
  },
465
  {
466
+ "cell_type": "markdown",
467
+ "id": "a07d76da",
 
468
  "metadata": {},
 
469
  "source": [
470
+ "### Example 2"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
471
  ]
472
  },
473
  {
474
  "cell_type": "code",
475
+ "execution_count": 12,
476
+ "id": "5f59b3f4",
477
  "metadata": {},
478
+ "outputs": [
479
+ {
480
+ "name": "stdout",
481
+ "output_type": "stream",
482
+ "text": [
483
+ "Below is an instruction that describes a task. Write a response that appropriately completes the request.\n",
484
+ "\n",
485
+ "### Instruction:\n",
486
+ "What is the capital city of Greece and with which countries does Greece border?\n",
487
+ "\n",
488
+ "### Response:\n",
489
+ "Greece borders Albania, Bulgaria, Turkey, Macedonia, and the Aegean Sea. The capital of Greece is Athens.\n"
490
+ ]
491
+ }
492
+ ],
493
  "source": [
494
+ "instruction = \"What is the capital city of Greece and with which countries does Greece border?\"\n",
495
+ "input_ctxt = None # For some tasks, you can provide an input context to help the model generate a better response.\n",
 
 
496
  "\n",
497
  "prompt = generate_prompt(instruction, input_ctxt)\n",
498
  "input_ids = tokenizer(prompt, return_tensors=\"pt\").input_ids\n",
 
511
  ]
512
  },
513
  {
514
+ "cell_type": "markdown",
515
+ "id": "ecdb6550",
 
516
  "metadata": {},
 
517
  "source": [
518
+ "### Example 3"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
519
  ]
520
  },
521
  {
522
  "cell_type": "code",
523
+ "execution_count": 13,
524
+ "id": "5ac57290",
525
  "metadata": {},
526
+ "outputs": [
527
+ {
528
+ "name": "stdout",
529
+ "output_type": "stream",
530
+ "text": [
531
+ "Below is an instruction that describes a task. Write a response that appropriately completes the request.\n",
532
+ "\n",
533
+ "### Instruction:\n",
534
+ "How can I cook Adobo?\n",
535
+ "\n",
536
+ "### Response:\n",
537
+ "Here's a recipe for adobo:\n",
538
+ "\n",
539
+ "\\begin{code}\n",
540
+ "\n",
541
+ "\\begin{pre}\n",
542
+ "\n",
543
+ "\\end{code\n"
544
+ ]
545
+ }
546
+ ],
547
  "source": [
548
+ "instruction = \"How can I cook Adobo?\"\n",
549
+ "input_ctxt = None # For some tasks, you can provide an input context to help the model generate a better response.\n",
 
 
550
  "\n",
551
  "prompt = generate_prompt(instruction, input_ctxt)\n",
552
  "input_ids = tokenizer(prompt, return_tensors=\"pt\").input_ids\n",
 
565
  ]
566
  },
567
  {
568
+ "cell_type": "markdown",
569
+ "id": "00859e35",
 
570
  "metadata": {},
 
571
  "source": [
572
+ "### Example 4"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
573
  ]
574
  },
575
  {
576
  "cell_type": "code",
577
+ "execution_count": 14,
578
+ "id": "801165b6",
579
  "metadata": {},
580
+ "outputs": [
581
+ {
582
+ "name": "stdout",
583
+ "output_type": "stream",
584
+ "text": [
585
+ "Below is an instruction that describes a task. Write a response that appropriately completes the request.\n",
586
+ "\n",
587
+ "### Instruction:\n",
588
+ "Which are the tags of the following article: 'A year ago, Russia invaded Ukraine in a major escalation of the Russo-Ukrainian War, which had begun in 2014. The invasion has resulted in thousands of deaths, and instigated Europe's largest refugee crisis since World War II.'?\n",
589
+ "\n",
590
+ "### Response:\n",
591
+ "\n",
592
+ "### Instruction:\n",
593
+ "Which are the tags of the following article: 'A year ago, Russia invaded Ukraine in a major escal\n"
594
+ ]
595
+ }
596
+ ],
597
  "source": [
598
+ "instruction = \"Which are the tags of the following article: 'A year ago, Russia invaded Ukraine in a major escalation of the Russo-Ukrainian War, which had begun in 2014. The invasion has resulted in thousands of deaths, and instigated Europe's largest refugee crisis since World War II.'?\"\n",
 
 
599
  "input_ctxt = None # For some tasks, you can provide an input context to help the model generate a better response.\n",
600
  "\n",
601
  "prompt = generate_prompt(instruction, input_ctxt)\n",
 
614
  "print(response)"
615
  ]
616
  },
 
 
 
 
 
 
 
 
617
  {
618
  "cell_type": "code",
619
  "execution_count": null,