hemantn commited on
Commit
bd0d9fa
·
1 Parent(s): 88ddbb1

updated notebook with updated adapter code

Browse files
Files changed (1) hide show
  1. test_ablang2_HF_implementation.ipynb +397 -35
test_ablang2_HF_implementation.ipynb CHANGED
@@ -11,6 +11,16 @@
11
  {
12
  "cell_type": "code",
13
  "execution_count": 1,
 
 
 
 
 
 
 
 
 
 
14
  "id": "7ae54cd0-6253-46dd-a316-4f20b12041e0",
15
  "metadata": {},
16
  "outputs": [],
@@ -40,7 +50,7 @@
40
  },
41
  {
42
  "cell_type": "code",
43
- "execution_count": 2,
44
  "id": "99192978-a008-4a32-a80e-bba238e0ec7c",
45
  "metadata": {},
46
  "outputs": [],
@@ -82,14 +92,14 @@
82
  },
83
  {
84
  "cell_type": "code",
85
- "execution_count": 3,
86
  "id": "6d66ad84",
87
  "metadata": {},
88
  "outputs": [
89
  {
90
  "data": {
91
  "application/vnd.jupyter.widget-view+json": {
92
- "model_id": "a5acedae3cc4420ea2971400b0915426",
93
  "version_major": 2,
94
  "version_minor": 0
95
  },
@@ -103,7 +113,7 @@
103
  {
104
  "data": {
105
  "application/vnd.jupyter.widget-view+json": {
106
- "model_id": "5727addb151447cf9bb091ef1159717c",
107
  "version_major": 2,
108
  "version_minor": 0
109
  },
@@ -126,7 +136,7 @@
126
  {
127
  "data": {
128
  "application/vnd.jupyter.widget-view+json": {
129
- "model_id": "845b45d4aed542dc86ab7b7ac3305a0e",
130
  "version_major": 2,
131
  "version_minor": 0
132
  },
@@ -141,22 +151,108 @@
141
  "name": "stderr",
142
  "output_type": "stream",
143
  "text": [
144
- "Encountered exception while importing ablang2: No module named 'ablang2'\n"
 
 
 
 
145
  ]
146
  },
147
  {
148
- "ename": "ImportError",
149
- "evalue": "This modeling file requires the following packages that were not found in your environment: ablang2. Run `pip install ablang2`",
150
- "output_type": "error",
151
- "traceback": [
152
- "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
153
- "\u001b[0;31mImportError\u001b[0m Traceback (most recent call last)",
154
- "Cell \u001b[0;32mIn[3], line 2\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;66;03m# Load model and tokenizer from Hugging Face Hub\u001b[39;00m\n\u001b[0;32m----> 2\u001b[0m model \u001b[38;5;241m=\u001b[39m \u001b[43mAutoModel\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mfrom_pretrained\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mhemantn/ablang2\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mtrust_remote_code\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mTrue\u001b[39;49;00m\u001b[43m)\u001b[49m\n\u001b[1;32m 3\u001b[0m tokenizer \u001b[38;5;241m=\u001b[39m AutoTokenizer\u001b[38;5;241m.\u001b[39mfrom_pretrained(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mhemantn/ablang2\u001b[39m\u001b[38;5;124m\"\u001b[39m, trust_remote_code\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mTrue\u001b[39;00m)\n\u001b[1;32m 5\u001b[0m \u001b[38;5;66;03m# Find the cached model directory and import adapter\u001b[39;00m\n",
155
- "File \u001b[0;32m~/.conda/envs/lib_transformer/lib/python3.10/site-packages/transformers/models/auto/auto_factory.py:582\u001b[0m, in \u001b[0;36m_BaseAutoModelClass.from_pretrained\u001b[0;34m(cls, pretrained_model_name_or_path, *model_args, **kwargs)\u001b[0m\n\u001b[1;32m 579\u001b[0m kwargs[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124madapter_kwargs\u001b[39m\u001b[38;5;124m\"\u001b[39m] \u001b[38;5;241m=\u001b[39m adapter_kwargs\n\u001b[1;32m 581\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m has_remote_code \u001b[38;5;129;01mand\u001b[39;00m trust_remote_code:\n\u001b[0;32m--> 582\u001b[0m model_class \u001b[38;5;241m=\u001b[39m \u001b[43mget_class_from_dynamic_module\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 583\u001b[0m \u001b[43m \u001b[49m\u001b[43mclass_ref\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpretrained_model_name_or_path\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcode_revision\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcode_revision\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mhub_kwargs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\n\u001b[1;32m 584\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 585\u001b[0m _ \u001b[38;5;241m=\u001b[39m hub_kwargs\u001b[38;5;241m.\u001b[39mpop(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcode_revision\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;28;01mNone\u001b[39;00m)\n\u001b[1;32m 586\u001b[0m \u001b[38;5;66;03m# This block handles the case where the user is loading a model with `trust_remote_code=True`\u001b[39;00m\n\u001b[1;32m 587\u001b[0m \u001b[38;5;66;03m# but a library model exists with the same name. We don't want to override the autoclass\u001b[39;00m\n\u001b[1;32m 588\u001b[0m \u001b[38;5;66;03m# mappings in this case, or all future loads of that model will be the remote code model.\u001b[39;00m\n",
156
- "File \u001b[0;32m~/.conda/envs/lib_transformer/lib/python3.10/site-packages/transformers/dynamic_module_utils.py:570\u001b[0m, in \u001b[0;36mget_class_from_dynamic_module\u001b[0;34m(class_reference, pretrained_model_name_or_path, cache_dir, force_download, resume_download, proxies, token, revision, local_files_only, repo_type, code_revision, **kwargs)\u001b[0m\n\u001b[1;32m 568\u001b[0m code_revision \u001b[38;5;241m=\u001b[39m revision\n\u001b[1;32m 569\u001b[0m \u001b[38;5;66;03m# And lastly we get the class inside our newly created module\u001b[39;00m\n\u001b[0;32m--> 570\u001b[0m final_module \u001b[38;5;241m=\u001b[39m \u001b[43mget_cached_module_file\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 571\u001b[0m \u001b[43m \u001b[49m\u001b[43mrepo_id\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 572\u001b[0m \u001b[43m \u001b[49m\u001b[43mmodule_file\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m+\u001b[39;49m\u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43m.py\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[1;32m 573\u001b[0m \u001b[43m \u001b[49m\u001b[43mcache_dir\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcache_dir\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 574\u001b[0m \u001b[43m \u001b[49m\u001b[43mforce_download\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mforce_download\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 575\u001b[0m \u001b[43m \u001b[49m\u001b[43mresume_download\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mresume_download\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 576\u001b[0m \u001b[43m \u001b[49m\u001b[43mproxies\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mproxies\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 577\u001b[0m \u001b[43m \u001b[49m\u001b[43mtoken\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtoken\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 578\u001b[0m \u001b[43m \u001b[49m\u001b[43mrevision\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcode_revision\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 579\u001b[0m \u001b[43m \u001b[49m\u001b[43mlocal_files_only\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mlocal_files_only\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 580\u001b[0m \u001b[43m \u001b[49m\u001b[43mrepo_type\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrepo_type\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 581\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 582\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m get_class_in_module(class_name, final_module, force_reload\u001b[38;5;241m=\u001b[39mforce_download)\n",
157
- "File \u001b[0;32m~/.conda/envs/lib_transformer/lib/python3.10/site-packages/transformers/dynamic_module_utils.py:393\u001b[0m, in \u001b[0;36mget_cached_module_file\u001b[0;34m(pretrained_model_name_or_path, module_file, cache_dir, force_download, resume_download, proxies, token, revision, local_files_only, repo_type, _commit_hash, **deprecated_kwargs)\u001b[0m\n\u001b[1;32m 390\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m\n\u001b[1;32m 392\u001b[0m \u001b[38;5;66;03m# Check we have all the requirements in our environment\u001b[39;00m\n\u001b[0;32m--> 393\u001b[0m modules_needed \u001b[38;5;241m=\u001b[39m \u001b[43mcheck_imports\u001b[49m\u001b[43m(\u001b[49m\u001b[43mresolved_module_file\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 395\u001b[0m \u001b[38;5;66;03m# Now we move the module inside our cached dynamic modules.\u001b[39;00m\n\u001b[1;32m 396\u001b[0m full_submodule \u001b[38;5;241m=\u001b[39m TRANSFORMERS_DYNAMIC_MODULE_NAME \u001b[38;5;241m+\u001b[39m os\u001b[38;5;241m.\u001b[39mpath\u001b[38;5;241m.\u001b[39msep \u001b[38;5;241m+\u001b[39m submodule\n",
158
- "File \u001b[0;32m~/.conda/envs/lib_transformer/lib/python3.10/site-packages/transformers/dynamic_module_utils.py:225\u001b[0m, in \u001b[0;36mcheck_imports\u001b[0;34m(filename)\u001b[0m\n\u001b[1;32m 222\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m\n\u001b[1;32m 224\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mlen\u001b[39m(missing_packages) \u001b[38;5;241m>\u001b[39m \u001b[38;5;241m0\u001b[39m:\n\u001b[0;32m--> 225\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mImportError\u001b[39;00m(\n\u001b[1;32m 226\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mThis modeling file requires the following packages that were not found in your environment: \u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 227\u001b[0m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;132;01m{\u001b[39;00m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m, \u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;241m.\u001b[39mjoin(missing_packages)\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m. Run `pip install \u001b[39m\u001b[38;5;132;01m{\u001b[39;00m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m \u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;241m.\u001b[39mjoin(missing_packages)\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m`\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 228\u001b[0m )\n\u001b[1;32m 230\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m get_relative_imports(filename)\n",
159
- "\u001b[0;31mImportError\u001b[0m: This modeling file requires the following packages that were not found in your environment: ablang2. Run `pip install ablang2`"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
160
  ]
161
  }
162
  ],
@@ -205,7 +301,7 @@
205
  },
206
  {
207
  "cell_type": "code",
208
- "execution_count": null,
209
  "id": "ceae4a88-0679-4704-8bad-c06a4569c497",
210
  "metadata": {},
211
  "outputs": [],
@@ -230,10 +326,30 @@
230
  },
231
  {
232
  "cell_type": "code",
233
- "execution_count": null,
234
  "id": "d22f4302-1262-4cc1-8a1c-a36daa8c710c",
235
  "metadata": {},
236
- "outputs": [],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
237
  "source": [
238
  "ablang(all_seqs, mode='seqcoding')\n"
239
  ]
@@ -254,10 +370,85 @@
254
  },
255
  {
256
  "cell_type": "code",
257
- "execution_count": null,
258
  "id": "6227f661-575f-4b1e-9646-cfba7b10c3b4",
259
  "metadata": {},
260
- "outputs": [],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
261
  "source": [
262
  "ablang(all_seqs, mode='rescoding', stepwise_masking = False)"
263
  ]
@@ -278,10 +469,80 @@
278
  },
279
  {
280
  "cell_type": "code",
281
- "execution_count": null,
282
  "id": "e4bc0cb1-f5b0-4255-9e93-d643ae1396df",
283
  "metadata": {},
284
- "outputs": [],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
285
  "source": [
286
  "results = ablang(only_both_chains_seqs, mode='likelihood', align=True)\n",
287
  "\n",
@@ -292,10 +553,60 @@
292
  },
293
  {
294
  "cell_type": "code",
295
- "execution_count": null,
296
  "id": "56be8cad",
297
  "metadata": {},
298
- "outputs": [],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
299
  "source": [
300
  "ablang(only_both_chains_seqs, mode='probability')"
301
  ]
@@ -320,10 +631,21 @@
320
  },
321
  {
322
  "cell_type": "code",
323
- "execution_count": null,
324
  "id": "83f3064b-48a7-42fb-ba82-ec153ea946da",
325
  "metadata": {},
326
- "outputs": [],
 
 
 
 
 
 
 
 
 
 
 
327
  "source": [
328
  "results = ablang(all_seqs, mode='pseudo_log_likelihood')\n",
329
  "np.exp(-results) # convert to pseudo perplexity"
@@ -331,10 +653,22 @@
331
  },
332
  {
333
  "cell_type": "code",
334
- "execution_count": null,
335
  "id": "42cc8b34-5ae9-4857-93fe-a438a0f2a868",
336
  "metadata": {},
337
- "outputs": [],
 
 
 
 
 
 
 
 
 
 
 
 
338
  "source": [
339
  "results = ablang(all_seqs, mode='confidence')\n",
340
  "np.exp(-results)"
@@ -352,10 +686,24 @@
352
  },
353
  {
354
  "cell_type": "code",
355
- "execution_count": null,
356
  "id": "2d5b725c-4eac-4a4b-9331-357c3ac140f7",
357
  "metadata": {},
358
- "outputs": [],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
359
  "source": [
360
  "restored = ablang(only_both_chains_seqs, mode='restore')\n",
361
  "restored"
@@ -363,10 +711,24 @@
363
  },
364
  {
365
  "cell_type": "code",
366
- "execution_count": null,
367
  "id": "0e9615f7-c490-4947-96f4-7617266c686e",
368
  "metadata": {},
369
- "outputs": [],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
370
  "source": [
371
  "restored = ablang(only_both_chains_seqs, mode='restore', align = True)\n",
372
  "restored"
 
11
  {
12
  "cell_type": "code",
13
  "execution_count": 1,
14
+ "id": "a51e7ed2",
15
+ "metadata": {},
16
+ "outputs": [],
17
+ "source": [
18
+ "!rm -rf ~/.cache/huggingface/hub/models--hemantn--ablang2"
19
+ ]
20
+ },
21
+ {
22
+ "cell_type": "code",
23
+ "execution_count": 2,
24
  "id": "7ae54cd0-6253-46dd-a316-4f20b12041e0",
25
  "metadata": {},
26
  "outputs": [],
 
50
  },
51
  {
52
  "cell_type": "code",
53
+ "execution_count": 3,
54
  "id": "99192978-a008-4a32-a80e-bba238e0ec7c",
55
  "metadata": {},
56
  "outputs": [],
 
92
  },
93
  {
94
  "cell_type": "code",
95
+ "execution_count": 4,
96
  "id": "6d66ad84",
97
  "metadata": {},
98
  "outputs": [
99
  {
100
  "data": {
101
  "application/vnd.jupyter.widget-view+json": {
102
+ "model_id": "faac2d2a21ea4775b88db5f4af82a16a",
103
  "version_major": 2,
104
  "version_minor": 0
105
  },
 
113
  {
114
  "data": {
115
  "application/vnd.jupyter.widget-view+json": {
116
+ "model_id": "6b4ea4ff07cb443cb4a6ac72e23faab9",
117
  "version_major": 2,
118
  "version_minor": 0
119
  },
 
136
  {
137
  "data": {
138
  "application/vnd.jupyter.widget-view+json": {
139
+ "model_id": "23a70f36648e4242bb32595ab85a7c36",
140
  "version_major": 2,
141
  "version_minor": 0
142
  },
 
151
  "name": "stderr",
152
  "output_type": "stream",
153
  "text": [
154
+ "A new version of the following files was downloaded from https://huggingface.co/hemantn/ablang2:\n",
155
+ "- modeling_ablang2paired.py\n",
156
+ ". Make sure to double-check they do not contain any added malicious code. To avoid downloading new versions of the code file, you can pin a revision.\n",
157
+ "/home/hn533621/.conda/envs/lib_transformer/lib/python3.10/site-packages/huggingface_hub/file_download.py:943: FutureWarning: `resume_download` is deprecated and will be removed in version 1.0.0. Downloads always resume when possible. If you want to force a new download, use `force_download=True`.\n",
158
+ " warnings.warn(\n"
159
  ]
160
  },
161
  {
162
+ "data": {
163
+ "application/vnd.jupyter.widget-view+json": {
164
+ "model_id": "15d6e81710c342d783f3a22117dbda0e",
165
+ "version_major": 2,
166
+ "version_minor": 0
167
+ },
168
+ "text/plain": [
169
+ "model.pt: 0%| | 0.00/179M [00:00<?, ?B/s]"
170
+ ]
171
+ },
172
+ "metadata": {},
173
+ "output_type": "display_data"
174
+ },
175
+ {
176
+ "name": "stdout",
177
+ "output_type": "stream",
178
+ "text": [
179
+ "✅ Loaded custom weights from: /home/hn533621/.cache/huggingface/hub/models--hemantn--ablang2/snapshots/88ddbb1fcb11297c3fd439b83500743e6adc25c0/model.pt\n"
180
+ ]
181
+ },
182
+ {
183
+ "data": {
184
+ "application/vnd.jupyter.widget-view+json": {
185
+ "model_id": "6e2ce5f42c0a43028468ee2f24bd66c2",
186
+ "version_major": 2,
187
+ "version_minor": 0
188
+ },
189
+ "text/plain": [
190
+ "tokenizer_ablang2paired.py: 0.00B [00:00, ?B/s]"
191
+ ]
192
+ },
193
+ "metadata": {},
194
+ "output_type": "display_data"
195
+ },
196
+ {
197
+ "name": "stderr",
198
+ "output_type": "stream",
199
+ "text": [
200
+ "A new version of the following files was downloaded from https://huggingface.co/hemantn/ablang2:\n",
201
+ "- tokenizer_ablang2paired.py\n",
202
+ ". Make sure to double-check they do not contain any added malicious code. To avoid downloading new versions of the code file, you can pin a revision.\n"
203
+ ]
204
+ },
205
+ {
206
+ "data": {
207
+ "application/vnd.jupyter.widget-view+json": {
208
+ "model_id": "f0474902d8bb4ca0afa50c475b90769e",
209
+ "version_major": 2,
210
+ "version_minor": 0
211
+ },
212
+ "text/plain": [
213
+ "vocab.json: 0%| | 0.00/331 [00:00<?, ?B/s]"
214
+ ]
215
+ },
216
+ "metadata": {},
217
+ "output_type": "display_data"
218
+ },
219
+ {
220
+ "data": {
221
+ "application/vnd.jupyter.widget-view+json": {
222
+ "model_id": "1d767519b798472f8500ba43872651ef",
223
+ "version_major": 2,
224
+ "version_minor": 0
225
+ },
226
+ "text/plain": [
227
+ "adapter.py: 0.00B [00:00, ?B/s]"
228
+ ]
229
+ },
230
+ "metadata": {},
231
+ "output_type": "display_data"
232
+ },
233
+ {
234
+ "name": "stdout",
235
+ "output_type": "stream",
236
+ "text": [
237
+ "✅ Copied restoration.py to current directory\n",
238
+ "✅ Copied ablang_encodings.py to current directory\n",
239
+ "✅ Copied alignment.py to current directory\n",
240
+ "✅ Copied scores.py to current directory\n",
241
+ "✅ Copied extra_utils.py to current directory\n",
242
+ "✅ Copied ablang.py to current directory\n",
243
+ "✅ Copied encoderblock.py to current directory\n",
244
+ "📁 Files in current directory (/home/hn533621/.cache/huggingface/hub/models--hemantn--ablang2/snapshots/88ddbb1fcb11297c3fd439b83500743e6adc25c0):\n",
245
+ " ablang.py\n",
246
+ " scores.py\n",
247
+ " extra_utils.py\n",
248
+ " ablang_encodings.py\n",
249
+ " encoderblock.py\n",
250
+ " modeling_ablang2paired.py\n",
251
+ " adapter.py\n",
252
+ " tokenizer_ablang2paired.py\n",
253
+ " restoration.py\n",
254
+ " alignment.py\n",
255
+ " configuration_ablang2paired.py\n"
256
  ]
257
  }
258
  ],
 
301
  },
302
  {
303
  "cell_type": "code",
304
+ "execution_count": 5,
305
  "id": "ceae4a88-0679-4704-8bad-c06a4569c497",
306
  "metadata": {},
307
  "outputs": [],
 
326
  },
327
  {
328
  "cell_type": "code",
329
+ "execution_count": 6,
330
  "id": "d22f4302-1262-4cc1-8a1c-a36daa8c710c",
331
  "metadata": {},
332
+ "outputs": [
333
+ {
334
+ "data": {
335
+ "text/plain": [
336
+ "array([[-0.25206311, 0.18189634, 0.00887137, ..., 0.15365517,\n",
337
+ " -0.14508603, -0.13381317],\n",
338
+ " [-0.25149415, 0.2086455 , 0.07518203, ..., 0.19478269,\n",
339
+ " -0.15227772, -0.08241647],\n",
340
+ " [-0.27468949, 0.16507216, 0.08667156, ..., 0.18776284,\n",
341
+ " -0.14165082, -0.16389885],\n",
342
+ " [-0.1982213 , 0.16841085, -0.04925933, ..., 0.11400164,\n",
343
+ " -0.14723683, -0.09713171],\n",
344
+ " [-0.29553188, 0.17239201, 0.05676926, ..., 0.15943622,\n",
345
+ " -0.16615383, -0.15569784]], shape=(5, 480))"
346
+ ]
347
+ },
348
+ "execution_count": 6,
349
+ "metadata": {},
350
+ "output_type": "execute_result"
351
+ }
352
+ ],
353
  "source": [
354
  "ablang(all_seqs, mode='seqcoding')\n"
355
  ]
 
370
  },
371
  {
372
  "cell_type": "code",
373
+ "execution_count": 7,
374
  "id": "6227f661-575f-4b1e-9646-cfba7b10c3b4",
375
  "metadata": {},
376
+ "outputs": [
377
+ {
378
+ "data": {
379
+ "text/plain": [
380
+ "[array([[-0.40741208, -0.5118987 , 0.06096708, ..., 0.3268144 ,\n",
381
+ " 0.03920235, -0.36715826],\n",
382
+ " [-0.5768883 , 0.38245413, -0.21791998, ..., 0.01250262,\n",
383
+ " -0.08844463, -0.32367525],\n",
384
+ " [-0.1475935 , 0.39639047, -0.38226923, ..., -0.10119921,\n",
385
+ " -0.41469565, -0.00319315],\n",
386
+ " ...,\n",
387
+ " [-0.14358369, 0.3124389 , -0.30157998, ..., -0.13289244,\n",
388
+ " -0.45353398, -0.07878865],\n",
389
+ " [ 0.17538925, 0.24394299, 0.20141171, ..., 0.14587352,\n",
390
+ " -0.38479003, 0.07409196],\n",
391
+ " [-0.23031706, -0.35487285, 0.1960684 , ..., -0.1283362 ,\n",
392
+ " 0.31107333, -0.3265108 ]], shape=(238, 480), dtype=float32),\n",
393
+ " array([[-0.41981837, -0.3666375 , 0.10595217, ..., 0.3903574 ,\n",
394
+ " 0.0382378 , -0.36337993],\n",
395
+ " [-0.5054137 , 0.38347068, -0.10992069, ..., -0.05231472,\n",
396
+ " -0.13636623, -0.34830108],\n",
397
+ " [-0.06784609, 0.69349885, -0.4212398 , ..., -0.24805346,\n",
398
+ " -0.39583805, -0.10972726],\n",
399
+ " ...,\n",
400
+ " [-0.2090099 , 0.29489496, -0.11039071, ..., -0.24245434,\n",
401
+ " -0.60625184, -0.02307999],\n",
402
+ " [ 0.19134358, 0.21744648, 0.2575827 , ..., 0.15845427,\n",
403
+ " -0.34743664, 0.10218249],\n",
404
+ " [-0.2551157 , -0.21778448, 0.21906358, ..., -0.09656111,\n",
405
+ " 0.22394855, -0.20267345]], shape=(222, 480), dtype=float32),\n",
406
+ " array([[-0.40043733, -0.48596814, 0.0886725 , ..., 0.38941646,\n",
407
+ " 0.06195956, -0.40999672],\n",
408
+ " [-0.54576075, 0.4312959 , -0.3451486 , ..., -0.09285564,\n",
409
+ " 0.03116508, -0.45269737],\n",
410
+ " [ 0.0221165 , 0.53196615, -0.30137214, ..., -0.1889072 ,\n",
411
+ " -0.32587305, 0.05078396],\n",
412
+ " ...,\n",
413
+ " [ 0.2630385 , -0.22976042, 0.5510368 , ..., 0.47436473,\n",
414
+ " -0.42733562, -0.83135855],\n",
415
+ " [-0.13752195, 0.28678602, -0.18887053, ..., 0.28262627,\n",
416
+ " 0.1254679 , -0.6496486 ],\n",
417
+ " [-0.4541417 , 0.24564984, 0.2132735 , ..., 0.03287445,\n",
418
+ " 0.03825552, -0.34259132]], shape=(124, 480), dtype=float32),\n",
419
+ " array([[-0.26863217, 0.32259187, 0.10813517, ..., 0.03953876,\n",
420
+ " 0.18312076, -0.00498045],\n",
421
+ " [-0.2165424 , -0.38562432, -0.02696264, ..., 0.20541488,\n",
422
+ " 0.18698391, -0.22639504],\n",
423
+ " [-0.41950518, 0.04743317, 0.0048816 , ..., 0.11408642,\n",
424
+ " -0.05384652, 0.1025871 ],\n",
425
+ " ...,\n",
426
+ " [-0.10960457, 0.35151365, -0.21752454, ..., -0.21448943,\n",
427
+ " -0.6396219 , -0.00839792],\n",
428
+ " [ 0.20491892, 0.36294487, 0.19217414, ..., 0.07750722,\n",
429
+ " -0.5039212 , 0.03793833],\n",
430
+ " [-0.11638474, -0.35350856, 0.13215722, ..., -0.1606055 ,\n",
431
+ " 0.23913842, -0.2565337 ]], shape=(115, 480), dtype=float32),\n",
432
+ " array([[-0.42062947, -0.44009134, 0.00152371, ..., 0.27141467,\n",
433
+ " 0.03798106, -0.397461 ],\n",
434
+ " [-0.57318133, 0.5258899 , -0.17001636, ..., -0.23864633,\n",
435
+ " 0.2088059 , -0.57877594],\n",
436
+ " [-0.38988614, 0.46168196, -0.3429413 , ..., -0.14872643,\n",
437
+ " -0.46576905, -0.21224979],\n",
438
+ " ...,\n",
439
+ " [-0.21528634, 0.30046722, -0.25216463, ..., -0.11576828,\n",
440
+ " -0.4704907 , -0.0740136 ],\n",
441
+ " [ 0.0633081 , 0.22700705, 0.28184187, ..., 0.15967266,\n",
442
+ " -0.377182 , 0.06188517],\n",
443
+ " [-0.27826303, -0.37297496, 0.21229912, ..., -0.14886017,\n",
444
+ " 0.24998347, -0.35954213]], shape=(238, 480), dtype=float32)]"
445
+ ]
446
+ },
447
+ "execution_count": 7,
448
+ "metadata": {},
449
+ "output_type": "execute_result"
450
+ }
451
+ ],
452
  "source": [
453
  "ablang(all_seqs, mode='rescoding', stepwise_masking = False)"
454
  ]
 
469
  },
470
  {
471
  "cell_type": "code",
472
+ "execution_count": 8,
473
  "id": "e4bc0cb1-f5b0-4255-9e93-d643ae1396df",
474
  "metadata": {},
475
+ "outputs": [
476
+ {
477
+ "name": "stdout",
478
+ "output_type": "stream",
479
+ "text": [
480
+ "['<' '1 ' '2 ' '3 ' '4 ' '5 ' '6 ' '7 ' '8 ' '9 ' '11 ' '12 ' '13 ' '14 '\n",
481
+ " '15 ' '16 ' '17 ' '18 ' '19 ' '20 ' '21 ' '22 ' '23 ' '24 ' '25 ' '26 '\n",
482
+ " '27 ' '28 ' '29 ' '30 ' '35 ' '36 ' '37 ' '38 ' '39 ' '40 ' '41 ' '42 '\n",
483
+ " '43 ' '44 ' '45 ' '46 ' '47 ' '48 ' '49 ' '50 ' '51 ' '52 ' '53 ' '54 '\n",
484
+ " '55 ' '56 ' '57 ' '58 ' '59 ' '62 ' '63 ' '64 ' '65 ' '66 ' '67 ' '68 '\n",
485
+ " '69 ' '70 ' '71 ' '72 ' '74 ' '75 ' '76 ' '77 ' '78 ' '79 ' '80 ' '81 '\n",
486
+ " '82 ' '83 ' '84 ' '85 ' '86 ' '87 ' '88 ' '89 ' '90 ' '91 ' '92 ' '93 '\n",
487
+ " '94 ' '95 ' '96 ' '97 ' '98 ' '99 ' '100 ' '101 ' '102 ' '103 ' '104 '\n",
488
+ " '105 ' '106 ' '107 ' '108 ' '109 ' '110 ' '111 ' '112A' '112 ' '113 '\n",
489
+ " '114 ' '115 ' '116 ' '117 ' '118 ' '119 ' '120 ' '121 ' '122 ' '123 '\n",
490
+ " '124 ' '125 ' '126 ' '127 ' '128 ' '>' '|' '<' '1 ' '2 ' '3 ' '4 ' '5 '\n",
491
+ " '6 ' '7 ' '8 ' '9 ' '10 ' '11 ' '12 ' '13 ' '14 ' '15 ' '16 ' '17 ' '18 '\n",
492
+ " '19 ' '20 ' '21 ' '22 ' '23 ' '24 ' '25 ' '26 ' '27 ' '28 ' '29 ' '30 '\n",
493
+ " '31 ' '32 ' '34 ' '35 ' '36 ' '37 ' '38 ' '39 ' '40 ' '41 ' '42 ' '43 '\n",
494
+ " '44 ' '45 ' '46 ' '47 ' '48 ' '49 ' '50 ' '51 ' '52 ' '53 ' '54 ' '55 '\n",
495
+ " '56 ' '57 ' '64 ' '65 ' '66 ' '67 ' '68 ' '69 ' '70 ' '71 ' '72 ' '74 '\n",
496
+ " '75 ' '76 ' '77 ' '78 ' '79 ' '80 ' '83 ' '84 ' '85 ' '86 ' '87 ' '88 '\n",
497
+ " '89 ' '90 ' '91 ' '92 ' '93 ' '94 ' '95 ' '96 ' '97 ' '98 ' '99 ' '100 '\n",
498
+ " '101 ' '102 ' '103 ' '104 ' '105 ' '106 ' '107 ' '108 ' '109 ' '114 '\n",
499
+ " '115 ' '116 ' '117 ' '118 ' '119 ' '120 ' '121 ' '122 ' '123 ' '124 '\n",
500
+ " '125 ' '126 ' '127 ' '>']\n",
501
+ "['<EVQLLESGGEVKKPGASVKVSCRASGYTFRNYGLTWVRQAPGQGLEWMGWISAYNGNTNYAQKFQGRVTLTTDTSTSTAYMELRSLRSDDTAVYFCARDVPGHGAAFMDVWGTGTTVTVSS>|<DIQLTQSPLSLPVTLGQPASISCRSSQSLEASDTNIYLSWFQQRPGQSPRRLIYKI-SNRDSGVPDRFSGSGSGTHFTLRISRVEADDVAVYYCMQGTHWPPAFGQGTKVDIK>', '<EVQLLESGGEVKKPGASVKVSCRASGYTFRNYGLTWVRQAPGQGLEWMGWISAYNGNTNYAQKFQGRVTLTTDTSTSTAYMELRSLRSDDTAVYFCARDVPGHGAAFMDVWGTGTT----->|<-----------PVTLGQPASISCRSSQSLEASDTNIYLSWFQQRPGQSPRRLIYKI-SNRDSGVPDRFSGSGSGTHFTLRISRVEADDVAVYYCMQGTHWPPAFGQGTKVDIK>', '<------SGGEVKKPGASVKVSCRASGYTFRNYGLTWVRQAPGQGLEWMGWISAYNGNTNYAQKFQGRVTLTTDTSTSTAYMELRSLRSDDTAVYFCAR**PGHGAAFMDVWGTGTTVTVSS>|<DIQLTQSPLSLPVTLGQPASISCRSS*SLEASDTNIYLSWFQQRPGQSPRRLIYKI*N-RDSGVPDRFSGSGSGTHFTLRISRVEADDVAVYYCMQGTHWPPAFGQGTKVDIK>']\n",
502
+ "[[[ 9.31621838 -3.42184329 -3.59397745 ... -14.73707485 -6.8935833\n",
503
+ " -0.23662776]\n",
504
+ " [ -3.54718232 -5.84866619 -4.02423859 ... -12.93966579 -9.5614481\n",
505
+ " -4.48473835]\n",
506
+ " [-11.94997597 -2.245543 -5.69481373 ... -15.19639015 -17.97454071\n",
507
+ " -12.56952095]\n",
508
+ " ...\n",
509
+ " [ -8.94504833 -0.42261261 -4.95588207 ... -16.66817474 -15.2224741\n",
510
+ " -10.37267494]\n",
511
+ " [-11.65150356 -5.44477606 -2.95585775 ... -16.25555801 -9.75158596\n",
512
+ " -11.75897026]\n",
513
+ " [ 1.79469728 -1.95846701 -3.59784532 ... -14.95585823 -7.47080708\n",
514
+ " -0.95226753]]\n",
515
+ "\n",
516
+ " [[ 8.55518723 -3.83663297 -2.33595967 ... -13.87456799 -8.14840603\n",
517
+ " -0.42472434]\n",
518
+ " [ -4.40701294 -5.53201008 -3.69397402 ... -12.97877789 -9.86258411\n",
519
+ " -4.95414352]\n",
520
+ " [-11.95642853 -3.86210871 -5.80935192 ... -14.89213085 -16.94556236\n",
521
+ " -11.36959839]\n",
522
+ " ...\n",
523
+ " [ -7.75924015 -0.66524202 -4.08643246 ... -16.16580772 -14.76507473\n",
524
+ " -8.3507061 ]\n",
525
+ " [-11.91039753 -4.86995983 -2.74777436 ... -16.07694817 -8.44974899\n",
526
+ " -10.45223904]\n",
527
+ " [ 0.86006832 -2.37964034 -3.58130741 ... -15.35423565 -7.73035526\n",
528
+ " -1.11989737]]\n",
529
+ "\n",
530
+ " [[ -4.37902737 -7.55587149 1.21958363 ... -15.48622513 -6.021842\n",
531
+ " -3.79647374]\n",
532
+ " [ 0. 0. 0. ... 0. 0.\n",
533
+ " 0. ]\n",
534
+ " [ 0. 0. 0. ... 0. 0.\n",
535
+ " 0. ]\n",
536
+ " ...\n",
537
+ " [ -8.94207573 -0.51090252 -5.09760332 ... -16.69521713 -15.45450687\n",
538
+ " -10.50823212]\n",
539
+ " [-11.92354965 -5.55152607 -2.87666893 ... -16.40607834 -10.19431686\n",
540
+ " -12.1328764 ]\n",
541
+ " [ 2.42200375 -2.01573253 -3.61701298 ... -14.9590435 -7.19029331\n",
542
+ " -0.89830256]]]\n"
543
+ ]
544
+ }
545
+ ],
546
  "source": [
547
  "results = ablang(only_both_chains_seqs, mode='likelihood', align=True)\n",
548
  "\n",
 
553
  },
554
  {
555
  "cell_type": "code",
556
+ "execution_count": 9,
557
  "id": "56be8cad",
558
  "metadata": {},
559
+ "outputs": [
560
+ {
561
+ "data": {
562
+ "text/plain": [
563
+ "[array([[9.9955505e-01, 2.9358694e-06, 2.4716087e-06, ..., 3.5776201e-11,\n",
564
+ " 9.1196831e-08, 7.0967326e-05],\n",
565
+ " [4.1573694e-06, 4.1619489e-07, 2.5800944e-06, ..., 3.4650952e-10,\n",
566
+ " 1.0159109e-08, 1.6279575e-06],\n",
567
+ " [7.8059600e-08, 1.2794037e-03, 4.0645118e-05, ..., 3.0375720e-09,\n",
568
+ " 1.8879491e-10, 4.2010839e-08],\n",
569
+ " ...,\n",
570
+ " [3.4210879e-07, 1.7195340e-03, 1.8477240e-05, ..., 1.5137445e-10,\n",
571
+ " 6.4255873e-10, 8.2064140e-08],\n",
572
+ " [9.1038084e-09, 4.5161755e-06, 5.4411950e-05, ..., 9.1139631e-11,\n",
573
+ " 6.0862085e-08, 8.1761966e-09],\n",
574
+ " [8.5759175e-04, 2.0104915e-05, 3.9023766e-06, ..., 4.5562460e-11,\n",
575
+ " 8.1156479e-08, 5.4990651e-05]], shape=(238, 26), dtype=float32),\n",
576
+ " array([[9.9939799e-01, 4.1499175e-06, 1.8611167e-05, ..., 1.8139243e-10,\n",
577
+ " 5.5649299e-08, 1.2583815e-04],\n",
578
+ " [1.6735513e-06, 5.4332406e-07, 3.4143472e-06, ..., 3.1693398e-10,\n",
579
+ " 7.1501400e-09, 9.6832969e-07],\n",
580
+ " [3.7784993e-08, 1.2377645e-04, 1.7658784e-05, ..., 2.0061326e-09,\n",
581
+ " 2.5737484e-10, 6.7947965e-08],\n",
582
+ " ...,\n",
583
+ " [1.1050455e-06, 1.3312638e-03, 4.3497097e-05, ..., 2.4686178e-10,\n",
584
+ " 1.0018089e-09, 6.1165900e-07],\n",
585
+ " [5.7270397e-09, 6.5396339e-06, 5.4601755e-05, ..., 8.8801404e-11,\n",
586
+ " 1.8233513e-07, 2.4615032e-08],\n",
587
+ " [7.3952030e-04, 2.8970928e-05, 8.7113440e-06, ..., 6.7168833e-11,\n",
588
+ " 1.3746008e-07, 1.0210846e-04]], shape=(222, 26), dtype=float32),\n",
589
+ " array([[9.99685407e-01, 3.35662639e-06, 1.14241482e-06, ...,\n",
590
+ " 2.32460891e-11, 6.88188067e-08, 5.69467156e-05],\n",
591
+ " [6.38133372e-07, 1.01300586e-07, 5.64459742e-06, ...,\n",
592
+ " 4.09234556e-11, 2.53804799e-09, 4.31722100e-07],\n",
593
+ " [1.49096788e-08, 2.04515047e-04, 9.23794141e-06, ...,\n",
594
+ " 7.46306961e-10, 2.92107380e-11, 2.21786500e-08],\n",
595
+ " ...,\n",
596
+ " [2.15093763e-07, 1.06453872e-03, 1.62486140e-05, ...,\n",
597
+ " 1.12102910e-10, 1.47300866e-10, 4.73037538e-08],\n",
598
+ " [4.30136682e-09, 3.09317988e-06, 3.96632568e-05, ...,\n",
599
+ " 5.24226877e-11, 2.39579450e-08, 3.86403221e-09],\n",
600
+ " [9.77773685e-04, 1.29533228e-05, 2.78623725e-06, ...,\n",
601
+ " 2.73364300e-11, 3.96418649e-08, 4.04014427e-05]],\n",
602
+ " shape=(238, 26), dtype=float32)]"
603
+ ]
604
+ },
605
+ "execution_count": 9,
606
+ "metadata": {},
607
+ "output_type": "execute_result"
608
+ }
609
+ ],
610
  "source": [
611
  "ablang(only_both_chains_seqs, mode='probability')"
612
  ]
 
631
  },
632
  {
633
  "cell_type": "code",
634
+ "execution_count": 10,
635
  "id": "83f3064b-48a7-42fb-ba82-ec153ea946da",
636
  "metadata": {},
637
+ "outputs": [
638
+ {
639
+ "data": {
640
+ "text/plain": [
641
+ "array([1.96673731, 2.04801253, 2.09881898, 1.82533665, 1.97255249])"
642
+ ]
643
+ },
644
+ "execution_count": 10,
645
+ "metadata": {},
646
+ "output_type": "execute_result"
647
+ }
648
+ ],
649
  "source": [
650
  "results = ablang(all_seqs, mode='pseudo_log_likelihood')\n",
651
  "np.exp(-results) # convert to pseudo perplexity"
 
653
  },
654
  {
655
  "cell_type": "code",
656
+ "execution_count": 11,
657
  "id": "42cc8b34-5ae9-4857-93fe-a438a0f2a868",
658
  "metadata": {},
659
+ "outputs": [
660
+ {
661
+ "data": {
662
+ "text/plain": [
663
+ "array([1.2636038, 1.126463 , 1.3123759, 1.2140924, 1.1805094],\n",
664
+ " dtype=float32)"
665
+ ]
666
+ },
667
+ "execution_count": 11,
668
+ "metadata": {},
669
+ "output_type": "execute_result"
670
+ }
671
+ ],
672
  "source": [
673
  "results = ablang(all_seqs, mode='confidence')\n",
674
  "np.exp(-results)"
 
686
  },
687
  {
688
  "cell_type": "code",
689
+ "execution_count": 12,
690
  "id": "2d5b725c-4eac-4a4b-9331-357c3ac140f7",
691
  "metadata": {},
692
+ "outputs": [
693
+ {
694
+ "data": {
695
+ "text/plain": [
696
+ "array(['<EVQLLESGGEVKKPGASVKVSCRASGYTFRNYGLTWVRQAPGQGLEWMGWISAYNGNTNYAQKFQGRVTLTTDTSTSTAYMELRSLRSDDTAVYFCARDVPGHGAAFMDVWGTGTTVTVSS>|<DIQLTQSPLSLPVTLGQPASISCRSSQSLEASDTNIYLSWFQQRPGQSPRRLIYKISNRDSGVPDRFSGSGSGTHFTLRISRVEADDVAVYYCMQGTHWPPAFGQGTKVDIK>',\n",
697
+ " '<EVQLLESGGEVKKPGASVKVSCRASGYTFRNYGLTWVRQAPGQGLEWMGWISAYNGNTNYAQKFQGRVTLTTDTSTSTAYMELRSLRSDDTAVYFCARDVPGHGAAFMDVWGTGTT>|<PVTLGQPASISCRSSQSLEASDTNIYLSWFQQRPGQSPRRLIYKISNRDSGVPDRFSGSGSGTHFTLRISRVEADDVAVYYCMQGTHWPPAFGQGTKVDIK>',\n",
698
+ " '<EVQLVQSGGEVKKPGASVKVSCRASGYTFRNYGLTWVRQAPGQGLEWMGWISAYNGNTNYAQKFQGRVTLTTDTSTSTAYMELRSLRSDDTAVYFCARDPPGHGAAFMDVWGTGTTVTVSS>|<DIQLTQSPLSLPVTLGQPASISCRSSQSLEASDTNIYLSWFQQRPGQSPRRLIYKISNRDSGVPDRFSGSGSGTHFTLRISRVEADDVAVYYCMQGTHWPPAFGQGTKVDIK>'],\n",
699
+ " dtype='<U238')"
700
+ ]
701
+ },
702
+ "execution_count": 12,
703
+ "metadata": {},
704
+ "output_type": "execute_result"
705
+ }
706
+ ],
707
  "source": [
708
  "restored = ablang(only_both_chains_seqs, mode='restore')\n",
709
  "restored"
 
711
  },
712
  {
713
  "cell_type": "code",
714
+ "execution_count": 13,
715
  "id": "0e9615f7-c490-4947-96f4-7617266c686e",
716
  "metadata": {},
717
+ "outputs": [
718
+ {
719
+ "data": {
720
+ "text/plain": [
721
+ "array(['<EVQLLESGGEVKKPGASVKVSCRASGYTFRNYGLTWVRQAPGQGLEWMGWISAYNGNTNYAQKFQGRVTLTTDTSTSTAYMELRSLRSDDTAVYFCARDVPGHGAAFMDVWGTGTTVTVSS>|<DIQLTQSPLSLPVTLGQPASISCRSSQSLEASDTNIYLSWFQQRPGQSPRRLIYKISNRDSGVPDRFSGSGSGTHFTLRISRVEADDVAVYYCMQGTHWPPAFGQGTKVDIK>',\n",
722
+ " '<EVQLLESGGEVKKPGASVKVSCRASGYTFRNYGLTWVRQAPGQGLEWMGWISAYNGNTNYAQKFQGRVTLTTDTSTSTAYMELRSLRSDDTAVYFCARDVPGHGAAFMDVWGTGTTVTVSS>|<DVVMTQSPLSLPVTLGQPASISCRSSQSLEASDTNIYLSWFQQRPGQSPRRLIYKISNRDSGVPDRFSGSGSGTHFTLRISRVEADDVAVYYCMQGTHWPPAFGQGTKVDIK>',\n",
723
+ " '<QVQLVQSGGEVKKPGASVKVSCRASGYTFRNYGLTWVRQAPGQGLEWMGWISAYNGNTNYAQKFQGRVTLTTDTSTSTAYMELRSLRSDDTAVYFCARDPPGHGAAFMDVWGTGTTVTVSS>|<DIQLTQSPLSLPVTLGQPASISCRSSQSLEASDTNIYLSWFQQRPGQSPRRLIYKISNRDSGVPDRFSGSGSGTHFTLRISRVEADDVAVYYCMQGTHWPPAFGQGTKVDIK>'],\n",
724
+ " dtype='<U238')"
725
+ ]
726
+ },
727
+ "execution_count": 13,
728
+ "metadata": {},
729
+ "output_type": "execute_result"
730
+ }
731
+ ],
732
  "source": [
733
  "restored = ablang(only_both_chains_seqs, mode='restore', align = True)\n",
734
  "restored"