Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an import test for non-jaxtrain CI. #626

Merged
merged 1 commit into from
Mar 11, 2024
Merged
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
23 changes: 23 additions & 0 deletions chirp/tests/inference_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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},
Expand Down
49 changes: 25 additions & 24 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading