Skip to content

Commit

Permalink
Add an import test for non-jaxtrain CI.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 614705474
  • Loading branch information
sdenton4 authored and copybara-github committed Mar 11, 2024
1 parent df60818 commit 2c26c2c
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 24 deletions.
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

0 comments on commit 2c26c2c

Please sign in to comment.