From 2d5fa963b0c563da1f9c653eb1cf779049dd961b Mon Sep 17 00:00:00 2001 From: "Tim D. Smith" Date: Thu, 19 Dec 2024 10:58:58 -0800 Subject: [PATCH 01/13] attempt torchserve build --- recipes/torchserve/meta.yaml | 51 ++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 recipes/torchserve/meta.yaml diff --git a/recipes/torchserve/meta.yaml b/recipes/torchserve/meta.yaml new file mode 100644 index 0000000000000..4ca839f25106d --- /dev/null +++ b/recipes/torchserve/meta.yaml @@ -0,0 +1,51 @@ +{% set name = "torchserve" %} +{% set version = "0.12.0" %} + +package: + name: {{ name|lower }} + version: {{ version }} + +source: + url: https://github.com/pytorch/serve/archive/v{{ version }}.tar.gz + sha256: d5eb31a540b6a1dea4ead5c8b122d8b7d40b06fe2fc257ba67ed5b071852be0b + +build: + noarch: python + script: {{ PYTHON }} -m pip install . -vv + number: 0 + entry_points: + - torchserve = ts.model_server:start + +requirements: + build: + - gradle + host: + - python {{ python_min }} + - pip + - setuptools + - openjdk + run: + - python >={{ python_min }} + - pillow + - psutil + +test: + commands: + - torchserve -v + requires: + - python {{ python_min }} + +about: + home: https://github.com/simplejson/simplejson + summary: 'Performant, flexible and easy to use tool for serving PyTorch models in production.' + description: | + TorchServe is a performant, flexible and easy to use tool for serving PyTorch models in production. + license: Apache-2.0 + license_file: LICENSE + # The doc_url and dev_url are optional. + doc_url: https://pytorch.org/serve/index.html + dev_url: https://github.com/pytorch/serve + +extra: + recipe-maintainers: + - tdsmith From 029cf3a8c6250480d825aed64c1b65f5c680b7a2 Mon Sep 17 00:00:00 2001 From: "Tim D. Smith" Date: Thu, 19 Dec 2024 11:54:27 -0800 Subject: [PATCH 02/13] constrain build openjdk --- recipes/torchserve/meta.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/torchserve/meta.yaml b/recipes/torchserve/meta.yaml index 4ca839f25106d..0cda4c0abc523 100644 --- a/recipes/torchserve/meta.yaml +++ b/recipes/torchserve/meta.yaml @@ -19,6 +19,7 @@ build: requirements: build: - gradle + - openjdk <=19 host: - python {{ python_min }} - pip From 2329e322f35cc4a275411214f98b06be6645d9a6 Mon Sep 17 00:00:00 2001 From: "Tim D. Smith" Date: Thu, 19 Dec 2024 12:05:58 -0800 Subject: [PATCH 03/13] fix pin, editorialize --- recipes/torchserve/meta.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/recipes/torchserve/meta.yaml b/recipes/torchserve/meta.yaml index 0cda4c0abc523..8476c811d3c1a 100644 --- a/recipes/torchserve/meta.yaml +++ b/recipes/torchserve/meta.yaml @@ -19,7 +19,10 @@ build: requirements: build: - gradle - - openjdk <=19 + # openjdk should be compatible with the gradle version selected in + # https://github.com/pytorch/serve/blob/master/frontend/gradle/wrapper/gradle-wrapper.properties + # see https://docs.gradle.org/current/userguide/compatibility.html + - openjdk <20 host: - python {{ python_min }} - pip From 21b27d0dc0f55c39504ae52ee4eee1943b71e2e6 Mon Sep 17 00:00:00 2001 From: "Tim D. Smith" Date: Thu, 19 Dec 2024 12:15:44 -0800 Subject: [PATCH 04/13] Remove comment --- recipes/torchserve/meta.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/recipes/torchserve/meta.yaml b/recipes/torchserve/meta.yaml index 8476c811d3c1a..64964570cc82d 100644 --- a/recipes/torchserve/meta.yaml +++ b/recipes/torchserve/meta.yaml @@ -46,7 +46,6 @@ about: TorchServe is a performant, flexible and easy to use tool for serving PyTorch models in production. license: Apache-2.0 license_file: LICENSE - # The doc_url and dev_url are optional. doc_url: https://pytorch.org/serve/index.html dev_url: https://github.com/pytorch/serve From f915aab49f849a6f64c3d0f4ff5fc01a3c283a6f Mon Sep 17 00:00:00 2001 From: "Tim D. Smith" Date: Thu, 19 Dec 2024 13:30:40 -0800 Subject: [PATCH 05/13] Remove simplejson reference --- recipes/torchserve/meta.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/recipes/torchserve/meta.yaml b/recipes/torchserve/meta.yaml index 64964570cc82d..06e3908575281 100644 --- a/recipes/torchserve/meta.yaml +++ b/recipes/torchserve/meta.yaml @@ -2,7 +2,7 @@ {% set version = "0.12.0" %} package: - name: {{ name|lower }} + name: torchserve version: {{ version }} source: @@ -40,13 +40,13 @@ test: - python {{ python_min }} about: - home: https://github.com/simplejson/simplejson + home: https://pytorch.org/serve/ summary: 'Performant, flexible and easy to use tool for serving PyTorch models in production.' description: | TorchServe is a performant, flexible and easy to use tool for serving PyTorch models in production. license: Apache-2.0 license_file: LICENSE - doc_url: https://pytorch.org/serve/index.html + doc_url: https://pytorch.org/serve/ dev_url: https://github.com/pytorch/serve extra: From 1a32fadccf87fd4dbf2a0e1d5f2546b57a0fcccc Mon Sep 17 00:00:00 2001 From: "Tim D. Smith" Date: Thu, 19 Dec 2024 15:08:47 -0800 Subject: [PATCH 06/13] Add a model-archiver recipe --- recipes/torch-model-archiver/meta.yaml | 45 ++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 recipes/torch-model-archiver/meta.yaml diff --git a/recipes/torch-model-archiver/meta.yaml b/recipes/torch-model-archiver/meta.yaml new file mode 100644 index 0000000000000..bf9635ec60cdf --- /dev/null +++ b/recipes/torch-model-archiver/meta.yaml @@ -0,0 +1,45 @@ +{% set torchserve_version = "0.12.0" %} + +package: + name: torchserve-model-archiver + version: {{ load_file_regex("model-archiver/model_archiver/version.txt". ".*")[0] }} + +source: + url: https://github.com/pytorch/serve/archive/v{{ torchserve_version }}.tar.gz + sha256: d5eb31a540b6a1dea4ead5c8b122d8b7d40b06fe2fc257ba67ed5b071852be0b + +build: + noarch: python + script: {{ PYTHON }} -m pip install model-archiver/ -vv + number: 0 + entry_points: + - torch-model-archiver = model_archiver.model_packaging:generate_model_archive + +requirements: + host: + - python {{ python_min }} + - pip + - setuptools + run: + - python >={{ python_min }} + - enum-compat + +test: + commands: + - torch-model-archiver -v + requires: + - python {{ python_min }} + +about: + home: https://github.com/pytorch/serve/blob/master/model-archiver/README.md + summary: 'Performant, flexible and easy to use tool for serving PyTorch models in production.' + description: | + TorchServe is a performant, flexible and easy to use tool for serving PyTorch models in production. + license: Apache-2.0 + license_file: LICENSE + doc_url: https://pytorch.org/serve/ + dev_url: https://github.com/pytorch/serve + +extra: + recipe-maintainers: + - tdsmith From 2e3fd800d6c6622705c76042cee173d316b079e2 Mon Sep 17 00:00:00 2001 From: "Tim D. Smith" Date: Thu, 19 Dec 2024 15:09:20 -0800 Subject: [PATCH 07/13] Remove unused name variable --- recipes/torchserve/meta.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/recipes/torchserve/meta.yaml b/recipes/torchserve/meta.yaml index 06e3908575281..d7dd9fb8ab514 100644 --- a/recipes/torchserve/meta.yaml +++ b/recipes/torchserve/meta.yaml @@ -1,4 +1,3 @@ -{% set name = "torchserve" %} {% set version = "0.12.0" %} package: From 9a55e2c756f627527afec93f18ddf4a6685f19a8 Mon Sep 17 00:00:00 2001 From: "Tim D. Smith" Date: Thu, 19 Dec 2024 15:14:59 -0800 Subject: [PATCH 08/13] Fix punctuation --- recipes/torch-model-archiver/meta.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/torch-model-archiver/meta.yaml b/recipes/torch-model-archiver/meta.yaml index bf9635ec60cdf..de741a21cf479 100644 --- a/recipes/torch-model-archiver/meta.yaml +++ b/recipes/torch-model-archiver/meta.yaml @@ -2,7 +2,7 @@ package: name: torchserve-model-archiver - version: {{ load_file_regex("model-archiver/model_archiver/version.txt". ".*")[0] }} + version: {{ load_file_regex("model-archiver/model_archiver/version.txt", ".*")[0] }} source: url: https://github.com/pytorch/serve/archive/v{{ torchserve_version }}.tar.gz From 846f1f4746521e9595a9f22a4930d21548bf9e31 Mon Sep 17 00:00:00 2001 From: "Tim D. Smith" Date: Thu, 19 Dec 2024 15:18:42 -0800 Subject: [PATCH 09/13] Don't be clever about versions --- recipes/torch-model-archiver/meta.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/recipes/torch-model-archiver/meta.yaml b/recipes/torch-model-archiver/meta.yaml index de741a21cf479..713db262a55f7 100644 --- a/recipes/torch-model-archiver/meta.yaml +++ b/recipes/torch-model-archiver/meta.yaml @@ -1,8 +1,10 @@ {% set torchserve_version = "0.12.0" %} +# see https://github.com/pytorch/serve/blob/master/model-archiver/model_archiver/version.txt +{% set model_archiver_version = "0.12.0" %} package: name: torchserve-model-archiver - version: {{ load_file_regex("model-archiver/model_archiver/version.txt", ".*")[0] }} + version: {{ model_archiver_version }} source: url: https://github.com/pytorch/serve/archive/v{{ torchserve_version }}.tar.gz From 6f761f27dcb3e285d4924c001892a913a1be87dd Mon Sep 17 00:00:00 2001 From: "Tim D. Smith" Date: Thu, 19 Dec 2024 15:21:43 -0800 Subject: [PATCH 10/13] Update summary, description --- recipes/torch-model-archiver/meta.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/torch-model-archiver/meta.yaml b/recipes/torch-model-archiver/meta.yaml index 713db262a55f7..2d9143764ec38 100644 --- a/recipes/torch-model-archiver/meta.yaml +++ b/recipes/torch-model-archiver/meta.yaml @@ -34,9 +34,9 @@ test: about: home: https://github.com/pytorch/serve/blob/master/model-archiver/README.md - summary: 'Performant, flexible and easy to use tool for serving PyTorch models in production.' + summary: Creates archives of trained neural net models that can be consumed by TorchServe for inference. description: | - TorchServe is a performant, flexible and easy to use tool for serving PyTorch models in production. + A key feature of TorchServe is the ability to package all model artifacts into a single model archive file. It is a separate command line interface (CLI), torch-model-archiver, that can take model checkpoints or model definition file with state_dict, and package them into a .mar file. This file can then be redistributed and served by anyone using TorchServe. It takes in the following model artifacts: a model checkpoint file in case of torchscript or a model definition file and a state_dict file in case of eager mode, and other optional assets that may be required to serve the model. The CLI creates a .mar file that TorchServe's server CLI uses to serve the models. license: Apache-2.0 license_file: LICENSE doc_url: https://pytorch.org/serve/ From 693380dfa9b677f301a936f7ce982f4fecdc0dde Mon Sep 17 00:00:00 2001 From: "Tim D. Smith" Date: Thu, 19 Dec 2024 16:09:20 -0800 Subject: [PATCH 11/13] Switch test args --- recipes/torch-model-archiver/meta.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/torch-model-archiver/meta.yaml b/recipes/torch-model-archiver/meta.yaml index 2d9143764ec38..628017b6116fc 100644 --- a/recipes/torch-model-archiver/meta.yaml +++ b/recipes/torch-model-archiver/meta.yaml @@ -28,7 +28,7 @@ requirements: test: commands: - - torch-model-archiver -v + - torch-model-archiver --help requires: - python {{ python_min }} From e2ce3b7a2aa75d5d1b0e999bf94e8358b69cb3b2 Mon Sep 17 00:00:00 2001 From: "Tim D. Smith" Date: Thu, 19 Dec 2024 16:13:15 -0800 Subject: [PATCH 12/13] Add torch-workflow-archiver --- recipes/torch-workflow-archiver/meta.yaml | 46 +++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 recipes/torch-workflow-archiver/meta.yaml diff --git a/recipes/torch-workflow-archiver/meta.yaml b/recipes/torch-workflow-archiver/meta.yaml new file mode 100644 index 0000000000000..3eda1489c9477 --- /dev/null +++ b/recipes/torch-workflow-archiver/meta.yaml @@ -0,0 +1,46 @@ +{% set torchserve_version = "0.12.0" %} +# see https://github.com/pytorch/serve/blob/master/workflow-archiver/workflow_archiver/version.txt +{% set model_archiver_version = "0.2.15" %} + +package: + name: torchserve-workflow-archiver + version: {{ workflow_archiver_version }} + +source: + url: https://github.com/pytorch/serve/archive/v{{ torchserve_version }}.tar.gz + sha256: d5eb31a540b6a1dea4ead5c8b122d8b7d40b06fe2fc257ba67ed5b071852be0b + +build: + noarch: python + script: {{ PYTHON }} -m pip install workflow-archiver/ -vv + number: 0 + entry_points: + - torch-workflow-archiver=workflow_archiver.workflow_packaging:generate_workflow_archive + +requirements: + host: + - python {{ python_min }} + - pip + - setuptools + run: + - python >={{ python_min }} + +test: + commands: + - torch-workflow-archiver --help + requires: + - python {{ python_min }} + +about: + home: https://github.com/pytorch/serve/tree/master/workflow-archiver + summary: Creates archives of workflows designed using trained neural net models that can be consumed by TorchServe inference. + description: | + A key feature of TorchServe is the ability to package workflow specification (.yaml) and other workflow dependency files into a single workflow archive file (.war). This file can then be redistributed and served by anyone using TorchServe. + license: Apache-2.0 + license_file: LICENSE + doc_url: https://pytorch.org/serve/ + dev_url: https://github.com/pytorch/serve + +extra: + recipe-maintainers: + - tdsmith From 21f5e205dbb7f823b9f3404214f6accd0fa0ef22 Mon Sep 17 00:00:00 2001 From: "Tim D. Smith" Date: Thu, 19 Dec 2024 16:18:48 -0800 Subject: [PATCH 13/13] copy-paste fail --- recipes/torch-workflow-archiver/meta.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/torch-workflow-archiver/meta.yaml b/recipes/torch-workflow-archiver/meta.yaml index 3eda1489c9477..6c26a4989a800 100644 --- a/recipes/torch-workflow-archiver/meta.yaml +++ b/recipes/torch-workflow-archiver/meta.yaml @@ -1,6 +1,6 @@ {% set torchserve_version = "0.12.0" %} # see https://github.com/pytorch/serve/blob/master/workflow-archiver/workflow_archiver/version.txt -{% set model_archiver_version = "0.2.15" %} +{% set workflow_archiver_version = "0.2.15" %} package: name: torchserve-workflow-archiver