Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions doc/algorithms/audio/audioembedding_tensorflow.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
##################################
Audio Embedding - Tensorflow
##################################

This is an audio embedding algorithm which supports many pre-trained models available in Tensorflow Hub. The following
`sample notebook <https://github.com/aws/amazon-sagemaker-examples/blob/main/introduction_to_amazon_algorithms/jumpstart_image_classification/Amazon_JumpStart_Image_Classification.ipynb>`__
demonstrates how to use the Sagemaker Python SDK for Image Classification for using these algorithms.

For detailed documentation please refer :ref:`Use Built-in Algorithms with Pre-trained Models in SageMaker Python SDK <built-in-algos>`
10 changes: 10 additions & 0 deletions doc/algorithms/audio/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
######################
Audio
######################

Amazon SageMaker provides audio processing algorithms that are used for embedding.

.. toctree::
:maxdepth: 2

audioembedding_tensorflow
1 change: 1 addition & 0 deletions doc/algorithms/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ Built-in algorithms are offered in 2 modes:
time_series/index
unsupervised/index
vision/index
audio/index
5 changes: 4 additions & 1 deletion doc/algorithms/text/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@ Amazon SageMaker provides algorithms that are tailored to the analysis of textua
text_classification_tensorflow
sentence_pair_classification_tensorflow
sentence_pair_classification_hugging_face
question_answering_pytorch
question_answering_hugging_face
named_entity_recognition_hugging_face
text_summarization_hugging_face
text_generation_hugging_face
machine_translation_hugging_face
text_classification_hugging_face
txt2img_hugging_face
zstc_hugging_face
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#####################################
Question Answering - PyTorch
Question Answering - HuggingFace
#####################################

This is a supervised question answering algorithm which supports fine-tuning of many pre-trained models available in Hugging Face. The following
Expand Down
9 changes: 9 additions & 0 deletions doc/algorithms/text/text_classification_hugging_face.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
##################################
Text Classification - HuggingFace
##################################

This is a text classification algorithm which supports many pre-trained models available in HuggingFace Hub. The following
`sample notebook <https://github.com/aws/amazon-sagemaker-examples/blob/main/introduction_to_amazon_algorithms/jumpstart_text_classification/Amazon_JumpStart_Text_Classification.ipynb>`__
demonstrates how to use the Sagemaker Python SDK for Text Classification for using these algorithms.

For detailed documentation please refer :ref:`Use Built-in Algorithms with Pre-trained Models in SageMaker Python SDK <built-in-algos>`
9 changes: 9 additions & 0 deletions doc/algorithms/text/txt2img_hugging_face.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
##################################
Text to Image - HuggingFace
##################################

This is a text to image algorithm which supports many pre-trained models available in HuggingFace Hub. The following
`sample notebook <https://github.com/aws/amazon-sagemaker-examples/blob/main/introduction_to_amazon_algorithms/jumpstart_text_classification/Amazon_JumpStart_Text_Classification.ipynb>`__
demonstrates how to use the Sagemaker Python SDK for Text Classification for using these algorithms.

For detailed documentation please refer :ref:`Use Built-in Algorithms with Pre-trained Models in SageMaker Python SDK <built-in-algos>`
9 changes: 9 additions & 0 deletions doc/algorithms/text/zstc_hugging_face.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
################################################
Zero-Shot Text Classification - HuggingFace
################################################

This is a zero-shot text classification algorithm which supports many pre-trained models available in HuggingFace Hub. The following
`sample notebook <https://github.com/aws/amazon-sagemaker-examples/blob/main/introduction_to_amazon_algorithms/jumpstart_text_classification/Amazon_JumpStart_Text_Classification.ipynb>`__
demonstrates how to use the Sagemaker Python SDK for Text Classification for using these algorithms.

For detailed documentation please refer :ref:`Use Built-in Algorithms with Pre-trained Models in SageMaker Python SDK <built-in-algos>`
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ This is a supervised image clasification algorithm which supports fine-tuning of
`sample notebook <https://github.com/aws/amazon-sagemaker-examples/blob/main/introduction_to_amazon_algorithms/jumpstart_image_classification/Amazon_JumpStart_Image_Classification.ipynb>`__
demonstrates how to use the Sagemaker Python SDK for Image Classification for using these algorithms.

