GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(v2): add audio url and predefined document by anna-charlotte · Pull Request #940 · docarray/docarray

This repository was archived by the owner on Sep 9, 2026. It is now read-only.

Conversation

@anna-charlotte

@anna-charlotte anna-charlotte commented Dec 14, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Add support for audio files to docarray v2

Goals:

  • AudioUrl
  • AudioTensor with AudioNdarray and AudioTorchTensor
  • Audio predefined doc (with optional attrs Audio.tensor, Audio.url and Audio.embedding)
  • tests
  • check and update documentation, if required. See guide

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@anna-charlotte anna-charlotte linked an issue Dec 14, 2022 that may be closed by this pull request
Add audio predefined document to v2 #914
Closed
@github-actions github-actions Bot added size/s area/core area/typing labels Dec 14, 2022
@anna-charlotte anna-charlotte mentioned this pull request Dec 14, 2022
Meta: DocArray v2 Roadmap #780
Closed
42 of 47 tasks
@anna-charlotte anna-charlotte changed the title feat: add audio url and predefined document feat(v2): add audio url and predefined document Dec 14, 2022
anna-charlotte added 2 commits December 14, 2022 15:25
anna-charlotte
feat: add audio url class
bebc9d4
Signed-off-by: anna-charlotte <[email protected]>
anna-charlotte
fix: typos
6025c2f
Signed-off-by: anna-charlotte <[email protected]>
@anna-charlotte
anna-charlotte force-pushed the feat-add-audio-v2 branch from 1285a1c to 6025c2f Compare December 14, 2022 14:26
anna-charlotte added 2 commits December 15, 2022 11:34
anna-charlotte
test: add tests for audio and audio url
9a599e5
Signed-off-by: anna-charlotte <[email protected]>
anna-charlotte
feat: add audio url and audio predefined class
04abdae
Signed-off-by: anna-charlotte <[email protected]>
@github-actions github-actions Bot added size/m area/entrypoint area/testing component/proto and removed size/s labels Dec 15, 2022
anna-charlotte added 3 commits December 21, 2022 21:58
anna-charlotte
Merge remote-tracking branch 'origin/feat-rewrite-v2' into feat-add-a…
f8d700d
…udio-v2

Signed-off-by: anna-charlotte <[email protected]>
anna-charlotte
chore: add types-request
d58f804
Signed-off-by: anna-charlotte <[email protected]>
anna-charlotte
feat: add audio tensors torch and ndarray
bdf8e88
Signed-off-by: anna-charlotte <[email protected]>
@github-actions github-actions Bot added the area/setup label Dec 22, 2022
anna-charlotte added 2 commits December 22, 2022 10:07
anna-charlotte
fix: mypy type hints
6572df8
Signed-off-by: anna-charlotte <[email protected]>
anna-charlotte
test: empty test file
9cd4baa
Signed-off-by: anna-charlotte <[email protected]>
@github-actions github-actions Bot added size/l and removed size/m labels Dec 22, 2022
anna-charlotte added 6 commits December 28, 2022 09:09
anna-charlotte
test: add more unit and integration tests
b3c1948
Signed-off-by: anna-charlotte <[email protected]>
anna-charlotte
fix: update audio tensors and audio url
7774181
Signed-off-by: anna-charlotte <[email protected]>
anna-charlotte
fix: remove print statements
af840d4
Signed-off-by: anna-charlotte <[email protected]>
anna-charlotte
docs: add documentation
797f488
Signed-off-by: anna-charlotte <[email protected]>
anna-charlotte
refactor: rename test audio py to test audio tensor py
8b48a77
Signed-off-by: anna-charlotte <[email protected]>
anna-charlotte
fix: typo in torch tensor py
e135438
Signed-off-by: anna-charlotte <[email protected]>
anna-charlotte added 6 commits December 29, 2022 15:03
anna-charlotte
fix: revert ndim in abstract tensor and torch tensor and ndarray
83ef649
Signed-off-by: anna-charlotte <[email protected]>
anna-charlotte
fix: mypy checks
eecca41
Signed-off-by: anna-charlotte <[email protected]>
anna-charlotte
docs: add docstring to n dim
4762c3c
Signed-off-by: anna-charlotte <[email protected]>
anna-charlotte
refactor: move n dim to abstract tensor and subclasses
6948122
Signed-off-by: anna-charlotte <[email protected]>
anna-charlotte
refactor: make to protobuf abstract, change node to protobuf signature
d174087
Signed-off-by: anna-charlotte <[email protected]>
anna-charlotte
fix: remove not needed methods
3a52303
Signed-off-by: anna-charlotte <[email protected]>
@anna-charlotte

