From 9f28ba58faa63dd6801772417af1adbf74efa5a8 Mon Sep 17 00:00:00 2001 From: Tom Denton Date: Mon, 11 Mar 2024 12:34:08 -0700 Subject: [PATCH] Add an import test for non-jaxtrain CI. PiperOrigin-RevId: 614756987 --- chirp/tests/inference_test.py | 23 ++++++++++++++++ poetry.lock | 49 ++++++++++++++++++----------------- pyproject.toml | 1 + 3 files changed, 49 insertions(+), 24 deletions(-) diff --git a/chirp/tests/inference_test.py b/chirp/tests/inference_test.py index 0f962c88..4e06e89f 100644 --- a/chirp/tests/inference_test.py +++ b/chirp/tests/inference_test.py @@ -20,11 +20,20 @@ import apache_beam as beam from apache_beam.testing import test_pipeline +from chirp import audio_utils +from chirp import config_utils from chirp import path_utils +from chirp.inference import colab_utils from chirp.inference import embed_lib from chirp.inference import interface from chirp.inference import models from chirp.inference import tf_examples +from chirp.models import metrics +from chirp.projects.bootstrap import bootstrap +from chirp.projects.bootstrap import display +from chirp.projects.bootstrap import search +from chirp.projects.multicluster import classify +from chirp.projects.multicluster import data_lib from chirp.taxonomy import namespace from etils import epath from ml_collections import config_dict @@ -49,6 +58,20 @@ def _make_output_head_model(model_path: str, embedding_dim: int = 1280): class InferenceTest(parameterized.TestCase): + def test_imports(self): + # Test that imports work in external github environment. + # This explicitly tests that libraries commonly used in Colab workflows + # can be imported when Perch is installed without Jax training dependencies. + self.assertIsNotNone(audio_utils) + self.assertIsNotNone(bootstrap) + self.assertIsNotNone(classify) + self.assertIsNotNone(colab_utils) + self.assertIsNotNone(config_utils) + self.assertIsNotNone(data_lib) + self.assertIsNotNone(display) + self.assertIsNotNone(metrics) + self.assertIsNotNone(search) + @parameterized.parameters( # Test each output type individually. {'make_embeddings': True}, diff --git a/poetry.lock b/poetry.lock index 237f6e19..171f920a 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1681,17 +1681,18 @@ xai = ["tensorflow (>=2.3.0,<3.0.0dev)"] [[package]] name = "google-cloud-bigquery" -version = "3.18.0" +version = "3.19.0" description = "Google BigQuery API client library" optional = false python-versions = ">=3.7" files = [ - {file = "google-cloud-bigquery-3.18.0.tar.gz", hash = "sha256:74f0fc6f0ba9477f808d25924dc8a052c55f7ca91064e83e16d3ee5fb7ca77ab"}, - {file = "google_cloud_bigquery-3.18.0-py2.py3-none-any.whl", hash = "sha256:3520552075502c69710d37b1e9600c84e6974ad271914677d16bfafa502857fb"}, + {file = "google-cloud-bigquery-3.19.0.tar.gz", hash = "sha256:8e311dae49768e1501fcdc5e916bff4b7e169471e5707919f4a6f78a02b3b5a6"}, + {file = "google_cloud_bigquery-3.19.0-py2.py3-none-any.whl", hash = "sha256:c6b8850247a4b132066e49f6e45f850c22824482838688d744a4398eea1120ed"}, ] [package.dependencies] -google-api-core = ">=1.31.5,<2.0.dev0 || >2.3.0,<3.0.0dev" +google-api-core = {version = ">=1.34.1,<2.0.dev0 || >=2.11.dev0,<3.0.0dev", extras = ["grpc"]} +google-auth = ">=2.14.1,<3.0.0dev" google-cloud-core = ">=1.6.0,<3.0.0dev" google-resumable-media = ">=0.6.0,<3.0dev" packaging = ">=20.0.0" @@ -2110,13 +2111,13 @@ requests = ["requests (>=2.18.0,<3.0.0dev)"] [[package]] name = "googleapis-common-protos" -version = "1.62.0" +version = "1.63.0" description = "Common protobufs used in Google APIs" optional = false python-versions = ">=3.7" files = [ - {file = "googleapis-common-protos-1.62.0.tar.gz", hash = "sha256:83f0ece9f94e5672cced82f592d2a5edf527a96ed1794f0bab36d5735c996277"}, - {file = "googleapis_common_protos-1.62.0-py2.py3-none-any.whl", hash = "sha256:4750113612205514f9f6aa4cb00d523a94f3e8c06c5ad2fee466387dc4875f07"}, + {file = "googleapis-common-protos-1.63.0.tar.gz", hash = "sha256:17ad01b11d5f1d0171c06d3ba5c04c54474e883b66b949722b4938ee2694ef4e"}, + {file = "googleapis_common_protos-1.63.0-py2.py3-none-any.whl", hash = "sha256:ae45f75702f7c08b541f750854a678bd8f534a1a6bace6afe975f1d0a82d6632"}, ] [package.dependencies] @@ -3043,13 +3044,13 @@ files = [ [[package]] name = "jupyterlab-server" -version = "2.25.3" +version = "2.25.4" description = "A set of server components for JupyterLab and JupyterLab like applications." optional = false python-versions = ">=3.8" files = [ - {file = "jupyterlab_server-2.25.3-py3-none-any.whl", hash = "sha256:c48862519fded9b418c71645d85a49b2f0ec50d032ba8316738e9276046088c1"}, - {file = "jupyterlab_server-2.25.3.tar.gz", hash = "sha256:846f125a8a19656611df5b03e5912c8393cea6900859baa64fa515eb64a8dc40"}, + {file = "jupyterlab_server-2.25.4-py3-none-any.whl", hash = "sha256:eb645ecc8f9b24bac5decc7803b6d5363250e16ec5af814e516bc2c54dd88081"}, + {file = "jupyterlab_server-2.25.4.tar.gz", hash = "sha256:2098198e1e82e0db982440f9b5136175d73bea2cd42a6480aa6fd502cb23c4f9"}, ] [package.dependencies] @@ -3064,7 +3065,7 @@ requests = ">=2.31" [package.extras] docs = ["autodoc-traits", "jinja2 (<3.2.0)", "mistune (<4)", "myst-parser", "pydata-sphinx-theme", "sphinx", "sphinx-copybutton", "sphinxcontrib-openapi (>0.8)"] openapi = ["openapi-core (>=0.18.0,<0.19.0)", "ruamel-yaml"] -test = ["hatch", "ipykernel", "openapi-core (>=0.18.0,<0.19.0)", "openapi-spec-validator (>=0.6.0,<0.8.0)", "pytest (>=7.0)", "pytest-console-scripts", "pytest-cov", "pytest-jupyter[server] (>=0.6.2)", "pytest-timeout", "requests-mock", "ruamel-yaml", "sphinxcontrib-spelling", "strict-rfc3339", "werkzeug"] +test = ["hatch", "ipykernel", "openapi-core (>=0.18.0,<0.19.0)", "openapi-spec-validator (>=0.6.0,<0.8.0)", "pytest (>=7.0,<8)", "pytest-console-scripts", "pytest-cov", "pytest-jupyter[server] (>=0.6.2)", "pytest-timeout", "requests-mock", "ruamel-yaml", "sphinxcontrib-spelling", "strict-rfc3339", "werkzeug"] [[package]] name = "jupyterlab-widgets" @@ -4054,7 +4055,7 @@ jaxlib = ">=0.1.37" numpy = ">=1.18.0" [package.extras] -docs = ["flax", "ipython (>=8.8.0)", "matplotlib (>=3.5.0)", "myst-nb (>=1.0.0)", "sphinx (>=6.0.0)", "sphinx-autodoc-typehints", "sphinx-book-theme (>=1.0.1)", "sphinx-collections (>=0.0.1)", "sphinx-gallery (>=0.14.0)", "sphinxcontrib-katex", "tensorflow (>=2.4.0)", "tensorflow-datasets (>=4.2.0)"] +docs = ["flax", "ipython (>=8.8.0)", "matplotlib (>=3.5.0)", "myst-nb (>=1.0.0)", "sphinx (>=6.0.0)", "sphinx-autodoc-typehints", "sphinx-book-theme (>=1.0.1)", "sphinx-collections (>=0.0.1)", "sphinx-gallery (>=0.14.0)", "sphinx_contributors", "sphinxcontrib-katex", "tensorflow (>=2.4.0)", "tensorflow-datasets (>=4.2.0)"] dp-accounting = ["absl-py (>=1.0.0)", "attrs (>=21.4.0)", "mpmath (>=1.2.1)", "numpy (>=1.21.4)", "scipy (>=1.7.1)"] examples = ["dp_accounting (>=0.4)", "flax", "tensorflow (>=2.4.0)", "tensorflow-datasets (>=4.2.0)"] test = ["dm-tree (>=0.1.7)", "flax (>=0.5.3)"] @@ -4063,7 +4064,7 @@ test = ["dm-tree (>=0.1.7)", "flax (>=0.5.3)"] type = "git" url = "https://github.com/google-deepmind/optax.git" reference = "main" -resolved_reference = "72a8614e2dcaf73189d40733a1afabc0cf1521a7" +resolved_reference = "95af789cb7f1d0279f44e143e3207e2e7b4d70d1" [[package]] name = "orbax-checkpoint" @@ -4164,13 +4165,13 @@ files = [ [[package]] name = "packaging" -version = "23.2" +version = "24.0" description = "Core utilities for Python packages" optional = false python-versions = ">=3.7" files = [ - {file = "packaging-23.2-py3-none-any.whl", hash = "sha256:8c491190033a9af7e1d931d0b5dacc2ef47509b34dd0de67ed209b5203fc88c7"}, - {file = "packaging-23.2.tar.gz", hash = "sha256:048fb0e9405036518eaaf48a55953c750c11e1a1b68e0dd1a9d62ed0c092cfc5"}, + {file = "packaging-24.0-py3-none-any.whl", hash = "sha256:2ddfb553fdf02fb784c234c7ba6ccc288296ceabec964ad2eae3777778130bc5"}, + {file = "packaging-24.0.tar.gz", hash = "sha256:eb82c5e3e56209074766e6885bb04b8c38a0c015d0a30036ebe7ece34c9989e9"}, ] [[package]] @@ -5425,13 +5426,13 @@ use-chardet-on-py3 = ["chardet (>=3.0.2,<6)"] [[package]] name = "requests-oauthlib" -version = "1.3.1" +version = "1.4.0" description = "OAuthlib authentication support for Requests." optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" files = [ - {file = "requests-oauthlib-1.3.1.tar.gz", hash = "sha256:75beac4a47881eeb94d5ea5d6ad31ef88856affe2332b9aafb52c6452ccf0d7a"}, - {file = "requests_oauthlib-1.3.1-py2.py3-none-any.whl", hash = "sha256:2577c501a2fb8d05a304c09d090d6e47c306fef15809d102b327cf8364bddab5"}, + {file = "requests-oauthlib-1.4.0.tar.gz", hash = "sha256:acee623221e4a39abcbb919312c8ff04bd44e7e417087fb4bd5e2a2f53d5e79a"}, + {file = "requests_oauthlib-1.4.0-py2.py3-none-any.whl", hash = "sha256:7a3130d94a17520169e38db6c8d75f2c974643788465ecc2e4b36d288bf13033"}, ] [package.dependencies] @@ -5636,7 +5637,7 @@ testing = ["dmvr @ git+https://github.com/google-deepmind/dmvr.git", "lingvo (== type = "git" url = "https://github.com/google-research/scenic.git" reference = "HEAD" -resolved_reference = "663a2900c640acdc15c4df3e8d0b3bad400fdf98" +resolved_reference = "232f467db11ddf45b68041dfb39f20d7bec3e280" [[package]] name = "scikit-learn" @@ -6472,13 +6473,13 @@ test = ["mypy", "pytest", "typing-extensions"] [[package]] name = "types-python-dateutil" -version = "2.8.19.20240106" +version = "2.8.19.20240311" description = "Typing stubs for python-dateutil" optional = false python-versions = ">=3.8" files = [ - {file = "types-python-dateutil-2.8.19.20240106.tar.gz", hash = "sha256:1f8db221c3b98e6ca02ea83a58371b22c374f42ae5bbdf186db9c9a76581459f"}, - {file = "types_python_dateutil-2.8.19.20240106-py3-none-any.whl", hash = "sha256:efbbdc54590d0f16152fa103c9879c7d4a00e82078f6e2cf01769042165acaa2"}, + {file = "types-python-dateutil-2.8.19.20240311.tar.gz", hash = "sha256:51178227bbd4cbec35dc9adffbf59d832f20e09842d7dcb8c73b169b8780b7cb"}, + {file = "types_python_dateutil-2.8.19.20240311-py3-none-any.whl", hash = "sha256:ef813da0809aca76472ca88807addbeea98b19339aebe56159ae2f4b4f70857a"}, ] [[package]] @@ -6917,4 +6918,4 @@ cffi = ["cffi (>=1.11)"] [metadata] lock-version = "2.0" python-versions = ">=3.10,<3.12" -content-hash = "1172ec848c768c006b0530e664ffd9fa21249f310ac5ecc66f2f6f760ab09e5d" +content-hash = "d59158619b8cc53e623a28c08b8531bb4cee9337169b86452ad913163ca52686" diff --git a/pyproject.toml b/pyproject.toml index a5aa192e..28add7b3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,6 +30,7 @@ chex = "^0.1.7" numba = "^0.57" librosa = "^0.10.1" numpy = "^1.24.0" +tqdm = "^4.6" [tool.poetry.group.jaxtrain] optional = true