For detailed documentation please refer :ref:`Use Built-in Algorithms with Pre-trained Models in SageMaker Python SDK <built-in-algos>`
For detailed documentation please refer `Use Amazon SageMaker Built-in Algorithms or Pre-trained Models <https://docs.aws.amazon.com/sagemaker/latest/dg/algos.html>`__
4 changes: 3 additions & 1 deletion doc/algorithms/vision/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@ Amazon SageMaker provides image processing algorithms that are used for image cl
object_detection_mxnet
semantic_segmentation_mxnet_gluoncv
semantic_segmentation_mxnet
text_embedding_tensorflow_mxnet
text_embedding_tensorflow
text_embedding_mxnet
upscaling_hugging_face
2 changes: 1 addition & 1 deletion doc/algorithms/vision/object_detection_tensorflow.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ This is a supervised object detection algorithm which supports fine-tuning of ma
`sample notebook <https://github.com/aws/amazon-sagemaker-examples/blob/main/introduction_to_amazon_algorithms/jumpstart_object_detection/Amazon_JumpStart_Object_Detection.ipynb>`__
demonstrates how to use the Sagemaker Python SDK for Object Detection for using these algorithms.

For detailed documentation please refer :ref:`Use Built-in Algorithms with Pre-trained Models in SageMaker Python SDK <built-in-algos>`
For detailed documentation please refer `Use Amazon SageMaker Built-in Algorithms or Pre-trained Models <https://docs.aws.amazon.com/sagemaker/latest/dg/algos.html>`__
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
####################################
Text Embedding - TensorFlow, MxNet
Text Embedding - MxNet
####################################

This is a supervised text embedding algorithm which supports many pre-trained models available in MXNet and Tensorflow Hub. The following
This is a supervised text embedding algorithm which supports many pre-trained models available in MXNet Hub. The following
`sample notebook <https://github.com/aws/amazon-sagemaker-examples/blob/main/introduction_to_amazon_algorithms/jumpstart_text_embedding/Amazon_JumpStart_Text_Embedding.ipynb>`__
demonstrates how to use the Sagemaker Python SDK for Text Embedding for using these algorithms.

Expand Down
9 changes: 9 additions & 0 deletions doc/algorithms/vision/text_embedding_tensorflow.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
####################################
Text Embedding - TensorFlow
####################################

This is a supervised text embedding algorithm which supports many pre-trained models available in Tensorflow Hub. The following
`sample notebook <https://github.com/aws/amazon-sagemaker-examples/blob/main/introduction_to_amazon_algorithms/jumpstart_text_embedding/Amazon_JumpStart_Text_Embedding.ipynb>`__
demonstrates how to use the Sagemaker Python SDK for Text Embedding for using these algorithms.

For detailed documentation please refer :ref:`Use Built-in Algorithms with Pre-trained Models in SageMaker Python SDK <built-in-algos>`
9 changes: 9 additions & 0 deletions doc/algorithms/vision/upscaling_hugging_face.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
##################################
Image Upscaling - HuggingFace
##################################

This is a image upscaling algorithm which supports many pre-trained models available in HuggingFace Hub. The following
`sample notebook <https://github.com/aws/amazon-sagemaker-examples/blob/main/introduction_to_amazon_algorithms/jumpstart_image_classification/Amazon_JumpStart_Image_Classification.ipynb>`__
demonstrates how to use the Sagemaker Python SDK for Image Classification for using these algorithms.