anna-charlotte commented Dec 29, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

@JoanFM @alaeddine-13 I checked all the comments and made corresponding changes. It's ready for re-review now.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

alaeddine-13
alaeddine-13 reviewed Dec 30, 2022
View reviewed changes
Comment thread docarray/predefined_document/audio.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread tests/integrations/predefined_document/test_audio.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread docarray/typing/tensor/abstract_tensor.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

anna-charlotte added 3 commits December 30, 2022 10:12
anna-charlotte
fix: change remote audio file to file from github
a0be12e
Signed-off-by: anna-charlotte <[email protected]>
anna-charlotte
fix: raw content from remote file
9623d29
Signed-off-by: anna-charlotte <[email protected]>
anna-charlotte
fix: path to github remote file
6efdcf2
Signed-off-by: anna-charlotte <[email protected]>
anna-charlotte
anna-charlotte commented Jan 2, 2023
View reviewed changes
Comment thread docarray/typing/url/audio_url.py Outdated
)
return cls(str(url), scheme=None)

def load(self: T) -> np.ndarray:

@anna-charlotte anna-charlotte Jan 2, 2023

Copy link
Copy Markdown
Contributor Author

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.

@samsja Should I return a np.ndarray here, or rather AudioNdArray or AudioTorchTensor?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@JohannesMessner JohannesMessner Jan 2, 2023

Copy link
Copy Markdown
Member

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 would say AudioNdArray.
Normally we just load the np.ndarray, bc the framework specific conversion can happen when putting it back into the document, and having it as np.ndarray makes the least assumptions about the sorrounding code.
In this case, since there are actual audio features that come with the array, I would go with AudioNdArray. It can still be treated like a normal np.ndarray, but bring the aforementioned features.

But just verify in a test that setting a AudioNdArray to a field with type AudioTorchArray actually works without issue?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

anna-charlotte and samsja reacted with thumbs up emoji
All reactions
  • 👍 2 reactions

@anna-charlotte anna-charlotte Jan 2, 2023

Copy link
Copy Markdown
Contributor Author

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.

But just verify in a test that setting a AudioNdArray to a field with type AudioTorchArray actually works without issue

Do you mean like this?

def test_load_audio_url_to_audio_torch_tensor(file_url):
    class MyAudioDoc(Document):
        audio_url: AudioUrl
        tensor: Optional[AudioTorchTensor]

    doc = MyAudioDoc(audio_url=file_url)
    doc.tensor = doc.audio_url.load()

    assert isinstance(doc.tensor, np.ndarray)
    assert isinstance(doc.tensor, AudioNdArray)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

JohannesMessner reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

@anna-charlotte anna-charlotte Jan 3, 2023

Copy link
Copy Markdown
Contributor Author

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.

Ok I moved it to the computational backends

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@samsja samsja Jan 3, 2023

Copy link
Copy Markdown
Member

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.

great I like it better like this

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
samsja
samsja reviewed Jan 2, 2023
View reviewed changes

@samsja samsja left a comment

Copy link
Copy Markdown
Member

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.

This pr looks really nice. I like how the idea of having different tensor types for the different modality work :) I added some comments

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread docarray/typing/tensor/audio/audio_tensor.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread docarray/typing/tensor/abstract_tensor.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread docarray/typing/tensor/abstract_tensor.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread tests/units/typing/tensor/test_audio_tensor.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread tests/units/typing/tensor/test_audio_tensor.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

