Skip to content

Conversation

@f0k
Copy link
Contributor

@f0k f0k commented Sep 4, 2020

Stumbled upon a little gem in the audio conversion for SummaryWriter.add_audio(): two Python for loops to convert a float array to little-endian int16 samples. On my machine, this took 35 seconds for a 30-second 22.05 kHz excerpt. The same can be done directly in numpy in 1.65 milliseconds. (No offense, I'm glad that the functionality was there!)

Would also be ready to extend this to support stereo waveforms, or should this become a separate PR?

@dr-ci
Copy link

dr-ci bot commented Sep 4, 2020

💊 CI failures summary and remediations

As of commit 4835ddc (more details on the Dr. CI page):



🕵️ 3 new failures recognized by patterns

The following CI failures do not appear to be due to upstream breakages:

See CircleCI build pytorch_xla_linux_bionic_py3_6_clang9_build (1/3)

Step: "(Optional) Merge target branch" (full log | diagnosis details | 🔁 rerun)

Automatic merge failed; fix conflicts and then commit the result.
CONFLICT (add/add): Merge conflict in .circleci/cimodel/data/pytorch_build_definitions.py 
Auto-merging .circleci/cimodel/data/pytorch_build_definitions.py 
CONFLICT (add/add): Merge conflict in .circleci/cimodel/data/pytorch_build_data.py 
Auto-merging .circleci/cimodel/data/pytorch_build_data.py 
CONFLICT (add/add): Merge conflict in .circleci/cimodel/data/dimensions.py 
Auto-merging .circleci/cimodel/data/dimensions.py 
CONFLICT (add/add): Merge conflict in .circleci/cimodel/data/binary_build_definitions.py 
Auto-merging .circleci/cimodel/data/binary_build_definitions.py 
CONFLICT (add/add): Merge conflict in .circleci/cimodel/data/binary_build_data.py 
Auto-merging .circleci/cimodel/data/binary_build_data.py 
Automatic merge failed; fix conflicts and then commit the result. 

See CircleCI build pytorch_linux_xenial_py3_6_gcc5_4_build (2/3)

Step: "(Optional) Merge target branch" (full log | diagnosis details | 🔁 rerun)

Automatic merge failed; fix conflicts and then commit the result.
CONFLICT (add/add): Merge conflict in .circleci/cimodel/data/pytorch_build_definitions.py 
Auto-merging .circleci/cimodel/data/pytorch_build_definitions.py 
CONFLICT (add/add): Merge conflict in .circleci/cimodel/data/pytorch_build_data.py 
Auto-merging .circleci/cimodel/data/pytorch_build_data.py 
CONFLICT (add/add): Merge conflict in .circleci/cimodel/data/dimensions.py 
Auto-merging .circleci/cimodel/data/dimensions.py 
CONFLICT (add/add): Merge conflict in .circleci/cimodel/data/binary_build_definitions.py 
Auto-merging .circleci/cimodel/data/binary_build_definitions.py 
CONFLICT (add/add): Merge conflict in .circleci/cimodel/data/binary_build_data.py 
Auto-merging .circleci/cimodel/data/binary_build_data.py 
Automatic merge failed; fix conflicts and then commit the result. 

See CircleCI build pytorch_linux_xenial_cuda9_2_cudnn7_py3_gcc5_4_build (3/3)

Step: "(Optional) Merge target branch" (full log | diagnosis details | 🔁 rerun)

Automatic merge failed; fix conflicts and then commit the result.
CONFLICT (add/add): Merge conflict in .circleci/cimodel/data/pytorch_build_definitions.py 
Auto-merging .circleci/cimodel/data/pytorch_build_definitions.py 
CONFLICT (add/add): Merge conflict in .circleci/cimodel/data/pytorch_build_data.py 
Auto-merging .circleci/cimodel/data/pytorch_build_data.py 
CONFLICT (add/add): Merge conflict in .circleci/cimodel/data/dimensions.py 
Auto-merging .circleci/cimodel/data/dimensions.py 
CONFLICT (add/add): Merge conflict in .circleci/cimodel/data/binary_build_definitions.py 
Auto-merging .circleci/cimodel/data/binary_build_definitions.py 
CONFLICT (add/add): Merge conflict in .circleci/cimodel/data/binary_build_data.py 
Auto-merging .circleci/cimodel/data/binary_build_data.py 
Automatic merge failed; fix conflicts and then commit the result. 

❄️ 2 failures tentatively classified as flaky

but reruns have not yet been triggered to confirm:

See CircleCI build pytorch_windows_vs2019_py36_cuda10.1_test2 (1/2)

Step: "Test" (full log | diagnosis details | 🔁 rerun) ❄️

ModuleNotFoundError: No module named 'torch'
[ERROR:VsDevCmd.bat] vsdevcmd.bat [args] for additional details. 
[ERROR:VsDevCmd.bat] Where [value] is: 
[ERROR:VsDevCmd.bat]    1 : basic debug logging 
[ERROR:VsDevCmd.bat]    2 : detailed debug logging 
[ERROR:VsDevCmd.bat]    3 : trace level logging. Redirection of output to a file when using this level is recommended. 
[ERROR:VsDevCmd.bat] Example: set VSCMD_DEBUG=3 
[ERROR:VsDevCmd.bat]          vsdevcmd.bat > vsdevcmd.trace.txt 2>&1 
Traceback (most recent call last): 
  File "run_test.py", line 13, in <module> 
    import torch 
ModuleNotFoundError: No module named 'torch' 
+ cleanup
+ retcode=1
+ set +x

See CircleCI build pytorch_windows_vs2019_py36_cuda10.1_test1 (2/2)

Step: "Test" (full log | diagnosis details | 🔁 rerun) ❄️

ModuleNotFoundError: No module named 'torch'
[ERROR:VsDevCmd.bat] Where [value] is: 
[ERROR:VsDevCmd.bat]    1 : basic debug logging 
[ERROR:VsDevCmd.bat]    2 : detailed debug logging 
[ERROR:VsDevCmd.bat]    3 : trace level logging. Redirection of output to a file when using this level is recommended. 
[ERROR:VsDevCmd.bat] Example: set VSCMD_DEBUG=3 
[ERROR:VsDevCmd.bat]          vsdevcmd.bat > vsdevcmd.trace.txt 2>&1 
Run jit_profiling tests 
Traceback (most recent call last): 
  File "run_test.py", line 13, in <module> 
    import torch 
ModuleNotFoundError: No module named 'torch' 
+ cleanup
+ retcode=1
+ set +x

This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.

Please report bugs/suggestions on the GitHub issue tracker or post in the (internal) Dr. CI Users group.

See how this bot performed.

This comment has been revised 12 times.

@f0k f0k force-pushed the sane-tensorboard-audio branch from 7bcb5f6 to 4dc8571 Compare September 4, 2020 16:58
@ngimel ngimel requested a review from J0Nreynolds September 16, 2020 03:32
@ngimel
Copy link
Collaborator

ngimel commented Sep 16, 2020

Pytorch does not depend on numpy, so you can't directly use numpy. I'm not sure if this is true for tensorboard.

@ngimel ngimel added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label Sep 16, 2020
@f0k
Copy link
Contributor Author

f0k commented Sep 21, 2020

Pytorch does not depend on numpy, so you can't directly use numpy. I'm not sure if this is true for tensorboard.

Good call, but numpy was already imported and used in that file before my change, and the first thing the audio() function does is to convert the incoming tensor to a numpy array. So this shouldn't be a problem.

@f0k f0k changed the title Sane audio conversion for SummaryWriter 20000x faster audio conversion for SummaryWriter Sep 21, 2020
Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@edward-io has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@edward-io edward-io self-requested a review September 22, 2020 20:51
Copy link
Contributor

@edward-io edward-io left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great to me, thanks for your contribution @f0k. Small nit on imports.

Feel free to open a separate PR for stereo waveforms.

@f0k f0k force-pushed the sane-tensorboard-audio branch from 4dc8571 to 43f758d Compare September 25, 2020 15:02
@f0k f0k force-pushed the sane-tensorboard-audio branch from 43f758d to 4835ddc Compare September 25, 2020 15:05
Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@edward-io has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@edward-io edward-io self-requested a review September 28, 2020 22:17
@edward-io
Copy link
Contributor

Thanks @f0k!

@facebook-github-bot
Copy link
Contributor

@edward-io merged this pull request in 6a206df.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Merged open source triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants