Skip to content
This repository was archived by the owner on Jul 18, 2024. It is now read-only.

Commit b3c5cdf

Browse files
authored
[v1.1] Fix the Format in the SDA-BERT/DE-NAS BERT/ViT/HF Demos (#285)
* Fix the typos in the SDA BERT demo * format the SDA-BERT/DENAS BERT/HF/ViT demos * Add DE-NAS HF train conf and component for the demo * refine the configuration * Reformat the DE-NAS HF demo in the training part * Fix the typos
1 parent 72adaff commit b3c5cdf

5 files changed

Lines changed: 221 additions & 28 deletions

File tree

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# conf for Bert-based DE-NAS
2+
domain: hf
3+
task_name: squad1
4+
task_type: classification
5+
supernet: bert-base-uncased
6+
tokenizer: bert-base-uncased
7+
optimizer: BertAdam
8+
criterion: CrossEntropyQALoss
9+
lr_scheduler: warmup_linear
10+
eval_metric: qa_f1
11+
dist_backend: gloo
12+
input_id: input_ids attention_mask token_type_ids
13+
data_set: SQuADv1.1
14+
15+
best_model_structure: /home/vmagent/app/e2eaiok/e2eAIOK/DeNas/best_model_structure.txt
16+
model: /home/vmagent/app/dataset/bert-base-uncased/
17+
model_dir: /home/vmagent/app/dataset/bert-base-uncased/
18+
data_dir: /home/vmagent/app/dataset/SQuAD/
19+
output_dir: /home/vmagent/app/e2eaiok/e2eAIOK/DeNas/thirdparty/
20+
21+
hidden_size: 640
22+
gradient_accumulation_steps: 1
23+
warmup_proportion: 0.1
24+
learning_rate: 0.00006
25+
weight_decay: 0.01
26+
initializer_range: 0.02
27+
train_epochs: 2
28+
max_seq_length: 384
29+
doc_stride: 128
30+
train_batch_size: 32
31+
eval_batch_size: 8
32+
eval_step: 500
33+
n_best_size: 20
34+
max_answer_length: 30
35+
max_query_length: 64
36+
version_2_with_negative: 0
37+
null_score_diff_threshold: 0.0
38+
num_labels: 2
39+
num_workers: 1
40+
41+
pin_mem: True
42+
verbose_logging: False
43+
no_cuda: True
44+
do_lower_case: True
45+
metric_threshold: None

demo/builtin/bert/BERT_DEMO.ipynb

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
},
3030
"source": [
3131
"# Content\n",
32-
"* [Overview](#ovewview)\n",
32+
"* [Overview](#overview)\n",
3333
" * [Model Architecture](#model-architecture)\n",
3434
" * [Optimizations](#optimizations)\n",
3535
" * [Performance](#performance)\n",
@@ -47,7 +47,7 @@
4747
"id": "pS__BjqrCZqn"
4848
},
4949
"source": [
50-
"# Ovewview"
50+
"# Overview"
5151
]
5252
},
5353
{
@@ -61,7 +61,7 @@
6161
"\n",
6262
"### Natural Language Processing\n",
6363
"\n",
64-
"<img src=\"https://github.com/intel/e2eAIOK/blob/main/demo/builtin/bert/img/QA.png?raw=1\" width=\"600\"/><figure>Question Answer Task</figure>\n",
64+
"<img src=\"https://github.com/intel/e2eAIOK/blob/main/demo/builtin/bert/img/QA.png?raw=1\" width=\"400\"/><figure>Question Answer Task</figure>\n",
6565
"\n",
6666
"* Natural language processing (NLP) is the intersection of computer science, linguistics and machine learning, where the pre-trained language model BERT is the most representive model in a wide area of NLP tasks, like question and answer.\n",
6767
"* The end-to-end NLP system is a BERT-based network that uses the pretrained model weight for the downstream question answer task SQuAD (v1.1). In the question-answer task, given the input question and paragraph/context sequence, the BERT aims to predict the start/end index in the paragraph to indicate the answer span.\n",
@@ -246,7 +246,7 @@
246246
"\n",
247247
"## 1. Environment Setup\n",
248248
"\n",
249-
"### Option 1 Setup Environment with Pip"
249+
"### (Option 1) Use Pip install"
250250
]
251251
},
252252
{
@@ -264,7 +264,7 @@
264264
"cell_type": "markdown",
265265
"metadata": {},
266266
"source": [
267-
"### Option 2 Setup Environment with Docker\n",
267+
"### (Option 2) Use Docker\n",
268268
"\n",
269269
"Step1. prepare code\n",
270270
"``` bash\n",
@@ -345,6 +345,16 @@
345345
"## 4. Train"
346346
]
347347
},
348+
{
349+
"attachments": {},
350+
"cell_type": "markdown",
351+
"metadata": {},
352+
"source": [
353+
"Launch SDA training process on NLP domain BERT, and will produce the fine-tuned BERT performance on SQuADv1.1 task.\n",
354+
"\n",
355+
"Noted: Below performance result is using sample dataset and small iterations to demonstrate its function. The actual performance result please refers to the [performance section](#performance)."
356+
]
357+
},
348358
{
349359
"cell_type": "code",
350360
"execution_count": null,

demo/denas/bert/DENAS_BERT_DEMO.ipynb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
"\n",
8888
"## 1. Environment Setup\n",
8989
"\n",
90-
"### Option 1 Setup Environment with Pip"
90+
"### (Option 1) Use Pip install"
9191
]
9292
},
9393
{
@@ -104,7 +104,7 @@
104104
"cell_type": "markdown",
105105
"metadata": {},
106106
"source": [
107-
"### Option 2 Setup Environment with Docker\n",
107+
"### (Option 2) Use Docker\n",
108108
"\n",
109109
"Step1. prepare code\n",
110110
"\n",
@@ -413,10 +413,13 @@
413413
]
414414
},
415415
{
416+
"attachments": {},
416417
"cell_type": "markdown",
417418
"metadata": {},
418419
"source": [
419-
"Launch DE-NAS training process on NLP domain BERT with the input of overall training configuration `/home/vmagent/app/e2eaiok/conf/denas/nlp/e2eaiok_denas_train_bert.conf`, and will produce the fine-tuned BERT performance on SQuADv1.1 task."
420+
"Launch DE-NAS training process on NLP domain BERT with the input of overall training configuration `/home/vmagent/app/e2eaiok/conf/denas/nlp/e2eaiok_denas_train_bert.conf`, and will produce the fine-tuned BERT performance on SQuADv1.1 task.\n",
421+
"\n",
422+
"Noted: Below performance result is using sample dataset and small iterations to demonstrate its function. The actual performance result please refers to the [performance section](#performance)."
420423
]
421424
},
422425
{

demo/denas/computer_vision/DENAS_ViT_DEMO.ipynb

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@
6565
"\n",
6666
"## Performance\n",
6767
"<center>\n",
68-
"<img src=\"./img/denas_vit_stock.png\" width=\"800\"/><figure>DE-NAS ViT performance over stock model</figure>\n",
68+
"<img src=\"./img/denas_vit_stock.png\" width=\"500\"/><figure>DE-NAS ViT performance over stock model</figure>\n",
6969
"</center>\n",
7070
"\n",
7171
"<center>\n",
72-
"<img src=\"./img/denas_vit_autoformer.png\" width=\"800\"/><figure>DE-NAS ViT performance over Autoformer</figure>\n",
72+
"<img src=\"./img/denas_vit_autoformer.png\" width=\"500\"/><figure>DE-NAS ViT performance over Autoformer</figure>\n",
7373
"</center>\n",
7474
"\n",
7575
"* Testing methodology\n",
@@ -91,7 +91,7 @@
9191
"\n",
9292
"## 1. Environment Setup\n",
9393
"\n",
94-
"### Option 1 Setup Environment with Pip"
94+
"### (Option 1) Use Pip install"
9595
]
9696
},
9797
{
@@ -110,7 +110,7 @@
110110
"id": "def012f3",
111111
"metadata": {},
112112
"source": [
113-
"### Option 2 Setup Environmental with Docker\n",
113+
"### (Option 2) Use Docker\n",
114114
"\n",
115115
"Step1. prepare code\n",
116116
"``` bash\n",
@@ -444,12 +444,15 @@
444444
]
445445
},
446446
{
447+
"attachments": {},
447448
"cell_type": "markdown",
448449
"id": "ad47332c",
449450
"metadata": {},
450451
"source": [
451452
"### Train the best searched ViT model\n",
452-
"The input is the configuration for VIT domain best model train, edit the configuration file of `e2eaiok_denas_train_vit.conf` for VIT best model train, and then run below commond line"
453+
"The input is the configuration for VIT domain best model train, edit the configuration file of `e2eaiok_denas_train_vit.conf` for VIT best model train.\n",
454+
"\n",
455+
"Noted: Below performance result is using sample dataset and small iterations to demonstrate its function. The actual performance result please refers to the [performance section](#performance)."
453456
]
454457
},
455458
{

0 commit comments

Comments
 (0)