From c12ab02d89966bd9d2d3ebb1a8cbfe5aa18fefd3 Mon Sep 17 00:00:00 2001 From: luksi1 Date: Mon, 25 Nov 2024 08:30:39 +0000 Subject: [PATCH] 61051: Add inference files --- tests/test_pytorch_env.py | 14 +++++++++++++- tests/test_r_env.py | 12 ++++++++++++ tests/test_tensorflow_env.py | 14 +++++++++++++- {{ cookiecutter.repo_name }}/inference/Dockerfile | 6 ++++++ .../inference/requirements.txt | 2 ++ 5 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 {{ cookiecutter.repo_name }}/inference/Dockerfile create mode 100644 {{ cookiecutter.repo_name }}/inference/requirements.txt diff --git a/tests/test_pytorch_env.py b/tests/test_pytorch_env.py index f64eeb3e8..0a603b0fa 100644 --- a/tests/test_pytorch_env.py +++ b/tests/test_pytorch_env.py @@ -122,6 +122,7 @@ def test_folders(self): f"{module_name}/models", f"{module_name}/visualization", "tests", + "inference", ] abs_expected_dirs = [str(self.path / d) for d in expected_dirs] @@ -146,4 +147,15 @@ def test_files(self): def test_gitlab_pipeline(self): _, _, abs_files = list(zip(*os.walk(self.path))) - assert ".gitlab-ci.yml" in abs_files[0] \ No newline at end of file + assert ".gitlab-ci.yml" in abs_files[0] + + def test_inference_files(self): + _, _, abs_files = list(zip(*os.walk(f"{self.path}/inference"))) + + expected_files = [ + "Dockerfile", + "requirements.txt", + ] + + for expected_file in expected_files: + assert expected_file in abs_files[0] \ No newline at end of file diff --git a/tests/test_r_env.py b/tests/test_r_env.py index 321117150..198b668c7 100644 --- a/tests/test_r_env.py +++ b/tests/test_r_env.py @@ -94,6 +94,7 @@ def test_folders(self): f"{module_name}/models", f"{module_name}/visualization", "tests", + "inference", ] abs_expected_dirs = [str(self.path / d) for d in expected_dirs] @@ -111,3 +112,14 @@ def test_files(self): assert len(abs_files[0]) == 2 assert ".gitkeep" in abs_files[0] assert "make_dataset.R" in abs_files[0] + + def test_inference_files(self): + _, _, abs_files = list(zip(*os.walk(f"{self.path}/inference"))) + + expected_files = [ + "Dockerfile", + "requirements.txt", + ] + + for expected_file in expected_files: + assert expected_file in abs_files[0] \ No newline at end of file diff --git a/tests/test_tensorflow_env.py b/tests/test_tensorflow_env.py index 8ae53d6b6..380021baf 100644 --- a/tests/test_tensorflow_env.py +++ b/tests/test_tensorflow_env.py @@ -121,6 +121,7 @@ def test_folders(self): f"{module_name}/models", f"{module_name}/visualization", "tests", + "inference", ] abs_expected_dirs = [str(self.path / d) for d in expected_dirs] @@ -145,4 +146,15 @@ def test_files(self): def test_gitlab_pipeline(self): _, _, abs_files = list(zip(*os.walk(self.path))) - assert ".gitlab-ci.yml" in abs_files[0] \ No newline at end of file + assert ".gitlab-ci.yml" in abs_files[0] + + def test_inference_files(self): + _, _, abs_files = list(zip(*os.walk(f"{self.path}/inference"))) + + expected_files = [ + "Dockerfile", + "requirements.txt", + ] + + for expected_file in expected_files: + assert expected_file in abs_files[0] \ No newline at end of file diff --git a/{{ cookiecutter.repo_name }}/inference/Dockerfile b/{{ cookiecutter.repo_name }}/inference/Dockerfile new file mode 100644 index 000000000..d89e0dc86 --- /dev/null +++ b/{{ cookiecutter.repo_name }}/inference/Dockerfile @@ -0,0 +1,6 @@ +FROM nvcr.io/nvidia/tritonserver:24.04-py3 + +COPY inference/requirements.txt /requirements.txt +RUN pip3 install -r /requirements.txt + +VOLUME /models diff --git a/{{ cookiecutter.repo_name }}/inference/requirements.txt b/{{ cookiecutter.repo_name }}/inference/requirements.txt new file mode 100644 index 000000000..5b47488c0 --- /dev/null +++ b/{{ cookiecutter.repo_name }}/inference/requirements.txt @@ -0,0 +1,2 @@ +# torch==2.5.1 +# tensorflow==2.18.0