Skip to content

Commit 889f978

Browse files
committed
adding example
1 parent a41cf69 commit 889f978

File tree

8 files changed

+25278
-0
lines changed

8 files changed

+25278
-0
lines changed
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"# Step - 1: Transforming data"
8+
]
9+
},
10+
{
11+
"cell_type": "code",
12+
"execution_count": null,
13+
"metadata": {},
14+
"outputs": [],
15+
"source": [
16+
"!python ../../data_transformations.py \\\n",
17+
" --transform_file 'transform_file_query_correctness.yml'"
18+
]
19+
},
20+
{
21+
"cell_type": "markdown",
22+
"metadata": {},
23+
"source": [
24+
"# Step -2 Data Preparation"
25+
]
26+
},
27+
{
28+
"cell_type": "code",
29+
"execution_count": null,
30+
"metadata": {},
31+
"outputs": [],
32+
"source": [
33+
"!python ../../data_preparation.py \\\n",
34+
" --task_file 'tasks_file_query_correctness.yml' \\\n",
35+
" --data_dir '../../data' \\\n",
36+
" --max_seq_len 50"
37+
]
38+
},
39+
{
40+
"cell_type": "markdown",
41+
"metadata": {},
42+
"source": [
43+
"# Step - 3 Running train"
44+
]
45+
},
46+
{
47+
"cell_type": "code",
48+
"execution_count": null,
49+
"metadata": {},
50+
"outputs": [],
51+
"source": [
52+
"!python ../../train.py \\\n",
53+
" --data_dir '../../data/bert-base-uncased_prepared_data' \\\n",
54+
" --task_file 'tasks_file_query_correctness.yml' \\\n",
55+
" --out_dir 'query_correctness_bert_base' \\\n",
56+
" --epochs 10 \\\n",
57+
" --train_batch_size 16 \\\n",
58+
" --eval_batch_size 32 \\\n",
59+
" --grad_accumulation_steps 1 \\\n",
60+
" --log_per_updates 20 \\\n",
61+
" --eval_while_train True \\\n",
62+
" --test_while_train True \\\n",
63+
" --max_seq_len 50 \\\n",
64+
" --silent True"
65+
]
66+
},
67+
{
68+
"cell_type": "markdown",
69+
"metadata": {},
70+
"source": [
71+
"# Step - 4 Infering"
72+
]
73+
},
74+
{
75+
"cell_type": "markdown",
76+
"metadata": {},
77+
"source": [
78+
"You can import and use the ``inferPipeline`` to get predictions for the required tasks.\n",
79+
"The trained model and maximum sequence length to be used needs to be specified.\n",
80+
"\n",
81+
"For knowing more details about infering, refer to <a href=\"https://multi-task-nlp.readthedocs.io/en/latest/infering.html\">infer pipeline</a> in documentation."
82+
]
83+
},
84+
{
85+
"cell_type": "code",
86+
"execution_count": null,
87+
"metadata": {},
88+
"outputs": [],
89+
"source": [
90+
"import sys\n",
91+
"sys.path.insert(1, '../../')\n",
92+
"from infer_pipeline import inferPipeline"
93+
]
94+
},
95+
{
96+
"cell_type": "code",
97+
"execution_count": null,
98+
"metadata": {},
99+
"outputs": [],
100+
"source": []
101+
}
102+
],
103+
"metadata": {
104+
"kernelspec": {
105+
"display_name": "Python 3",
106+
"language": "python",
107+
"name": "python3"
108+
},
109+
"language_info": {
110+
"codemirror_mode": {
111+
"name": "ipython",
112+
"version": 3
113+
},
114+
"file_extension": ".py",
115+
"mimetype": "text/x-python",
116+
"name": "python",
117+
"nbconvert_exporter": "python",
118+
"pygments_lexer": "ipython3",
119+
"version": "3.7.3"
120+
}
121+
},
122+
"nbformat": 4,
123+
"nbformat_minor": 4
124+
}

0 commit comments

Comments
 (0)