GrandaddyShmax / audiocraft_plus

Audiocraft is a library for audio processing and generation with deep learning. It features the state-of-the-art EnCodec audio compressor / tokenizer, along with MusicGen, a simple and controllable music generation LM with textual and melodic conditioning.
MIT License
561 stars 63 forks source link

error on installing, mac OS #15

Closed tob-har closed 1 year ago

tob-har commented 1 year ago

Cannot install on MacOS due to that problem:

ImportError: dlopen(/Users/XXXXX/opt/anaconda3/lib/python3.9/site-packages/taglib.cpython-39-darwin.so, 0x0002): symbol not found in flat namespace (__ZN6TagLib10StringList6appendERKNS_6StringE)

Any idea on how to fix it? Thanks for your support!

mac os 12.6.5 M1

GrandaddyShmax commented 1 year ago

Sadly I myself have no way to check your issue, i do not own any device with mac os.. Searching your error, it is something related to taglib library. Can you check if the TagLib was installed properly and what version is it?

tob-har commented 1 year ago

thanks for getting back! i cloned the repo, torch was already installed, then used pip install -e . seems like an error caused by taglib. I installed taglib v 1.13.1 using brew, and it suceeded. Using python 3.9. Error is not resolved.

Someone sucessfully installed on Mac OS 12.6 M1?

GrandaddyShmax commented 1 year ago

If it'll help I can make a sort of mitigation for Mac os by disabling taglib and everything that depends on it. However this will break the functionality of storing metadata in your generations

tob-har commented 1 year ago

this sounds like a great quick fix! Appreciate your support! For the first run, this downside would be ok. I will continue investigate on the taglib issue on mac on my side and post if I find a solution. Thank you!

GrandaddyShmax commented 1 year ago

I have uploaded a new version temporarily under the branch of mac-os-fix, check if it works for you and I will merge it into the main branch

tob-har commented 1 year ago

Thank you! tested, unfortunately the same issue:

Successfully installed audiocraft-0.0.2a2 (base) XXXXX audiocraft_plus-mac-os-fix % python app.py Traceback (most recent call last): File "/Users/XXXXXX/Documents/audiocraft_plus-mac-os-fix/app.py", line 29, in import taglib ImportError: dlopen(/Users/XXXXXXXX/opt/anaconda3/lib/python3.9/site-packages/taglib.cpython-39-darwin.so, 0x0002): symbol not found in flat namespace (__ZN6TagLib10StringList6appendERKNS_6StringE)

in the app.py file, there is also the 'import taglib' still implemented in line 29.

just tried the original audiocraft version, this runs, but what the gradio interface offers is way to limited, eg. no .wav export :)

tob-har commented 1 year ago

is this a suitable version?

v2.0.0 https://github.com/supermihi/pytaglib

there is one breaking change announced for that version: "breaking change: File.path is now a Path object" see: https://pypi.org/project/pytaglib/

GrandaddyShmax commented 1 year ago

is this a suitable version?

v2.0.0 https://github.com/supermihi/pytaglib

there is one breaking change announced for that version: "breaking change: File.path is now a Path object" see: https://pypi.org/project/pytaglib/

Does that version work for you?

tob-har commented 1 year ago

yes, it is working fine in general. but with this version installed, the audiocraft_pluss app is giving that error mentioned above. Sorry, I am not an expert in that field. If you can give me hints, what exactly I could test for you, please let me know.

btw.: studying your py script "app.py" helped me a lot of understanding general topics in that field. appreciate your work and effort!

GrandaddyShmax commented 1 year ago

yes, it is working fine in general. but with this version installed, the audiocraft_pluss app is giving that error mentioned above. Sorry, I am not an expert in that field. If you can give me hints, what exactly I could test for you, please let me know.

btw.: studying your py script "app.py" helped me a lot of understanding general topics in that field. appreciate your work and effort!

I have updated the mac-os-fix branch, tell me if this time it works. I changed the version to be 2.0.0 for taglib Nvm that.. I found this on their repo

image

Try running python build_taglib.py using cmd (not sure what it is for mac, but some terminal) opened in the audiocraft_plus directory, let me know if it works for you

tob-har commented 1 year ago

cmd refers to the mac terminal.

I built taglib / pytaglib from scratch for my system, works. But still, the error is not resolved. I also tried a dedicated virtual env but also not succeeding.

GrandaddyShmax commented 1 year ago

cmd refers to the mac terminal.

I built taglib / pytaglib from scratch for my system, works. But still, the error is not resolved. I also tried a dedicated virtual env but also not succeeding.

did you run the terminal inside the audiocraft_plus folder?

tob-har commented 1 year ago

yes...

GrandaddyShmax commented 1 year ago

In that case ill just make a separate branch supporting only mac. I updated the mac-os-fix branch once again, this time removing entirely taglib and all it's dependencies, check if it works for you

tob-har commented 1 year ago

Great! Works perfectly well. Thank you!

I just had to out comment/delete lines 405 and 406 of your code:

#torch.cuda.empty_cache()
#torch.cuda.ipc_collect()

as the mac runs the process on CPU and trying to call the functions above crashes the process at that moment.

GrandaddyShmax commented 1 year ago

Great! Works perfectly well. Thank you!

I just had to out comment/delete lines 405 and 406 of your code:

#torch.cuda.empty_cache()
#torch.cuda.ipc_collect()

as the mac runs the process on CPU and trying to call the functions above crashes the process at that moment.

ill update the branch so that the future updates will not enable them again 👍

tob-har commented 1 year ago

Great! Thank you for your work!!!