Skip to content

Commit

Permalink
Test PR.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 713405276
  • Loading branch information
sdenton4 committed Jan 8, 2025
1 parent 5ce6ac8 commit 874fe83
Show file tree
Hide file tree
Showing 62 changed files with 808 additions and 843 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/ci_pip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ jobs:
pip install requests
pip install tensorflow-cpu
pip install tensorflow-hub
pip install git+https://github.com/google-research/hoplite.git
pip install git+https://github.com/google-research/perch-hoplite.git
- name: Test db with unittest
run: python -m unittest discover -s hoplite/db/tests -p "*test.py"
run: python -m unittest discover -s perch_hoplite/db/tests -p "*test.py"
- name: Test taxonomy with unittest
run: python -m unittest discover -s hoplite/taxonomy -p "*test.py"
run: python -m unittest discover -s perch_hoplite/taxonomy -p "*test.py"
- name: Test zoo with unittest
run: python -m unittest discover -s hoplite/zoo -p "*test.py"
run: python -m unittest discover -s perch_hoplite/zoo -p "*test.py"
- name: Test zoo tensorflow models with unittest
run: python -m unittest discover -s hoplite/zoo/tests_tf -p "*test.py"
run: python -m unittest discover -s perch_hoplite/zoo/tests_tf -p "*test.py"
- name: Test agile with unittest
run: python -m unittest discover -s hoplite/agile/tests -p "*test.py"
run: python -m unittest discover -s perch_hoplite/agile/tests -p "*test.py"
10 changes: 5 additions & 5 deletions .github/workflows/ci_poetry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ jobs:
sudo apt-get install libsndfile1 ffmpeg
poetry install
- name: Test db with unittest
run: poetry run python -m unittest discover -s hoplite/db/tests -p "*test.py"
run: poetry run python -m unittest discover -s perch_hoplite/db/tests -p "*test.py"
- name: Test taxonomy with unittest
run: poetry run python -m unittest discover -s hoplite/taxonomy -p "*test.py"
run: poetry run python -m unittest discover -s perch_hoplite/taxonomy -p "*test.py"
- name: Test zoo with unittest
run: poetry run python -m unittest discover -s hoplite/zoo -p "*test.py"
run: poetry run python -m unittest discover -s perch_hoplite/zoo -p "*test.py"
- name: Test zoo tensorflow models with unittest
run: poetry run python -m unittest discover -s hoplite/zoo/tests_tf -p "*test.py"
run: poetry run python -m unittest discover -s perch_hoplite/zoo/tests_tf -p "*test.py"
- name: Test agile with unittest
run: poetry run python -m unittest discover -s hoplite/agile/tests -p "*test.py"
run: poetry run python -m unittest discover -s perch_hoplite/agile/tests -p "*test.py"
12 changes: 6 additions & 6 deletions .github/workflows/ci_poetry_with_jax.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: ci_poetry
name: ci_poetry_with_jax

on:
push:
Expand Down Expand Up @@ -31,12 +31,12 @@ jobs:
sudo apt-get install libsndfile1 ffmpeg
poetry install --with jax
- name: Test db with unittest
run: poetry run python -m unittest discover -s hoplite/db/tests -p "*test.py"
run: poetry run python -m unittest discover -s perch_hoplite/db/tests -p "*test.py"
- name: Test taxonomy with unittest
run: poetry run python -m unittest discover -s hoplite/taxonomy -p "*test.py"
run: poetry run python -m unittest discover -s perch_hoplite/taxonomy -p "*test.py"
- name: Test zoo with unittest
run: poetry run python -m unittest discover -s hoplite/zoo -p "*test.py"
run: poetry run python -m unittest discover -s perch_hoplite/zoo -p "*test.py"
- name: Test zoo tensorflow models with unittest
run: poetry run python -m unittest discover -s hoplite/zoo/tests_tf -p "*test.py"
run: poetry run python -m unittest discover -s perch_hoplite/zoo/tests_tf -p "*test.py"
- name: Test agile with unittest
run: poetry run python -m unittest discover -s hoplite/agile/tests -p "*test.py"
run: poetry run python -m unittest discover -s perch_hoplite/agile/tests -p "*test.py"
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# Perch Hoplite

