|
276 | 276 | "The `initialize` function acts as the central hub for the extension. Within this function, we will set up the necessary variables. It accepts two parameters via `kwargs`:\n",
|
277 | 277 | "\n",
|
278 | 278 | "#### Parameters in `kwargs`\n",
|
279 |
| - "- **`model`**: The path to the EMD file.\n", |
| 279 | + "- **`model`**: The path to the ESRI Model Definition (.emd) file.\n", |
280 | 280 | "- **`device`**: The name of the device (either GPU or CPU), which is particularly important for on-premises models.\n",
|
281 | 281 | "\n",
|
282 | 282 | "Unlike the `__init__` method, which creates an instance of the NLP function, `initialize` reads the ESRI Model Definition (.emd) file and configures the essential variables needed for inference."
|
|
528 | 528 | "source": [
|
529 | 529 | "#### Key Points:\n",
|
530 | 530 | "- All of the aforementioned functions must be encapsulated within a class.\n",
|
531 |
| - "- The class name should match the Inference Function file name, excluding the extension.\n", |
532 |
| - "- The model extension author can define helper functions either within the class or in the module.\n", |
| 531 | + "- The class name should match the Inference Function file name, excluding the file extension.\n", |
| 532 | + "- The author can define helper functions either within the class or in the module.\n", |
533 | 533 | "- The author is responsible for handling exceptions.\n",
|
534 | 534 | "- The input field name must correspond to the name of the input field selected from the input table or feature layer."
|
535 | 535 | ]
|
|
563 | 563 | "\n",
|
564 | 564 | "```\n",
|
565 | 565 | "\n",
|
566 |
| - "**Zip the Folder**: We will compress the folder into a ZIP archive. Rename the .zip file to match the name of the ESRI Model Definition (.emd) file but with the .dlpk extension. The ESRI Deep Learning Package (.dlpk) file's name will be `NER_gilner_weather.dlpk`\n", |
| 566 | + "**Zip the Folder**: Create a ZIP archive of the folder. Rename the .zip file to match the name of the ESRI Model Definition (.emd) file but with the .dlpk extension. The ESRI Deep Learning Package (.dlpk) file's name will be `NER_gilner_weather.dlpk`\n", |
567 | 567 | "\n",
|
568 | 568 | "This .dlpk file is now ready for use with the arcgis.learn Python API and Extract Entities Using Deep Learning (GeoAI)."
|
569 | 569 | ]
|
|
583 | 583 | "metadata": {},
|
584 | 584 | "outputs": [],
|
585 | 585 | "source": [
|
586 |
| - "import sys\n", |
587 |
| - "import torch\n", |
588 | 586 | "from arcgis.learn.text import EntityRecognizer\n",
|
589 | 587 | "\n",
|
590 | 588 | "# Initialize the model with the dlpk\n",
|
591 |
| - "model = SequenceToSequence.from_model(r\"Path_to_the_dlpk\\NER_gilner_weather.dlpk\",\n", |
| 589 | + "model = EntityRecognizer.from_model(r\"Path_to_the_dlpk\\NER_gilner_weather.dlpk\",\n", |
592 | 590 | " classes =[\"impacted location\", \"event date\", \"Quantity\", \"property damage\", \"climatic catastropic event\"])\n",
|
593 | 591 | "\n",
|
594 | 592 | "# perform the inference\n",
|
|
0 commit comments