-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Information extraction from Cheshire fire incident reports using Mistral #2201
Conversation
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
@BP-Ent Please review this sample notebook |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
@@ -0,0 +1,1208 @@ | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Refer to the section Install deep learning dependencies of the arcgis.learn module for detailed documentation on installing the dependencies.
- To learn more about how
EntityRecognizer
works, please refer to the guide on Named Entity Extraction with arcgis.learn.
Reply via ReviewNB
@@ -0,0 +1,1208 @@ | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Data preparation involves splitting the data into training and validation sets, creating the necessary data structures for loading data into the model. The prepare_data()
function can directly read the training samples in one of the above specified formats and automate the entire process.
Reply via ReviewNB
@@ -0,0 +1,1208 @@ | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The EntityRecognizer
model in arcgis.learn
can be used with Hugging Face Transformers or with large language model backbones. For this sample use case, we will use the Mistral model backbone to extract entities from the text.
Run the command below to see what backbones are supported for the entity recognition task.
Reply via ReviewNB
@@ -0,0 +1,1208 @@ | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First we will create the model using the EntityRecognizer()
constructor and passing the following parameters:
data
: The databunch created using the prepare_textdata
method.
backbone
: To use mistral as the model backbone, use backbone="mistral"
.
prompt
: Text string describing the task and its guardrails. This is an optional parameter.
Reply via ReviewNB
@@ -0,0 +1,1208 @@ | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Important metrics to look at while measuring the performance of the EntityRecognizer
model are Precision, Recall, and F1-measures.
Reply via ReviewNB
@@ -0,0 +1,1208 @@ | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To find precision, recall, and f1 scores per label/class, we will call the model's metrics_per_label()
method.
Reply via ReviewNB
@@ -0,0 +1,1208 @@ | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -0,0 +1,1208 @@ | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -0,0 +1,1208 @@ | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now we can use the trained model to extract entities from new text documents using the extract_entities()
method. This method expects either the folder path of where the new text documents are located or a list of text documents.
Reply via ReviewNB
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestions made on reviewnb
This PR adds sample notebook on - Information extraction from Cheshire fire incident reports using Mistral language model.
#2115
Table Of Contents location:
Deep Learning > NLP > Information extraction from Cheshire fire incident reports using Mistral