hubertsiuzdak / snac

Multi-Scale Neural Audio Codec (SNAC) compresses audio into discrete codes at a low bitrate
https://hubertsiuzdak.github.io/snac/
MIT License
438 stars 26 forks source link

Fix the bug when loading model from local path. #22

Closed Pongking closed 2 months ago

Pongking commented 2 months ago

21

Fix the bug when loading model from local path.

from snac import SNAC snacmodel = SNAC.from_pretrained(Path("/root/XXX/model/snac_24khz")).eval().to(device)

hubertsiuzdak commented 2 months ago

Instead of wrapping the string path with a pathlib.Path object, we can just use os.path.isdir() to check the filesystem path.

This is also how huggingface handles it in hub_mixin.py

Would you mind updating the PR with this change?

Pongking commented 2 months ago

Thank you very much, I will modify it immediately :)

Pongking commented 2 months ago

Thank you so much,that's really a great learning opportunity for me.thank you!!

hubertsiuzdak commented 2 months ago

thanks!

sankexin commented 2 months ago

snacmodel = SNAC.from_pretrained("hubertsiuzdak/snac_24khz", local_dir="/root/mini-omni/snac_24khz",).eval().to(device)