![CI](https://github.com/google-research/hoplite/actions/workflows/ci_pip.yml/badge.svg)
![CI](https://github.com/google-research/perch-hoplite/actions/workflows/ci_pip.yml/badge.svg)

Hoplite is a system for storing large volumes of embeddings from machine
perception models. We focus on combining vector search with active learning
workflows, aka [agile modeling](https://arxiv.org/abs/2302.12948).

While we get this documentation ready, we recommend checking out the main
[Perch repository](https://github.com/google-research/perch).
[Perch repository](https://github.com/google-research/perch), which includes
embedding model training code.

This repository consists of four sub-libraries:

Expand Down Expand Up @@ -47,7 +48,7 @@ pip install tensorflow-hub

Then to install with pip:
```bash
pip install git+https://github.com/google-research/hoplite.git
pip install git+https://github.com/google-research/perch-hoplite.git
```

Then run the tests and check that they pass:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
"import numpy as np\n",
"from etils import epath\n",
"\n",
"from hoplite.agile import colab_utils\n",
"from hoplite.agile import embed\n",
"from hoplite.agile import source_info\n",
"from hoplite.db import interface\n",
"from hoplite.db import brutalism\n",
"from hoplite.db import db_loader\n",
"from hoplite.db import sqlite_usearch_impl\n"
"from perch_hoplite.agile import colab_utils\n",
"from perch_hoplite.agile import embed\n",
"from perch_hoplite.agile import source_info\n",
"from perch_hoplite.db import interface\n",
"from perch_hoplite.db import brutalism\n",
"from perch_hoplite.db import db_loader\n",
"from perch_hoplite.db import sqlite_usearch_impl\n"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@
"from matplotlib import pyplot as plt\n",
"import numpy as np\n",
"\n",
"from hoplite.agile import audio_loader\n",
"from hoplite.agile import classifier\n",
"from hoplite.agile import classifier_data\n",
"from hoplite.agile import embedding_display\n",
"from hoplite.agile import source_info\n",
"from hoplite.db import brutalism\n",
"from hoplite.db import score_functions\n",
"from hoplite.db import search_results\n",
"from hoplite.db import sqlite_usearch_impl\n",
"from hoplite.zoo import model_configs\n"
"from perch_hoplite.agile import audio_loader\n",
"from perch_hoplite.agile import classifier\n",
"from perch_hoplite.agile import classifier_data\n",
"from perch_hoplite.agile import embedding_display\n",
"from perch_hoplite.agile import source_info\n",
"from perch_hoplite.db import brutalism\n",
"from perch_hoplite.db import score_functions\n",
"from perch_hoplite.db import search_results\n",
"from perch_hoplite.db import sqlite_usearch_impl\n",
"from perch_hoplite.zoo import model_configs\n"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
from typing import Callable

from etils import epath
from hoplite import audio_io
from hoplite.agile import source_info
import numpy as np
from perch_hoplite import audio_io
from perch_hoplite.agile import source_info


def make_filepath_loader(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
from typing import Any, Iterator, Sequence

from etils import epath
from hoplite.agile import classifier_data
from hoplite.agile import metrics
from hoplite.db import interface as db_interface
from ml_collections import config_dict
import numpy as np
from perch_hoplite.agile import classifier_data
from perch_hoplite.agile import metrics
from perch_hoplite.db import interface as db_interface
import tensorflow as tf
import tqdm

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
import itertools
from typing import Any, Iterator, Sequence

from hoplite.db import interface
import numpy as np
from perch_hoplite.db import interface


@dataclasses.dataclass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
import dataclasses

from etils import epath
from hoplite.agile import embed
from hoplite.agile import source_info
from hoplite.db import db_loader
from hoplite.db import sqlite_usearch_impl
from hoplite.zoo import model_configs
from ml_collections import config_dict
from perch_hoplite.agile import embed
from perch_hoplite.agile import source_info
from perch_hoplite.db import db_loader
from perch_hoplite.db import sqlite_usearch_impl
from perch_hoplite.zoo import model_configs


@dataclasses.dataclass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
from typing import Sequence

from etils import epath
from hoplite.agile import embed
from hoplite.agile import source_info
from hoplite.db import db_loader
from hoplite.db import in_mem_impl
from hoplite.db import interface
from hoplite.db import sqlite_usearch_impl
from ml_collections import config_dict
import numpy as np
from perch_hoplite.agile import embed
from perch_hoplite.agile import source_info
from perch_hoplite.db import db_loader
from perch_hoplite.db import in_mem_impl
from perch_hoplite.db import interface
from perch_hoplite.db import sqlite_usearch_impl
import tensorflow as tf
import tqdm

Expand Down
10 changes: 5 additions & 5 deletions hoplite/agile/embed.py → perch_hoplite/agile/embed.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@

from absl import logging
import audioread
from hoplite import audio_io
from hoplite.agile import source_info
from hoplite.db import interface as hoplite_interface
from hoplite.zoo import model_configs
from hoplite.zoo import zoo_interface
from ml_collections import config_dict
import numpy as np
from perch_hoplite import audio_io
from perch_hoplite.agile import source_info
from perch_hoplite.db import interface as hoplite_interface
from perch_hoplite.zoo import model_configs
from perch_hoplite.zoo import zoo_interface
import soundfile


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
import functools
from typing import Callable, Iterator, Sequence

from hoplite import audio_io
from hoplite.db import interface
from hoplite.db import search_results
import IPython
from IPython.display import clear_output
from IPython.display import display as ipy_display
Expand All @@ -30,6 +27,9 @@
from librosa import display as librosa_display
from matplotlib import pyplot as plt
import numpy as np
from perch_hoplite import audio_io
from perch_hoplite.db import interface
from perch_hoplite.db import search_results


@dataclasses.dataclass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
from typing import Callable

from etils import epath
from hoplite.agile import embed
from hoplite.agile import source_info
from hoplite.db import db_loader
from hoplite.db import interface
from hoplite.taxonomy import annotations_fns
from ml_collections import config_dict
import pandas as pd
from perch_hoplite.agile import embed
from perch_hoplite.agile import source_info
from perch_hoplite.db import db_loader
from perch_hoplite.db import interface
from perch_hoplite.taxonomy import annotations_fns
import tqdm

BASE_PATH = epath.Path('gs://chirp-public-bucket/soundscapes/')
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@

from absl import logging
from etils import epath
from hoplite.db import interface as hoplite_interface
from ml_collections import config_dict
from perch_hoplite.db import interface as hoplite_interface
import soundfile
import tqdm

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
import shutil
import tempfile

from hoplite.agile import classifier_data
from hoplite.db import interface
from hoplite.db.tests import test_utils as db_test_utils
import numpy as np
from perch_hoplite.agile import classifier_data
from perch_hoplite.db import interface
from perch_hoplite.db.tests import test_utils as db_test_utils

from absl.testing import absltest

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
import os
import tempfile

from hoplite.agile import classifier
from hoplite.agile import classifier_data
from hoplite.db.tests import test_utils as db_test_utils
from ml_collections import config_dict
import numpy as np
import pandas as pd
from perch_hoplite.agile import classifier
from perch_hoplite.agile import classifier_data
from perch_hoplite.db.tests import test_utils as db_test_utils

from absl.testing import absltest

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
import tempfile

from etils import epath
from hoplite import audio_io
from hoplite import path_utils
from hoplite.agile import convert_legacy
from hoplite.agile.tests import test_utils
from ml_collections import config_dict
from perch_hoplite import audio_io
from perch_hoplite import path_utils
from perch_hoplite.agile import convert_legacy
from perch_hoplite.agile.tests import test_utils

from absl.testing import absltest
from absl.testing import parameterized
Expand Down Expand Up @@ -96,7 +96,7 @@ def write_placeholder_embeddings(
)
audio_iterator = audio_io.multi_load_audio_window(
filepaths=[s.filepath for s in source_infos],
offsets=[0 for s in source_infos],
offsets=[0 for _ in source_infos],
audio_loader=audio_loader,
)
with tf_examples.EmbeddingsTFRecordMultiWriter(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
import shutil
import tempfile

from hoplite.agile import embed
from hoplite.agile import source_info
from hoplite.agile.tests import test_utils
from hoplite.db import db_loader
from ml_collections import config_dict
from perch_hoplite.agile import embed
from perch_hoplite.agile import source_info
from perch_hoplite.agile.tests import test_utils
from perch_hoplite.db import db_loader

from absl.testing import absltest

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
import tempfile
from unittest import mock

from hoplite.agile import audio_loader
from hoplite.agile import embedding_display
from hoplite.agile import source_info
from hoplite.agile.tests import test_utils
from hoplite.db import interface
import IPython
import ipywidgets
import numpy as np
from perch_hoplite.agile import audio_loader
from perch_hoplite.agile import embedding_display
from perch_hoplite.agile import source_info
from perch_hoplite.agile.tests import test_utils
from perch_hoplite.db import interface

from absl.testing import absltest

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@
import tempfile

from etils import epath
from hoplite import path_utils
from hoplite.agile import embed
from hoplite.agile import ingest_annotations
from hoplite.agile.tests import test_utils
from hoplite.db import interface
from hoplite.db.tests import test_utils as db_test_utils
from hoplite.taxonomy import annotations
from hoplite.taxonomy import annotations_fns
from ml_collections import config_dict
import numpy as np
from perch_hoplite import path_utils
from perch_hoplite.agile import embed
from perch_hoplite.agile import ingest_annotations
from perch_hoplite.agile.tests import test_utils
from perch_hoplite.db import interface
from perch_hoplite.db.tests import test_utils as db_test_utils
from perch_hoplite.taxonomy import annotations
from perch_hoplite.taxonomy import annotations_fns

from absl.testing import absltest

Expand Down
Loading

0 comments on commit 874fe83

Please sign in to comment.