Skip to content

Commit d0888bd

Browse files
committed
Added suggesitions and fix format issue
2 parents 354f237 + a71cd45 commit d0888bd

File tree

1 file changed

+110
-3
lines changed

1 file changed

+110
-3
lines changed

guide/14-deep-learning/use_third_party_language_models_with_ArcGIS.ipynb

Lines changed: 110 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
{
22
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "d048eaea-3ea5-45b7-9a93-191777d3dd82",
6+
"metadata": {},
7+
"source": [
8+
"# Creating Custom NLP Model with Model Extensiblity"
9+
]
10+
},
311
{
412
"cell_type": "markdown",
513
"id": "168721af",
@@ -40,6 +48,7 @@
4048
"id": "4941d9fb",
4149
"metadata": {},
4250
"source": [
51+
<<<<<<< HEAD:guide/14-deep-learning/use_third_party_language_models_with_ArcGIS.ipynb
4352
"## Custom Python NLP Function"
4453
]
4554
},
@@ -49,6 +58,9 @@
4958
"metadata": {},
5059
"source": [
5160
"You can create an NLP function in Python to integrate third-party language models into a text processing pipeline. NLP functions handle text data and perform various text processing tasks."
61+
=======
62+
"## Writing Python NLP Function"
63+
>>>>>>> a71cd459e26888bbc4ab70134c95117d87398ae3:guide/14-deep-learning/add_custom_nlp_models_using_model_extension.ipynb
5264
]
5365
},
5466
{
@@ -57,13 +69,41 @@
5769
"metadata": {},
5870
"source": [
5971
"### Anatomy of a Python NLP Function"
72+
<<<<<<< HEAD:guide/14-deep-learning/use_third_party_language_models_with_ArcGIS.ipynb
73+
=======
74+
]
75+
},
76+
{
77+
"cell_type": "markdown",
78+
"id": "2d027e60",
79+
"metadata": {},
80+
"source": [
81+
"This section explains how to create a new Natural Language Processing (NLP) function in Python. NLP functions work with text data and perform different text processing tasks. The aim is to learn how to fit your Python NLP function into a text processing pipeline, similar to how raster functions are used in image processing."
82+
]
83+
},
84+
{
85+
"cell_type": "markdown",
86+
"id": "f5ce75f6",
87+
"metadata": {},
88+
"source": [
89+
"### Core Methods"
90+
]
91+
},
92+
{
93+
"cell_type": "markdown",
94+
"id": "0438547a",
95+
"metadata": {},
96+
"source": [
97+
"Here's a breakdown of essential methods you might need to implement for an NLP function:"
98+
>>>>>>> a71cd459e26888bbc4ab70134c95117d87398ae3:guide/14-deep-learning/add_custom_nlp_models_using_model_extension.ipynb
6099
]
61100
},
62101
{
63102
"cell_type": "markdown",
64103
"id": "eb0c423a",
65104
"metadata": {},
66105
"source": [
106+
<<<<<<< HEAD:guide/14-deep-learning/use_third_party_language_models_with_ArcGIS.ipynb
67107
"#### `__init__`\n",
68108
"\n",
69109
"The `__init__` method initialize instance variables such as name, description, and other attributes essential for the NLP function.\n",
@@ -83,6 +123,27 @@
83123
"#### `predict`\n",
84124
"\n",
85125
"The `predict` method responsible for converting input text to the desired output. It uses defined parameters and processing logic to produce the final result.\n"
126+
=======
127+
"* `__init__`\n",
128+
"\n",
129+
" This method initializes class variables such as `name`, `description`, and other attributes essential for your NLP function.\n",
130+
"\n",
131+
"* `initialize`\n",
132+
"\n",
133+
" This is called at the start of your Python NLP function. Use this method to load the NLP model and set up any initial configurations.\n",
134+
"\n",
135+
"* `getParameterInfo`\n",
136+
"\n",
137+
" This method specifies the parameters that your NLP function accepts. This includes text inputs and any configuration settings required for processing.\n",
138+
"\n",
139+
"* `getConfiguration`\n",
140+
"\n",
141+
" This method describes how the function should handle input processing and generate outputs. It includes details on any pre-processing or post-processing steps necessary for the function.\n",
142+
"\n",
143+
"* `predict`\n",
144+
"\n",
145+
" This method is the core function responsible for converting input text into the desired output. It uses the defined parameters and processing logic to produce the final result.\n"
146+
>>>>>>> a71cd459e26888bbc4ab70134c95117d87398ae3:guide/14-deep-learning/add_custom_nlp_models_using_model_extension.ipynb
86147
]
87148
},
88149
{
@@ -98,15 +159,23 @@
98159
"id": "17735a1e",
99160
"metadata": {},
100161
"source": [
162+
<<<<<<< HEAD:guide/14-deep-learning/use_third_party_language_models_with_ArcGIS.ipynb
101163
"#### `__init__`"
164+
=======
165+
"* `__init__()`"
166+
>>>>>>> a71cd459e26888bbc4ab70134c95117d87398ae3:guide/14-deep-learning/add_custom_nlp_models_using_model_extension.ipynb
102167
]
103168
},
104169
{
105170
"cell_type": "markdown",
106171
"id": "e30241ac",
107172
"metadata": {},
108173
"source": [
174+
<<<<<<< HEAD:guide/14-deep-learning/use_third_party_language_models_with_ArcGIS.ipynb
109175
"The `__init__` method is the constructor of the custom NLP function and initializes instance variables such as the name, description, and other essential attributes. This method sets the properties that will define the behavior and characteristics of the NLP function.\n",
176+
=======
177+
"This method initializes class variables such as name, description, and other attributes essential for your NLP function. This method sets up the foundational properties that will define the behavior and characteristics of your NLP component. \n",
178+
>>>>>>> a71cd459e26888bbc4ab70134c95117d87398ae3:guide/14-deep-learning/add_custom_nlp_models_using_model_extension.ipynb
110179
"\n",
111180
"The constructor creates an instance of a custom NLP class with all the attributes required for processing and analysis. When creating an instance of an NLP class, this method ensures that it has the required settings and default values. For example, if the NLP function needs specific settings such as paths to models, or special tokens, they can be set up in this method."
112181
]
@@ -137,7 +206,11 @@
137206
"id": "a9958400",
138207
"metadata": {},
139208
"source": [
209+
<<<<<<< HEAD:guide/14-deep-learning/use_third_party_language_models_with_ArcGIS.ipynb
140210
"#### `initialize`"
211+
=======
212+
"* `initialize()`"
213+
>>>>>>> a71cd459e26888bbc4ab70134c95117d87398ae3:guide/14-deep-learning/add_custom_nlp_models_using_model_extension.ipynb
141214
]
142215
},
143216
{
@@ -177,7 +250,11 @@
177250
"id": "11e3da28",
178251
"metadata": {},
179252
"source": [
253+
<<<<<<< HEAD:guide/14-deep-learning/use_third_party_language_models_with_ArcGIS.ipynb
180254
"#### `getParameterInfo`"
255+
=======
256+
"* `getParameterInfo()`"
257+
>>>>>>> a71cd459e26888bbc4ab70134c95117d87398ae3:guide/14-deep-learning/add_custom_nlp_models_using_model_extension.ipynb
181258
]
182259
},
183260
{
@@ -244,7 +321,11 @@
244321
"id": "b6d674aa",
245322
"metadata": {},
246323
"source": [
324+
<<<<<<< HEAD:guide/14-deep-learning/use_third_party_language_models_with_ArcGIS.ipynb
247325
"#### `getConfiguration`"
326+
=======
327+
"* `getConfiguration()`"
328+
>>>>>>> a71cd459e26888bbc4ab70134c95117d87398ae3:guide/14-deep-learning/add_custom_nlp_models_using_model_extension.ipynb
248329
]
249330
},
250331
{
@@ -286,7 +367,13 @@
286367
"id": "30cd88e7",
287368
"metadata": {},
288369
"source": [
370+
<<<<<<< HEAD:guide/14-deep-learning/use_third_party_language_models_with_ArcGIS.ipynb
289371
"In the example above, the custom NLP function is configured by doing the following:\n",
372+
=======
373+
"#### Explanation\n",
374+
"\n",
375+
"This method configures the NLP function by:\n",
376+
>>>>>>> a71cd459e26888bbc4ab70134c95117d87398ae3:guide/14-deep-learning/add_custom_nlp_models_using_model_extension.ipynb
290377
"\n",
291378
"- Setting the `class_names` parameter from the provided arguments.\n",
292379
"- Setting the `prompt` parameter from the provided arguments.\n",
@@ -299,7 +386,11 @@
299386
"id": "e6798934",
300387
"metadata": {},
301388
"source": [
389+
<<<<<<< HEAD:guide/14-deep-learning/use_third_party_language_models_with_ArcGIS.ipynb
302390
"#### `predict`"
391+
=======
392+
"* `predict()`"
393+
>>>>>>> a71cd459e26888bbc4ab70134c95117d87398ae3:guide/14-deep-learning/add_custom_nlp_models_using_model_extension.ipynb
303394
]
304395
},
305396
{
@@ -358,7 +449,11 @@
358449
"id": "62a2a40b",
359450
"metadata": {},
360451
"source": [
452+
<<<<<<< HEAD:guide/14-deep-learning/use_third_party_language_models_with_ArcGIS.ipynb
361453
"## Esri Model Definition (.emd) File"
454+
=======
455+
"## Refer to the custom NLP function in the Esri Model Definition (.emd) File"
456+
>>>>>>> a71cd459e26888bbc4ab70134c95117d87398ae3:guide/14-deep-learning/add_custom_nlp_models_using_model_extension.ipynb
362457
]
363458
},
364459
{
@@ -403,7 +498,11 @@
403498
"id": "a5490415",
404499
"metadata": {},
405500
"source": [
501+
<<<<<<< HEAD:guide/14-deep-learning/use_third_party_language_models_with_ArcGIS.ipynb
406502
"## Custom Deep Learning Package (.dlpk) Model File\n",
503+
=======
504+
"## Create Custom Deep Learning Package (.dlpk) Model File\n",
505+
>>>>>>> a71cd459e26888bbc4ab70134c95117d87398ae3:guide/14-deep-learning/add_custom_nlp_models_using_model_extension.ipynb
407506
"\n",
408507
"To complete a custom NLP setup, create a .dlpk model file. The .dlpk file allows you to use a model with the with the `arcgis.learn` Python API and the inference tools in the Text Analysis toolset.\n",
409508
"\n",
@@ -467,6 +566,7 @@
467566
"id": "da397fa7",
468567
"metadata": {},
469568
"source": [
569+
<<<<<<< HEAD:guide/14-deep-learning/use_third_party_language_models_with_ArcGIS.ipynb
470570
"The `arcgis.learn` Python API supports for third party custom models through various classes, including `TextClassifier`, `EntityRecognizer`, and `SequenceToSequence`. To utilize your custom `.dlpk` file for inference with these classes, follow the steps below. The example provided demonstrates how to use the `TextClassifier` class, but you can apply similar steps for the other supported classes."
471571
]
472572
},
@@ -476,6 +576,13 @@
476576
"metadata": {},
477577
"source": [
478578
"### Example with TextClassifier"
579+
=======
580+
"## Using the Custom .dlpk with the arcgis.learn API\n",
581+
"\n",
582+
"The `arcgis.learn` Python API supports model extensibility through various classes, including `TextClassifier`, `EntityRecognizer`, and `SequenceToSequence`. To utilize your custom `.dlpk` file for inference with these classes, follow the steps below. The example provided demonstrates how to use the `TextClassifier` class, but you can apply similar steps for the other supported classes.\n",
583+
"\n",
584+
"### Example with TextClassifier\n"
585+
>>>>>>> a71cd459e26888bbc4ab70134c95117d87398ae3:guide/14-deep-learning/add_custom_nlp_models_using_model_extension.ipynb
479586
]
480587
},
481588
{
@@ -629,9 +736,9 @@
629736
],
630737
"metadata": {
631738
"kernelspec": {
632-
"display_name": "Python [conda env:conda-dlenv_1] *",
739+
"display_name": "Python 3 (ipykernel)",
633740
"language": "python",
634-
"name": "conda-env-conda-dlenv_1-py"
741+
"name": "python3"
635742
},
636743
"language_info": {
637744
"codemirror_mode": {
@@ -643,7 +750,7 @@
643750
"name": "python",
644751
"nbconvert_exporter": "python",
645752
"pygments_lexer": "ipython3",
646-
"version": "3.11.8"
753+
"version": "3.11.0"
647754
}
648755
},
649756
"nbformat": 4,

0 commit comments

Comments
 (0)