For detailed documentation please refer :ref:`Use Built-in Algorithms with Pre-trained Models in SageMaker Python SDK <built-in-algos>`
78 changes: 69 additions & 9 deletions doc/doc_utils/jumpstart_doc_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ class Tasks(str, Enum):
TEXT_GENERATION = "textgeneration"
IC_EMBEDDING = "icembedding"
TC_EMBEDDING = "tcembedding"
AUDIO_EMBEDDING = "audioembedding"
TXT2IMG = "txt2img"
UPSCALING = "upscaling"
ZSTC = "zstc"
NER = "ner"
SUMMARIZATION = "summarization"
TRANSLATION = "translation"
Expand Down Expand Up @@ -116,14 +120,16 @@ class Frameworks(str, Enum):
(Tasks.IS, Frameworks.GLUONCV): "algorithms/vision/instance_segmentation_mxnet.rst",
(Tasks.OD, Frameworks.GLUONCV): "algorithms/vision/object_detection_mxnet.rst",
(Tasks.OD, Frameworks.PYTORCH): "algorithms/vision/object_detection_pytorch.rst",
(Tasks.OD1, Frameworks.PYTORCH): "algorithms/vision/object_detection_pytorch.rst",
(Tasks.OD, Frameworks.TENSORFLOW): "algorithms/vision/object_detection_tensorflow.rst",
(Tasks.OD1, Frameworks.TENSORFLOW): "algorithms/vision/object_detection_tensorflow.rst",
(Tasks.SEMSEG, Frameworks.GLUONCV): "algorithms/vision/semantic_segmentation_mxnet.rst",
(
Tasks.TRANSLATION,
Frameworks.HUGGINGFACE,
): "algorithms/text/machine_translation_hugging_face.rst",
(Tasks.NER, Frameworks.GLUONCV): "algorithms/text/named_entity_recognition_hugging_face.rst",
(Tasks.EQA, Frameworks.PYTORCH): "algorithms/text/question_answering_pytorch.rst",
(Tasks.NER, Frameworks.HUGGINGFACE): "algorithms/text/named_entity_recognition_hugging_face.rst",
(Tasks.EQA, Frameworks.HUGGINGFACE): "algorithms/text/question_answering_hugging_face.rst",
(
Tasks.SPC,
Frameworks.HUGGINGFACE,
Expand All @@ -136,11 +142,11 @@ class Frameworks(str, Enum):
(
Tasks.TC_EMBEDDING,
Frameworks.GLUONCV,
): "algorithms/vision/text_embedding_tensorflow_mxnet.rst",
): "algorithms/vision/text_embedding_mxnet.rst",
(
Tasks.TC_EMBEDDING,
Frameworks.TENSORFLOW,
): "algorithms/vision/text_embedding_tensorflow_mxnet.rst",
): "algorithms/vision/text_embedding_tensorflow.rst",
(
Tasks.TEXT_GENERATION,
Frameworks.HUGGINGFACE,
Expand All @@ -149,8 +155,60 @@ class Frameworks(str, Enum):
Tasks.SUMMARIZATION,
Frameworks.HUGGINGFACE,
): "algorithms/text/text_summarization_hugging_face.rst",
(
Tasks.ZSTC,
Frameworks.HUGGINGFACE,
): "algorithms/text/zstc_hugging_face.rst",
(
Tasks.TXT2IMG,
Frameworks.HUGGINGFACE,
): "algorithms/text/txt2img_hugging_face.rst",
(
Tasks.UPSCALING,
Frameworks.HUGGINGFACE,
): "algorithms/vision/upscaling_hugging_face.rst",
(
Tasks.AUDIO_EMBEDDING,
Frameworks.TENSORFLOW,
): "algorithms/audio/audioembedding_tensorflow.rst",
}

SAMPLE_NOTEBOOK_MODALITY_MAP = {
(Tasks.IC): "https://github.com/aws/amazon-sagemaker-examples/blob/main/introduction_to_amazon_algorithms/jumpstart_image_classification/Amazon_JumpStart_Image_Classification.ipynb",
(Tasks.IC_EMBEDDING): "https://github.com/aws/amazon-sagemaker-examples/blob/main/introduction_to_amazon_algorithms/jumpstart_image_embedding/Amazon_JumpStart_Image_Embedding.ipynb",
(Tasks.IS): "https://github.com/aws/amazon-sagemaker-examples/blob/main/introduction_to_amazon_algorithms/jumpstart_instance_segmentation/Amazon_JumpStart_Instance_Segmentation.ipynb",
(Tasks.OD): "https://github.com/aws/amazon-sagemaker-examples/blob/main/introduction_to_amazon_algorithms/jumpstart_object_detection/Amazon_JumpStart_Object_Detection.ipynb",
(Tasks.OD1): "https://github.com/aws/amazon-sagemaker-examples/blob/main/introduction_to_amazon_algorithms/jumpstart_object_detection/Amazon_JumpStart_Object_Detection.ipynb",
(Tasks.SEMSEG): "https://github.com/aws/amazon-sagemaker-examples/blob/main/introduction_to_amazon_algorithms/jumpstart_semantic_segmentation/Amazon_JumpStart_Semantic_Segmentation.ipynb",
(Tasks.TRANSLATION): "https://github.com/aws/amazon-sagemaker-examples/blob/main/introduction_to_amazon_algorithms/jumpstart_machine_translation/Amazon_JumpStart_Machine_Translation.ipynb",
(Tasks.NER): "https://github.com/aws/amazon-sagemaker-examples/blob/main/introduction_to_amazon_algorithms/jumpstart_named_entity_recognition/Amazon_JumpStart_Named_Entity_Recognition.ipynb",
(Tasks.EQA): "https://github.com/aws/amazon-sagemaker-examples/blob/main/introduction_to_amazon_algorithms/jumpstart_question_answering/Amazon_JumpStart_Question_Answering.ipynb",
(Tasks.SPC): "https://github.com/aws/amazon-sagemaker-examples/blob/main/introduction_to_amazon_algorithms/jumpstart_sentence_pair_classification/Amazon_JumpStart_Sentence_Pair_Classification.ipynb",
(Tasks.TC): "https://github.com/aws/amazon-sagemaker-examples/blob/main/introduction_to_amazon_algorithms/jumpstart_text_classification/Amazon_JumpStart_Text_Classification.ipynb",
(Tasks.TC_EMBEDDING): "https://github.com/aws/amazon-sagemaker-examples/blob/main/introduction_to_amazon_algorithms/jumpstart_text_embedding/Amazon_JumpStart_Text_Embedding.ipynb",
(Tasks.TEXT_GENERATION): "https://github.com/aws/amazon-sagemaker-examples/blob/main/introduction_to_amazon_algorithms/jumpstart_text_generation/Amazon_JumpStart_Text_Generation.ipynb",
(Tasks.SUMMARIZATION): "https://github.com/aws/amazon-sagemaker-examples/blob/main/introduction_to_amazon_algorithms/jumpstart_text_summarization/Amazon_JumpStart_Text_Summarization.ipynb",
# TODO: Find notebook link for this task
(Tasks.ZSTC): "https://www.amazon.com/",
(Tasks.TXT2IMG): "https://github.com/aws/amazon-sagemaker-examples/blob/main/introduction_to_amazon_algorithms/jumpstart_text_to_image/Amazon_JumpStart_Text_To_Image.ipynb",
# TODO: Find notebook link for this task
(Tasks.UPSCALING): "https://www.amazon.com/",
# TODO: Find notebook link for this task
(Tasks.AUDIO_EMBEDDING): "https://www.amazon.com/",
}

