-
Notifications
You must be signed in to change notification settings - Fork 49
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
Setup_audio #322
Setup_audio #322
Conversation
MLCommons CLA bot All contributors have signed the MLCommons CLA ✍️ ✅ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Do you have a dataset to test this?
requirements.txt
Outdated
@@ -0,0 +1,27 @@ | |||
absl-py==1.4.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't use requirements.txt, but pyproject.toml
to manage dependencies.
@@ -28,6 +28,9 @@ def check_expected_type(issues: Issues, jsonld: Json, expected_type: str): | |||
constants.SCHEMA_ORG_DATA_TYPE_IMAGE_OBJECT: ( | |||
constants.SCHEMA_ORG_DATA_TYPE_IMAGE_OBJECT | |||
), | |||
constants.SCHEMA_ORG_DATA_TYPE_AUDIO_OBJECT: ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this has changed. Can you rebase to have a freshest version of the code?
git pull --rebase origin main
I just added the one that I've been using for testing. It's a mini-version of what I finally want to do with croissant, but maybe the 0-hz-immersion-into-wallbient directory can be used as another test if we want it to operate without looking into multiple directories. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the dataset. My remarks:
- The dataset should probably be added to the non-hermetic unit tests. Like this, we'll make sure we won't have any regression on audio.
- Is it possible to not commit the *.mp3 and rather host them somewhere? Otherwise, it could make the repo heavier.
- Could you address the previous reviews? (E.g., rebase your code and do not commit the requirements.txt file).
Thanks!
Hi! I added the dataset to the non-hermetic tests, and I'm also hosting the dataset from a Google Drive, which I shared with you and Tim. Also, sorry about the problem with the rebase. I thought I rebased it when I added the dataset, but I did not complete the process. I have now rebased the branch and synced the changes. I hope it works properly now. I also removed the requirements.txt file. Also, would it be possible to get some Documentation on how different datatypes get pulled. I ask because one thing I've noticed is that ImageObjects get pulled in a different manner than something like a text file. I've been trial and erroring my way through the process, but I could use some clarification on how different datatypes get pulled. Thanks! |
…t has been commented out for now.
I passed the tests. Is there anything else I should do? |
"audio_test/metadata.json", | ||
"records", | ||
-1, | ||
], # Switch the number to 10 if nessacary |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
necessary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just removed it.
@@ -86,5 +86,10 @@ def PIL_Image(cls) -> types.ModuleType: # pylint: disable=invalid-name | |||
"""Cached git module.""" | |||
return _try_import("PIL.Image", package_name="Pillow") | |||
|
|||
@cached_class_property | |||
def LIB_Audio(cls) -> types.ModuleType: # pylint: disable=invalid-name | |||
"""Cached git module.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cached librosa module
@@ -31,6 +31,9 @@ def _cast_value(value: Any, data_type: type | term.URIRef | None): | |||
return deps.PIL_Image.open(io.BytesIO(value)) | |||
else: | |||
raise ValueError(f"Type {type(value)} is not accepted for an image.") | |||
elif data_type == DataType.AUDIO_OBJECT: | |||
output = deps.LIB_Audio.load(io.BytesIO(value)) | |||
return str([output[0].tolist(), output[1]]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why a str? How will you use this in an ML pipeline? What would be the most useful signal to return here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did it like that because the output needs to have double quotes. I'm about to push a version that just outputs the regular librosa output, but I don't know if it will pass the test.
python/mlcroissant/pyproject.toml
Outdated
@@ -18,6 +19,7 @@ authors = [ | |||
# pip dependencies of the project | |||
# Installed locally with `pip install -e .` | |||
dependencies = [ | |||
"black[jupyter]", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove jupyter?
@@ -86,5 +86,10 @@ def PIL_Image(cls) -> types.ModuleType: # pylint: disable=invalid-name | |||
"""Cached git module.""" | |||
return _try_import("PIL.Image", package_name="Pillow") | |||
|
|||
@cached_class_property | |||
def LIB_Audio(cls) -> types.ModuleType: # pylint: disable=invalid-name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def librosa
(PIL.Image above is a library, so the name here should probably be librosa)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just changed the name, and the usage in field.py
Croissant can now recognize sc:AudioObject types, but can't pull any relevant data.