Creates an entity recognition model to extract text entities from unstructured text documents.
To load a custom DLPK using the model extensibility support, instantiate an object of the class using from_model.
kwargs
Parameter
Description
verbose
Optional string. Default set to error. The log level you want to set. It means the amount of information you want to display while training or calling the various methods of this class. Allowed values are - debug, info, warning, error and critical. Applicable only for models with HuggingFace transformer backbones.
seq_len
Optional Integer. Default set to 512. Maximum sequence length (at sub-word level after tokenization) of the training data to be considered for training the model. Applicable only for models with HuggingFace transformer backbones.
mixed_precision
Optional Bool. Default set to False. If set True, then mixed precision training is used to train the model. Applicable only for models with HuggingFace transformer backbones.
pretrained_path
Optional String. Path where pre-trained model is saved. Accepts a Deep Learning Package (DLPK) or Esri Model Definition(EMD) file.
prompt
Optional String. This parameter is applicable if the selected model backbone is from the LLM family.
This parameter outlines the task and its corresponding guardrails.
examples
Optional List. The list comprises tuple(s) where the first element denotes the text for entity extraction, while the second element is a dictionary used for mapping named entities.
This parameter is applicable if the selected model backbone is from the LLM family.
Pydantic Schema: List[Tuple[str, Dict[str, List]]]
Example: [(âJim stays in Londonâ, {ânameâ: [âJimâ], âlocationâ: [âLondonâ]})]
If examples are not supplied, a data object must be provided.
EntityRecognizer
Object
Get available models for the given entity recognition backbone
a tuple containing the available models for the given entity recognition backbone
List of available metrics that are displayed in the training table. Set monitor value to be one of these while calling the fit method.
Extracts the entities from [documents in the mentioned path or text_list].
Field defined as âaddress_tagâ in prepare_data()
functionâs class mapping attribute will be treated as a location. In cases where trained model extracts multiple locations from a single document, that document will be replicated for each location in the resulting dataframe.
Parameter
Description
text_list
Required string(path) or list(documents). List of documents for entity extraction OR path to the documents.
drop
Optional bool. If documents without address needs to be dropped from the results. Default is set to True.
batch_size
Optional integer. Number of items to process at once. (Reduce it if getting CUDA Out of Memory Errors). Default is set to 4. Not applicable for models with spaCy backbone.
show_progress
Optional Bool. If set to True, will display a progress bar depicting the items processed so far. Applicable only when a list of text is passed.
kwargs
Parameter
Description
input_field
Optional string. Input field name in the feature set. Supported in model extension. Default value: input_str
Pandas DataFrame
Calculate F1 score of the trained model
Train the model for the specified number of epochs and using the specified learning rates
This method is not supported when the backbone is configured as llm/mistral.
Parameter
Description
epochs
Required integer. Number of cycles of training on the data. Increase it if underfitting.
lr
Optional float or slice of floats. Learning rate to be used for training the model. If lr=None
, an optimal learning rate is automatically deduced for training the model.
Note
Passing slice of floats as lr value is not supported for models with spaCy backbone.
one_cycle
Optional boolean. Parameter to select 1cycle learning rate schedule. If set to False no learning rate schedule is used.
Note
Not applicable for models with spaCy backbone
early_stopping
Optional boolean. Parameter to add early stopping. If set to âTrueâ training will stop if parameter monitor value stops improving for 5 epochs.
Note
Not applicable for models with spaCy backbone
checkpoint
Optional boolean or string. Parameter to save checkpoint during training. If set to True the best model based on monitor will be saved during training. If set to âallâ, all checkpoints are saved. If set to False, checkpointing will be off. Setting this parameter loads the best model at the end of training.
Note
Not applicable for models with spaCy backbone
tensorboard
Optional boolean. Parameter to write the training log. If set to âTrueâ the log will be saved at <dataset-path>/training_log which can be visualized in tensorboard. Required tensorboardx version=2.1
The default value is âFalseâ.
Note
Not applicable for Text Models
monitor
Optional string. Parameter specifies which metric to monitor while checkpointing and early stopping. Defaults to âvalid_lossâ. Value should be one of the metric that is displayed in the training table. Use {model_name}.available_metrics to list the available metrics to set here.
Note
Not applicable for models with spaCy backbone
Freeze up to last layer group to train only the last layer group of the model.
This method is not supported when the backbone is configured as llm/mistral.
Creates an EntityRecognizer model object from a Deep Learning Package(DLPK) or Esri Model Definition (EMD) file.
To load a custom DLPK using the model extensibility support, instantiate an object of the class using this method.
EntityRecognizer
Object
Creates an EntityRecognizer model object from an already fine-tuned Hugging Face Transformer backbone.
This method is not supported when the backbone is configured as llm/mistral.
To load a custom DLPK using the model extensibility support, instantiate an object of the class using from_model.
Parameter
Description
backbone
Required string. Specify the Hugging Face Transformer backbone name fine-tuned on Named Entity Recognition(NER)/ Token Classification task.
To get more details on available transformer models fine-tuned on Named Entity Recognition(NER) Task, kindly visit:- https://huggingface.co/models?pipeline_tag=token-classification
kwargs
Parameter
Description
verbose
Optional string. Default set to error. The log level you want to set. It means the amount of information you want to display while calling the various methods of this class. Allowed values are - debug, info, warning, error and critical.
EntityRecognizer
Object
Loads a saved EntityRecognizer model from disk.
This method is not supported when the backbone is configured as llm/mistral.
To load a custom DLPK using the model extensibility support, instantiate an object of the class using from_model.
Parameter
Description
name_or_path
Required string. Path to Deep Learning Package (DLPK) or Esri Model Definition(EMD) file.
Runs the Learning Rate Finder. Helps in choosing the optimum learning rate for training the model.
This method is not supported when the backbone is configured as llm/mistral.
Parameter
Description
allow_plot
Optional boolean. Display the plot of losses against the learning rates and mark the optimal value of the learning rate on the plot. The default value is âTrueâ.
Calculate precision, recall & F1 scores per labels/entities for which the model was trained on
Plot training and validation losses.
This method is not supported when the backbone is configured as llm/mistral.
Parameter
Description
show
Optional bool. Defaults to True If set to False, figure will not be plotted but will be returned, when set to True function will plot the figure and return nothing.
Calculate precision score of the trained model
Calculate recall score of the trained model
Saves the model weights, creates an Esri Model Definition and Deep Learning Package zip for deployment to Image Server or ArcGIS Pro.
Parameter
Description
name_or_path
Required string. Name of the model to save. It stores it at the pre-defined location. If path is passed then it stores at the specified path with model name as directory name and creates all the intermediate directories.
publish
Optional boolean. Publishes the DLPK as an item. Default is set to False.
gis
Optional GIS
Object. Used for publishing the item. If not specified then active gis user is taken.
compute_metrics
Optional boolean. Used for computing model metrics. Default is set to True.
save_optimizer
Optional boolean. Used for saving the model-optimizer state along with the model. Default is set to False Not applicable for models with spaCy backbone.
kwargs
Parameter
Description
overwrite
Optional boolean overwrite if True, it will overwrite the item on ArcGIS Online/Enterprise, default False.
zip_files
Optional boolean zip_files if True, it will create the Deep Learning Package (DLPK) file while saving the model.
Runs entity extraction on a random batch from the mentioned ds_type.
Parameter
Description
ds_type
Optional string, defaults to valid.
rows
Optional integer, defaults to 5. Number of rows to print.
Pandas DataFrame
Unfreezes the earlier layers of the model for fine-tuning.
This method is not supported when the backbone is configured as llm/mistral.
Creates a TextClassifier
Object.
To load a custom DLPK using the model extensibility support, instantiate an object of the class using from_model.
Based on the Hugging Face transformers library
kwargs
Parameter
Description
verbose
Optional string. Default set to error. The log level you want to set. It means the amount of information you want to display while training or calling the various methods of this class. Allowed values are - debug, info, warning, error and critical.
seq_len
Optional Integer. Default set to 512. Maximum sequence length (at sub-word level after tokenization) of the training data to be considered for training the model.
thresh
Optional Float. This parameter is used to set the threshold value to pick labels in case of multi-label text classification problem. Default value is set to 0.25
mixed_precision
Optional Bool. Default set to False. If set True, then mixed precision training is used to train the model
pretrained_path
Optional String. Path where pre-trained model is saved. Accepts a Deep Learning Package (DLPK) or Esri Model Definition(EMD) file.
prompt
Optional String. This parameter is applicable if the selected model backbone is from the LLM family.
This parameter outlines the task and its corresponding guardrails.
examples
Optional dictionary. The dictionaryâs keys represent labels or classes, with the corresponding values being lists of sentences belonging to each class.
This parameter is applicable if the selected model backbone is from the LLM family.
Pydantic notation
Optional[Dict[str, List]]
Example:
{
âLabel_1â :[example 1, example 2],
âLabel_2â : [example 1, example 2]
}
If examples are not supplied, a data object must be provided.
TextClassifier
Object
Calculates the following metric:
accuracy: the number of correctly predicted labels in the validation set divided by the total number of items in the validation set
a floating point number depicting the accuracy of the classification model.
Get available models for the given transformer backbone
a tuple containing the available models for the given transformer backbone
List of available metrics that are displayed in the training table. Set monitor value to be one of these while calling the fit method.
Train the model for the specified number of epochs and using the specified learning rates.
This method is not supported when the backbone is configured as llm/mistral.
Parameter
Description
epochs
Required integer. Number of cycles of training on the data. Increase it if underfitting.
lr
Optional float or slice of floats. Learning rate to be used for training the model. If lr=None
, an optimal learning rate is automatically deduced for training the model.
one_cycle
Optional boolean. Parameter to select 1cycle learning rate schedule. If set to False no learning rate schedule is used.
early_stopping
Optional boolean. Parameter to add early stopping. If set to âTrueâ training will stop if parameter monitor value stops improving for 5 epochs. A minimum difference of 0.001 is required for it to be considered an improvement.
checkpoint
Optional boolean or string. Parameter to save checkpoint during training. If set to True the best model based on monitor will be saved during training. If set to âallâ, all checkpoints are saved. If set to False, checkpointing will be off. Setting this parameter loads the best model at the end of training.
tensorboard
Optional boolean. Parameter to write the training log. If set to âTrueâ the log will be saved at <dataset-path>/training_log which can be visualized in tensorboard. Required tensorboardx version=2.1
The default value is âFalseâ.
Note
Not applicable for Text Models
monitor
Optional string. Parameter specifies which metric to monitor while checkpointing and early stopping. Defaults to âvalid_lossâ. Value should be one of the metric that is displayed in the training table. Use {model_name}.available_metrics to list the available metrics to set here.
Freeze up to last layer group to train only the last layer group of the model.
This method is not supported when the backbone is configured as llm/mistral.
Creates an TextClassifier model object from a Deep Learning Package(DLPK) or Esri Model Definition (EMD) file.
To load a custom DLPK using the model extensibility support, instantiate an object of the class using this method.
TextClassifier
model Object
Creates an TextClassifier model object from an already fine-tuned Hugging Face Transformer backbone.
This method is not supported when the backbone is configured as llm/mistral.
TextClassifier
Object
This method is not supported when the backbone is configured as llm/mistral.
get misclassified records for this classification model.
Loads a saved TextClassifier model from disk.
This method is not supported when the backbone is configured as llm/mistral and model extension.
To load a custom DLPK using the model extensibility support, instantiate an object of the class using from_model.
Parameter
Description
name_or_path
Required string. Path to Deep Learning Package (DLPK) or Esri Model Definition(EMD) file.
Runs the Learning Rate Finder. Helps in choosing the optimum learning rate for training the model.
This method is not supported when the backbone is configured as llm/mistral.
Parameter
Description
allow_plot
Optional boolean. Display the plot of losses against the learning rates and mark the optimal value of the learning rate on the plot. The default value is âTrueâ.
precision, recall and f1 score for each label in the classification model.
Plot validation and training losses after fitting the model.
This method is not supported when the backbone is configured as llm/mistral.
Predicts the class label(s) for the input text
Parameter
Description
text_or_list
Required String or List. text or a list of texts for which we wish to find the class label(s).
prompt
Optional String. This parameter is applicable if the selected model backbone is from the LLM family.
This parameter use to describe the task and guardrails for the task.
show_progress
Optional Bool. If set to True, will display a progress bar depicting the items processed so far. Applicable only when a list of text is passed
thresh
Optional Float. The threshold value set to get the class label(s). Applicable only for multi-label classification task. Default is the value set during the model creation time, otherwise the value of 0.25 is set.
explain
Optional Bool. If set to True it shall generate SHAP based explanation. Kindly visit:- https://shap.readthedocs.io/en/latest/
explain_index
Optional List. Index of the rows for which explanation is required. If the value is None, it will generate an explanation for every row.
batch_size
Optional integer. Number of inputs to be processed at once. Try reducing the batch size in case of out of memory errors. Default value : 64
kwargs
Parameter
Description
input_field
Optional string. Input field name in the feature set. Supported in model extension. Default value: input_str
In case of single label classification problem, a tuple containing the text, its predicted class label and the confidence score.
In case of multi label classification problem, a tuple containing the text, its predicted class labels, a list containing 1âs for the predicted labels, 0âs otherwise and list containing a score for each label
Saves the model weights, creates an Esri Model Definition and Deep Learning Package zip for deployment.
Parameter
Description
name_or_path
Required string. Folder path to save the model.
framework
Optional string. Defines the framework of the model. (Only supported by SingleShotDetector
, currently.) If framework used is TF-ONNX
, batch_size
can be passed as an optional keyword argument.
Framework choice: âPyTorchâ and âTF-ONNXâ
publish
Optional boolean. Publishes the DLPK as an item.
gis
Optional GIS
Object. Used for publishing the item. If not specified then active gis user is taken.
compute_metrics
Optional boolean. Used for computing model metrics.
save_optimizer
Optional boolean. Used for saving the model-optimizer state along with the model. Default is set to False.
kwargs
Parameter
Description
overwrite
Optional boolean overwrite if True, it will overwrite the item on ArcGIS Online/Enterprise, default False.
zip_files
Optional boolean zip_files if True, it will create the Deep Learning Package (DLPK) file while saving the model.
the qualified path at which the model is saved
Prints the rows of the dataframe with target and prediction columns.
Parameter
Description
rows
Optional Integer. Number of rows to print.
dataframe
Unfreezes the earlier layers of the model for fine-tuning.
This method is not supported when the backbone is configured as llm/mistral.
Creates a SequenceToSequence
Object. Based on the Hugging Face transformers library
To load a custom DLPK using the model extensibility support, instantiate an object of the class using from_model.
kwargs
Parameter
Description
verbose
Optional string. Default set to error. The log level you want to set. It means the amount of information you want to display while training or calling the various methods of this class. Allowed values are - debug, info, warning, error and critical.
seq_len
Optional Integer. Default set to 512. Maximum sequence length (at sub-word level after tokenization) of the training data to be considered for training the model.
mixed_precision
Optional Bool. Default set to False. If set True, then mixed precision training is used to train the model
pretrained_path
Optional String. Path where pre-trained model is saved. Accepts a Deep Learning Package (DLPK) or Esri Model Definition(EMD) file.
prompt
Optional String. This parameter is applicable if the selected model backbone is from the LLM family.
This parameter used to describe the task and guardrails for the task.
examples
Optional List of Tuples. It contains List of tuples. Each of the tuples has two elements which represents input and target sentence
This parameter is applicable if the selected model backbone is from the LLM family.
Pydantic notation
Optional[List[List[str, str]]]
Example:
[[âinput_1â, âoutput_1â]
, [âinput_2â, âoutput_2â]
]
If examples are not supplied, a data object must be provided.
SequenceToSequence
model object for sequence_translation task.
Get available models for the given transformer backbone
a tuple containing the available models for the given transformer backbone
List of available metrics that are displayed in the training table. Set monitor value to be one of these while calling the fit method.
Train the model for the specified number of epochs and using the specified learning rates.
This method is not supported when the backbone is configured as llm/mistral.
Parameter
Description
epochs
Required integer. Number of cycles of training on the data. Increase it if underfitting.
lr
Optional float or slice of floats. Learning rate to be used for training the model. If lr=None
, an optimal learning rate is automatically deduced for training the model.
one_cycle
Optional boolean. Parameter to select 1cycle learning rate schedule. If set to False no learning rate schedule is used.
early_stopping
Optional boolean. Parameter to add early stopping. If set to âTrueâ training will stop if parameter monitor value stops improving for 5 epochs. A minimum difference of 0.001 is required for it to be considered an improvement.
checkpoint
Optional boolean or string. Parameter to save checkpoint during training. If set to True the best model based on monitor will be saved during training. If set to âallâ, all checkpoints are saved. If set to False, checkpointing will be off. Setting this parameter loads the best model at the end of training.
tensorboard
Optional boolean. Parameter to write the training log. If set to âTrueâ the log will be saved at <dataset-path>/training_log which can be visualized in tensorboard. Required tensorboardx version=2.1
The default value is âFalseâ.
Note
Not applicable for Text Models
monitor
Optional string. Parameter specifies which metric to monitor while checkpointing and early stopping. Defaults to âvalid_lossâ. Value should be one of the metric that is displayed in the training table. Use {model_name}.available_metrics to list the available metrics to set here.
Freeze up to last layer group to train only the last layer group of the model.
This method is not supported when the backbone is configured as llm/mistral.
Creates an SequenceToSequence model object from a Deep Learning Package(DLPK) or Esri Model Definition (EMD) file.
To load a custom DLPK using the model extensibility support, instantiate an object of the class using this method.
Parameter
Description
emd_path
Required string. Path to Deep Learning Package (DLPK) or Esri Model Definition(EMD) file.
data
Optional fastai Databunch. Returned data object from prepare_textdata
function or None for inferencing. Default value: None
SequenceToSequence
Object
Calculates the following metrics:
accuracy: the number of correctly predicted labels in the validation set divided by the total number of items in the validation set
bleu-score This value indicates the similarity between model predictions and the ground truth text. Maximum value is 1
a dictionary containing the metrics for classification model.
Loads a saved SequenceToSequence model from disk.
This method is not supported when the backbone is configured as llm/mistral.
To load a custom DLPK using the model extensibility support, instantiate an object of the class using from_model.
Parameter
Description
name_or_path
Required string. Path to Deep Learning Package (DLPK) or Esri Model Definition(EMD) file.
Runs the Learning Rate Finder. Helps in choosing the optimum learning rate for training the model.
This method is not supported when the backbone is configured as llm/mistral.
Parameter
Description
allow_plot
Optional boolean. Display the plot of losses against the learning rates and mark the optimal value of the learning rate on the plot. The default value is âTrueâ.
Plot training and validation losses.
This method is not supported when the backbone is configured as llm/mistral.
Parameter
Description
show
Optional bool. Defaults to True If set to False, figure will not be plotted but will be returned, when set to True function will plot the figure and return nothing.
Predicts the translated outcome.
Parameter
Description
text_or_list
Required input string or list of input strings.
batch_size
Optional integer. Number of inputs to be processed at once. Try reducing the batch size in case of out of memory errors. Default value : 64
show_progress
Optional bool. To show or not to show the progress of prediction task. Default value : True
explain
Optional bool. To enable shap based importance Default value : False
explain_index
Optional list. Index of the input rows for which the importance score will be generated Default value : None
kwargs
Parameter
Description
num_beams
Optional integer. Number of beams for beam search. 1 means no beam search. Default value is set to 1.
max_length
Optional integer. The maximum length of the sequence to be generated. Default value is set to 20.
min_length
Optional integer. The minimum length of the sequence to be generated. Default value is set to 10.
input_field
Optional string. Input field name in the feature set. Supported in model extension. Default value: input_str
list of tuples(input , predicted output strings) or FeatureSet.
Saves the model weights, creates an Esri Model Definition and Deep Learning Package zip for deployment.
Parameter
Description
name_or_path
Required string. Folder path to save the model.
framework
Optional string. Defines the framework of the model. (Only supported by SingleShotDetector
, currently.) If framework used is TF-ONNX
, batch_size
can be passed as an optional keyword argument.
Framework choice: âPyTorchâ and âTF-ONNXâ
publish
Optional boolean. Publishes the DLPK as an item.
gis
Optional GIS
Object. Used for publishing the item. If not specified then active gis user is taken.
compute_metrics
Optional boolean. Used for computing model metrics.
save_optimizer
Optional boolean. Used for saving the model-optimizer state along with the model. Default is set to False.
kwargs
Parameter
Description
overwrite
Optional boolean overwrite if True, it will overwrite the item on ArcGIS Online/Enterprise, default False.
zip_files
Optional boolean zip_files if True, it will create the Deep Learning Package (DLPK) file while saving the model.
the qualified path at which the model is saved
Prints the rows of the dataframe with target and prediction columns.
Parameter
Description
rows
Optional Integer. Number of rows to print.
dataframe
Unfreezes the earlier layers of the model for fine-tuning.
This method is not supported when the backbone is configured as llm/mistral.
Creates a FillMask
Object. Based on the Hugging Face transformers library
Parameter
Description
backbone
Optional string. Specify the HuggingFace transformer model name which will be used to generate the suggestion token.
To learn more about the available models for fill-mask task, kindly visit:- https://huggingface.co/models?pipeline_tag=fill-mask
kwargs
Parameter
Description
pretrained_path
Option str. Path to a directory, where pretrained model files are saved. If pretrained_path is provided, the model is loaded from that path on the local disk.
working_dir
Option str. Path to a directory on local filesystem. If directory is not present, it will be created. This directory is used as the location to save the model.
FillMask
Object
Creates an SequenceToSequence
model object from an Esri Model Definition (EMD) file.
Parameter
Description
emd_path
Required string. Path to Esri Model Definition(EMD) file or the folder with saved model files.
SequenceToSequence
Object
Summarize the given text or list of text
Parameter
Description
text_or_list
Required string or list. A text/sentence or a list of texts/sentences for which on wishes to generate the recommendations for masked-token.
num_suggestions
Optional Integer. The number of suggestions to return. The maximum number of suggestion that can be generated for a missing-token is 10.
show_progress
optional Bool. If set to True, will display a progress bar depicting the items processed so far.
A list or a list of list of dict
: Each result comes as list of dictionaries with the following keys:
sequence (str
) â The corresponding input with the mask token prediction.
score (float
) â The corresponding probability.
token_str (str
) â The predicted token (to replace the masked one).
Saves the translator model files on a specified path on the local disk.
Parameter
Description
name_or_path
Required string. Path to save model files on the local disk.
Absolute path for the saved model
supported transformer architectures
Creates a QuestionAnswering
Object. Based on the Hugging Face transformers library
Parameter
Description
backbone
Optional string. Specify the HuggingFace transformer model name which will be used to extract the answers from a given passage/context.
To learn more about the available models for question-answering task, kindly visit:- https://huggingface.co/models?pipeline_tag=question-answering
kwargs
Parameter
Description
pretrained_path
Option str. Path to a directory, where pretrained model files are saved. If pretrained_path is provided, the model is loaded from that path on the local disk.
working_dir
Option str. Path to a directory on local filesystem. If directory is not present, it will be created. This directory is used as the location to save the model.
QuestionAnswering
Object
Creates an SequenceToSequence
model object from an Esri Model Definition (EMD) file.
Parameter
Description
emd_path
Required string. Path to Esri Model Definition(EMD) file or the folder with saved model files.
SequenceToSequence
Object
Find answers for the asked questions from the given passage/context
Parameter
Description
text_or_list
Required string or list. Questions or a list of questions one wishes to seek an answer for.
context
Required string. The context associated with the question(s) which contains the answers.
show_progress
optional Bool. If set to True, will display a progress bar depicting the items processed so far.
explain
optional Bool. If set to True, will generate a shap based explanation
explain_start_word
optional Bool. E.g. Context: Point cloud datasets are typically collected using Lidar sensors ( light detection and ranging ) Question: âHow is Point cloud dataset collected?â Answer: Lidar Sensors
If set to True, will generate a shap based explanation for start word. if set to False, will generate explanation for last word of the answer.
In the above example, if the value of explain_start_word is True, it will generate the importance of different context words that leads to selection of âLidarâ as a starting word of the span. If explain_start_word is set to False then it will generate explanation for the word sensors
explain_index
optional List. Index of the question for which answer needs to be generated
kwargs
Parameter
Description
num_answers
Optional integer. The number of answers to return. The answers will be chosen by order of likelihood. Default value is set to 1.
max_answer_length
Optional integer. The maximum length of the predicted answers. Default value is set to 15.
max_question_length
Optional integer. The maximum length of the question after tokenization. Questions will be truncated if needed. Default value is set to 64.
impossible_answer
Optional bool. Whether or not we accept impossible as an answer. Default value is set to False
a list or a list of list containing the answer(s) for the input question(s)
Saves the translator model files on a specified path on the local disk.
Parameter
Description
name_or_path
Required string. Path to save model files on the local disk.
Absolute path for the saved model
supported transformer architectures
Creates a TextGenerator
Object. Based on the Hugging Face transformers library
kwargs
Parameter
Description
pretrained_path
Option str. Path to a directory, where pretrained model files are saved. If pretrained_path is provided, the model is loaded from that path on the local disk.
working_dir
Option str. Path to a directory on local filesystem. If directory is not present, it will be created. This directory is used as the location to save the model.
TextGenerator
Object
Creates an SequenceToSequence
model object from an Esri Model Definition (EMD) file.
Parameter
Description
emd_path
Required string. Path to Esri Model Definition(EMD) file or the folder with saved model files.
SequenceToSequence
Object
Generate text(s) for a text or a list of incomplete sentence(s)
Parameter
Description
text_or_list
Required string or list. A text/sentence or a list of texts/sentences to complete.
show_progress
optional Bool. If set to True, will display a progress bar depicting the items processed so far.
kwargs
Parameter
Description
min_length
Optional integer. The minimum length of the sequence to be generated. Default value is set to to min_length parameter of the model config.
max_length
Optional integer. The maximum length of the sequence to be generated. Default value is set to max_length parameter of the model config.
num_return_sequences
Optional integer. The number of independently computed returned sequences for each element in the batch. Default value is set to 1.
num_beams
Optional integer. Number of beams for beam search. 1 means no beam search. Default value is set to 1.
length_penalty
Optional float. Exponential penalty to the length. 1.0 means no penalty. Set to values < 1.0 in order to encourage the model to generate shorter sequences, to a value > 1.0 in order to encourage the model to produce longer sequences. Default value is set to 1.0.
early_stopping
Optional bool. Whether to stop the beam search when at least num_beams
sentences are finished per batch or not. Default value is set to False.
a list or a list of list containing the generated text for the input prompt(s) / sentence(s)
Saves the translator model files on a specified path on the local disk.
Parameter
Description
name_or_path
Required string. Path to save model files on the local disk.
Absolute path for the saved model
supported transformer architectures
Creates a TextSummarizer
Object. Based on the Hugging Face transformers library
kwargs
Parameter
Description
pretrained_path
Option str. Path to a directory, where pretrained model files are saved. If pretrained_path is provided, the model is loaded from that path on the local disk.
working_dir
Option str. Path to a directory on local filesystem. If directory is not present, it will be created. This directory is used as the location to save the model.
TextSummarizer
Object
Creates an SequenceToSequence
model object from an Esri Model Definition (EMD) file.
Parameter
Description
emd_path
Required string. Path to Esri Model Definition(EMD) file or the folder with saved model files.
SequenceToSequence
Object
Saves the translator model files on a specified path on the local disk.
Parameter
Description
name_or_path
Required string. Path to save model files on the local disk.
Absolute path for the saved model
Summarize the given text or list of text
Parameter
Description
text_or_list
Required string or list. A text/passage or a list of texts/passages to generate the summary for.
show_progress
optional Bool. If set to True, will display a progress bar depicting the items processed so far.
kwargs
Parameter
Description
min_length
Optional integer. The minimum length of the sequence to be generated. Default value is set to to min_length parameter of the model config.
max_length
Optional integer. The maximum length of the sequence to be generated. Default value is set to to max_length parameter of the model config.
num_return_sequences
Optional integer. The number of independently computed returned sequences for each element in the batch. Default value is set to 1.
num_beams
Optional integer. Number of beams for beam search. 1 means no beam search. Default value is set to 1.
length_penalty
Optional float. Exponential penalty to the length. 1.0 means no penalty. Set to values < 1.0 in order to encourage the model to generate shorter sequences, to a value > 1.0 in order to encourage the model to produce longer sequences. Default value is set to 1.0.
early_stopping
Optional bool. Whether to stop the beam search when at least num_beams
sentences are finished per batch or not. Default value is set to False.
a list or a list of list containing the summary/summaries for the input prompt(s) / sentence(s)
supported transformer architectures
Creates a TextTranslator
Object. Based on the Hugging Face transformers library To learn more about the available models for translation task, kindly visit:- https://huggingface.co/models?pipeline_tag=translation&search=Helsinki
Parameter
Description
source_language
Optional string. Specify the language of the text you would like to get the translation of. Default value is âesâ (Spanish)
target_language
Optional string. The language into which one wishes to translate the input text. Default value is âenâ (English)
kwargs
Parameter
Description
pretrained_path
Option str. Path to a directory, where pretrained model files are saved. If pretrained_path is provided, the model is loaded from that path on the local disk.
working_dir
Option str. Path to a directory on local filesystem. If directory is not present, it will be created. This directory is used as the location to save the model.
TextTranslator
Object
Creates an SequenceToSequence
model object from an Esri Model Definition (EMD) file.
Parameter
Description
emd_path
Required string. Path to Esri Model Definition(EMD) file or the folder with saved model files.
SequenceToSequence
Object
Saves the translator model files on a specified path on the local disk.
Parameter
Description
name_or_path
Required string. Path to save model files on the local disk.
Absolute path for the saved model
supported transformer architectures
Translate the given text or list of text into the target language
Parameter
Description
text_or_list
Required string or list. A text/passage or a list of texts/passages to translate.
show_progress
optional Bool. If set to True, will display a progress bar depicting the items processed so far.
kwargs
Parameter
Description
min_length
Optional integer. The minimum length of the sequence to be generated. Default value is set to to min_length parameter of the model config.
max_length
Optional integer. The maximum length of the sequence to be generated. Default value is set to to max_length parameter of the model config.
num_return_sequences
Optional integer. The number of independently computed returned sequences for each element in the batch. Default value is set to 1.
num_beams
Optional integer. Number of beams for beam search. 1 means no beam search. Default value is set to 1.
length_penalty
Optional float. Exponential penalty to the length. 1.0 means no penalty. Set to values < 1.0 in order to encourage the model to generate shorter sequences, to a value > 1.0 in order to encourage the model to produce longer sequences. Default value is set to 1.0.
early_stopping
Optional bool. Whether to stop the beam search when at least num_beams
sentences are finished per batch or not. Default value is set to False.
a list or a list of list containing the translation of the input prompt(s) / sentence(s) to the target language
Creates a ZeroShotClassifier
Object. Based on the Hugging Face transformers library
kwargs
Parameter
Description
pretrained_path
Option str. Path to a directory, where pretrained model files are saved. If pretrained_path is provided, the model is loaded from that path on the local disk.
working_dir
Option str. Path to a directory on local filesystem. If directory is not present, it will be created. This directory is used as the location to save the model.
ZeroShotClassifier
Object
Creates an SequenceToSequence
model object from an Esri Model Definition (EMD) file.
Parameter
Description
emd_path
Required string. Path to Esri Model Definition(EMD) file or the folder with saved model files.
SequenceToSequence
Object
Predicts the class label(s) for the input text
Parameter
Description
text_or_list
Required string or list. The sequence or a list of sequences to classify.
candidate_labels
Required string or list. The set of possible class labels to classify each sequence into. Can be a single label, a string of comma-separated labels, or a list of labels.
show_progress
optional Bool. If set to True, will display a progress bar depicting the items processed so far.
kwargs
Parameter
Description
multi_class
Optional boolean. Whether or not multiple candidate labels can be true. Default value is set to False.
hypothesis
Optional string. The template used to turn each label into an NLI-style hypothesis. This template must include a {} or similar syntax for the candidate label to be inserted into the template. Default value is set to âThis example is {}.â.
a list of dict
: Each result comes as a dictionary with the following keys:
sequence (str
) â The sequence for which this is the output.
labels (List[str]
) â The labels sorted by order of likelihood.
scores (List[float]
) â The probabilities for each of the labels.
Saves the translator model files on a specified path on the local disk.
Parameter
Description
name_or_path
Required string. Path to save model files on the local disk.
Absolute path for the saved model
supported transformer architectures
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4