JohannesMessner
JohannesMessner suggested changes Jan 2, 2023
View reviewed changes

@JohannesMessner JohannesMessner left a comment

Copy link
Copy Markdown
Member

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.

Great PR, love the audio tensor stuff, this is a good pattern to use moving forward. just some things to consider

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread docarray/typing/tensor/abstract_tensor.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread docarray/typing/tensor/audio/audio_torch_tensor.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread docarray/typing/tensor/abstract_tensor.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread docarray/typing/tensor/audio/audio_ndarray.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread docarray/typing/url/audio_url.py Outdated
)
return cls(str(url), scheme=None)

def load(self: T) -> np.ndarray:

@JohannesMessner JohannesMessner Jan 2, 2023

Copy link
Copy Markdown
Member

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 would say AudioNdArray.
Normally we just load the np.ndarray, bc the framework specific conversion can happen when putting it back into the document, and having it as np.ndarray makes the least assumptions about the sorrounding code.
In this case, since there are actual audio features that come with the array, I would go with AudioNdArray. It can still be treated like a normal np.ndarray, but bring the aforementioned features.

But just verify in a test that setting a AudioNdArray to a field with type AudioTorchArray actually works without issue?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

anna-charlotte and samsja reacted with thumbs up emoji
All reactions
  • 👍 2 reactions
Comment thread docarray/typing/url/audio_url.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

anna-charlotte added 6 commits January 2, 2023 14:44
anna-charlotte
refactor: tensor field name to proto field name
5026543
Signed-off-by: anna-charlotte <[email protected]>
anna-charlotte
test: remove redundant test in test audio tensor
703de43
Signed-off-by: anna-charlotte <[email protected]>
anna-charlotte
fix: load audio url to audio ndarray instead of np ndarray
83ece31
Signed-off-by: anna-charlotte <[email protected]>
anna-charlotte
refactor: move n dim to computational backend
de079e2
Signed-off-by: anna-charlotte <[email protected]>
anna-charlotte
docs: update docstrings for audio tensors
2ef1350
Signed-off-by: anna-charlotte <[email protected]>
anna-charlotte
feat: make dtype in audiourl load optional
d51d38e
Signed-off-by: anna-charlotte <[email protected]>
JohannesMessner
JohannesMessner approved these changes Jan 3, 2023
View reviewed changes

@JohannesMessner JohannesMessner left a comment

Copy link
Copy Markdown
Member

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.

Just resolve the conflicts and we're good to go, great work!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
samsja
samsja approved these changes Jan 3, 2023
View reviewed changes
anna-charlotte added 3 commits January 3, 2023 10:10
anna-charlotte
Merge branch 'feat-rewrite-v2' into feat-add-audio-v2
3901cfa
Signed-off-by: anna-charlotte <[email protected]>
anna-charlotte
test: fix document refactor and ndarray import
a571898
Signed-off-by: anna-charlotte <[email protected]>
anna-charlotte
fix: fix mypy check
71af630
Signed-off-by: anna-charlotte <[email protected]>
@github-actions

github-actions Bot commented Jan 3, 2023

Copy link
Copy Markdown

📝 Docs are deployed on https://ft-feat-add-audio-v2--jina-docs.netlify.app 🎉

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@anna-charlotte
anna-charlotte requested a review from JoanFM January 3, 2023 09:43
JoanFM
JoanFM approved these changes Jan 3, 2023
View reviewed changes
@JoanFM
JoanFM merged commit da3b7f0 into feat-rewrite-v2 Jan 3, 2023
@JoanFM
JoanFM deleted the feat-add-audio-v2 branch January 3, 2023 09:45
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

4 more reviewers
@alaeddine-13 alaeddine-13 alaeddine-13 left review comments
@JoanFM JoanFM JoanFM approved these changes
@JohannesMessner JohannesMessner JohannesMessner approved these changes
@samsja samsja samsja approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

area/core area/entrypoint area/setup area/testing area/typing component/proto size/l

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Add audio predefined document to v2

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@anna-charlotte @alaeddine-13 @JoanFM @JohannesMessner @samsja
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.