SAMPLE_TENSORFLOW_NOTEBOOK_MODALITY_MAP = {
(Tasks.IC): "https://github.com/aws/amazon-sagemaker-examples/blob/main/introduction_to_amazon_algorithms/image_classification_tensorflow/Amazon_TensorFlow_Image_Classification.ipynb",
(Tasks.OD): "https://github.com/aws/amazon-sagemaker-examples/blob/main/introduction_to_amazon_algorithms/object_detection_tensorflow/Amazon_Tensorflow_Object_Detection.ipynb",
(Tasks.OD1): "https://github.com/aws/amazon-sagemaker-examples/blob/main/introduction_to_amazon_algorithms/object_detection_tensorflow/Amazon_Tensorflow_Object_Detection.ipynb",
}

def get_sample_notebook_url(task, framework):
if (framework == Frameworks.TENSORFLOW and task in SAMPLE_TENSORFLOW_NOTEBOOK_MODALITY_MAP):
return SAMPLE_TENSORFLOW_NOTEBOOK_MODALITY_MAP[task]
else:
return SAMPLE_NOTEBOOK_MODALITY_MAP[task]


def get_jumpstart_sdk_manifest():
url = "{}/{}".format(JUMPSTART_BUCKET_BASE_URL, SDK_MANIFEST_FILE)
Expand All @@ -170,13 +228,12 @@ def get_model_task(id):
task_short = id.split("-")[1]
return TASK_MAP[task_short] if task_short in TASK_MAP else "Source"


def get_string_model_task(id):
return id.split("-")[1]


def get_model_source(url):
if "tfhub" in url:
if "tfhub" in url or "tensorflow" in url:
return "Tensorflow Hub"
if "pytorch" in url:
return "Pytorch Hub"
Expand Down Expand Up @@ -208,7 +265,6 @@ def create_jumpstart_model_table():
sdk_manifest_top_versions_for_models[model["model_id"]]["version"]
) < Version(model["version"]):
sdk_manifest_top_versions_for_models[model["model_id"]] = model

file_content_intro = []

file_content_intro.append(".. _all-pretrained-models:\n\n")
Expand Down Expand Up @@ -274,15 +330,16 @@ def create_jumpstart_model_table():
):
file_content_single_entry.append("\n")
file_content_single_entry.append(".. list-table:: Available Models\n")
file_content_single_entry.append(" :widths: 50 20 20 20 20\n")
file_content_single_entry.append(" :widths: 50 20 20 20 20 20\n")
file_content_single_entry.append(" :header-rows: 1\n")
file_content_single_entry.append(" :class: datatable\n")
file_content_single_entry.append("\n")
file_content_single_entry.append(" * - Model ID\n")
file_content_single_entry.append(" - Fine Tunable?\n")
file_content_single_entry.append(" - Latest Version\n")
file_content_single_entry.append(" - Min SDK Version\n")
file_content_single_entry.append(" - Source\n")
file_content_single_entry.append(" - Sample Notebook\n")
file_content_single_entry.append(" - Original Source\n")

dynamic_table_files.append(
MODALITY_MAP[(string_model_task, TO_FRAMEWORK[model_source])]
Expand All @@ -292,6 +349,9 @@ def create_jumpstart_model_table():
file_content_single_entry.append(" - {}\n".format(model_spec["training_supported"]))
file_content_single_entry.append(" - {}\n".format(model["version"]))
file_content_single_entry.append(" - {}\n".format(model["min_version"]))
file_content_single_entry.append(
" - `{} <{}>`__\n".format("Sample Notebook", get_sample_notebook_url(string_model_task, TO_FRAMEWORK[model_source]))
)
file_content_single_entry.append(
" - `{} <{}>`__\n".format(model_source, model_spec["url"])
)
Expand Down