bark icon indicating copy to clipboard operation
bark copied to clipboard

Download the models manually

Open flyisland opened this issue 2 years ago • 3 comments

Hi, the download of the models is slow and unstable from my location,

image

This download takes more than 10 hours, and it does not support "resume download". I have tried several times, but it still cannot be successfully executed

Can you please provide the publicly accessible URL for these models so I can download them using a download tool and manually place them in the CACHE folder?

flyisland avatar Apr 22 '23 03:04 flyisland

@flyisland i believe the URLs you're looking for can be constructed from here: https://github.com/suno-ai/bark/blob/main/bark/generation.py#L86

khimaros avatar Apr 22 '23 09:04 khimaros

@khimaros Thanks, I tried it but received the message "You are not authorized to view this object." I'm not sure which models I should download. A Readme about this would be greatly appreciated.

flyisland avatar Apr 22 '23 09:04 flyisland

@flyisland maybe you are concatenating the strings incorrectly. here's what worked for me:

for model in text_2 coarse_2 fine_2; do
    wget https://dl.suno-models.io/bark/models/v0/${model}.pt
done

khimaros avatar Apr 22 '23 17:04 khimaros

you might wanna use the reconnect option as well incase of partial downloads, for example this: wget -c https://dl.suno-models.io/bark/models/v0/text_2.pt -O ~/.cache/suno/bark_v0/54afa89d65e318d4f5f80e8e8799026a.pt

gkucsko avatar Apr 22 '23 21:04 gkucsko

Thanks, @khimaros and @gkucsko, it works for me now!

flyisland avatar Apr 23 '23 01:04 flyisland

you might wanna use the reconnect option as well incase of partial downloads, for example this: wget -c https://dl.suno-models.io/bark/models/v0/text_2.pt -O ~/.cache/suno/bark_v0/54afa89d65e318d4f5f80e8e8799026a.pt

Do I have to change the model name to its checksum as the file name? Strange that when I run the example from README, it automatically download a file named with "e32937063d7ccececc61b2d2a3bb0a13.pt", while it is not any checksum listed in the codes.

mobilestack avatar Apr 23 '23 05:04 mobilestack

you might wanna use the reconnect option as well incase of partial downloads, for example this: wget -c https://dl.suno-models.io/bark/models/v0/text_2.pt -O ~/.cache/suno/bark_v0/54afa89d65e318d4f5f80e8e8799026a.pt

Do I have to change the model name to its checksum as the file name? Strange that when I run the example from README, it automatically download a file named with "e32937063d7ccececc61b2d2a3bb0a13.pt", while it is not any checksum listed in the codes.

ll ~/.cache/suno/bark_v0
total 25448312
-rw-r--r--  1 ichen  staff   3.5G Apr 22 18:25 6285677e88715abde42a9924db939b3b.pt
-rw-r--r--  1 ichen  staff   3.7G Apr 22 17:36 751d4d3d562e63ead5311ebe2a5f45a8.pt
-rw-r--r--  1 ichen  staff   5.0G Apr 22 17:11 e32937063d7ccececc61b2d2a3bb0a13.pt

flyisland avatar Apr 23 '23 07:04 flyisland

you might wanna use the reconnect option as well incase of partial downloads, for example this: wget -c https://dl.suno-models.io/bark/models/v0/text_2.pt -O ~/.cache/suno/bark_v0/54afa89d65e318d4f5f80e8e8799026a.pt

Do I have to change the model name to its checksum as the file name? Strange that when I run the example from README, it automatically download a file named with "e32937063d7ccececc61b2d2a3bb0a13.pt", while it is not any checksum listed in the codes.

ll ~/.cache/suno/bark_v0
total 25448312
-rw-r--r--  1 ichen  staff   3.5G Apr 22 18:25 6285677e88715abde42a9924db939b3b.pt
-rw-r--r--  1 ichen  staff   3.7G Apr 22 17:36 751d4d3d562e63ead5311ebe2a5f45a8.pt
-rw-r--r--  1 ichen  staff   5.0G Apr 22 17:11 e32937063d7ccececc61b2d2a3bb0a13.pt

mine is

-rw-r--r--@ 1 tony  staff   5.0G  4 23 13:53 54afa89d65e318d4f5f80e8e8799026a.pt
-rw-r--r--@ 1 tony  staff   3.5G  4 23 14:07 59d184ed44e3650774a2f0503a48a97b.pt
-rw-r--r--@ 1 tony  staff   3.7G  4 23 14:07 8a98094e5e3a255a5c9c0ab7efe8fd28.pt

might be the v1 and v2 difference.

mobilestack avatar Apr 23 '23 10:04 mobilestack

these should be all the current models needed:

# download small models
wget -c https://dl.suno-models.io/bark/models/v0/text.pt -O ~/.cache/suno/bark_v0/41a4361a0bb21b667a35fbf76a309a77.pt
wget -c https://dl.suno-models.io/bark/models/v0/coarse.pt -O ~/.cache/suno/bark_v0/db7988c269f58606a4b3a3d3497c6b95.pt
wget -c https://dl.suno-models.io/bark/models/v0/fine.pt -O ~/.cache/suno/bark_v0/0f6f3420c8bb574f74e75e6f7f59a510.pt
    
# download large models
wget -c https://dl.suno-models.io/bark/models/v0/text_2.pt -O ~/.cache/suno/bark_v0/e32937063d7ccececc61b2d2a3bb0a13.pt
wget -c https://dl.suno-models.io/bark/models/v0/coarse_2.pt -O ~/.cache/suno/bark_v0/751d4d3d562e63ead5311ebe2a5f45a8.pt
wget -c https://dl.suno-models.io/bark/models/v0/fine_2.pt -O ~/.cache/suno/bark_v0/6285677e88715abde42a9924db939b3b.pt

gkucsko avatar Apr 23 '23 12:04 gkucsko

these should be all the current models needed:

# download small models
wget -c https://dl.suno-models.io/bark/models/v0/text.pt -O ~/.cache/suno/bark_v0/41a4361a0bb21b667a35fbf76a309a77.pt
wget -c https://dl.suno-models.io/bark/models/v0/coarse.pt -O ~/.cache/suno/bark_v0/db7988c269f58606a4b3a3d3497c6b95.pt
wget -c https://dl.suno-models.io/bark/models/v0/fine.pt -O ~/.cache/suno/bark_v0/0f6f3420c8bb574f74e75e6f7f59a510.pt
    
# download large models
wget -c https://dl.suno-models.io/bark/models/v0/text_2.pt -O ~/.cache/suno/bark_v0/e32937063d7ccececc61b2d2a3bb0a13.pt
wget -c https://dl.suno-models.io/bark/models/v0/coarse_2.pt -O ~/.cache/suno/bark_v0/751d4d3d562e63ead5311ebe2a5f45a8.pt
wget -c https://dl.suno-models.io/bark/models/v0/fine_2.pt -O ~/.cache/suno/bark_v0/6285677e88715abde42a9924db939b3b.pt

I wonder why is that for text_2.pt, has these two results? e32937063d7ccececc61b2d2a3bb0a13 and 54afa89d65e318d4f5f80e8e8799026a

mobilestack avatar Apr 23 '23 13:04 mobilestack

following @gkucsko instructions with the large models results in the text_2.pt continuously being overwritten with found outdated text model, removing. -- i think the checksum of that file is incorrect vs. what is listed in the python code in main branch.

i also suspect there is something wrong with the code being used to download these files, as wget is extremely reliable and fast, but generate.py fails almost every time i run it. there should probably be a bug tracking the reliability issue.

EDIT: it seems like the reason the model was being removed is because i was resuming the download after generate.py crashed which was resulting in inconsistent data. if i use the wget method listed in my comment below, everything works great!

khimaros avatar Apr 23 '23 19:04 khimaros

@mobilestack

Do I have to change the model name to its checksum as the file name? Strange that when I run the example from README, it automatically download a file named with "e32937063d7ccececc61b2d2a3bb0a13.pt", while it is not any checksum listed in the codes.

looking at the code in generate._get_ckpt_path(), it seems like the file name is actually a hash of the URL used to fetch the file, which is quite odd.

    model_name = _string_md5(REMOTE_MODEL_PATHS[model_key]["path"])

perhaps they intended to use _md5() here to hash the contents of the file instead?

just confirming this with a little bit of shell:

$ echo -en "https://dl.suno-models.io/bark/models/v0/text_2.pt" | md5sum
e32937063d7ccececc61b2d2a3bb0a13  -

it seems in general that the model download code is quite buggy and could probably use a bit of a review and tidying up.

khimaros avatar Apr 23 '23 19:04 khimaros

this should work to download all of the files (with resume):

for model in text coarse fine text_2 coarse_2 fine_2; do
    remote_url="https://dl.suno-models.io/bark/models/v0/${model}.pt"
    remote_md5=$(echo -en "${remote_url}" | md5sum | awk '{ print $1 }')
    out_path=~/.cache/suno/bark_v0/${remote_md5}.pt
    echo "fetching model ${model} ${remote_url} to ${out_path} ..."
    wget -c "${remote_url}" -O "${out_path}"
done

this is the list of files with their md5sum after finishing on my computer:

$ md5sum ~/.cache/suno/bark_v0/* | sed -r 's/\/home\/(.*?)\/.cache\///g'
5428d1befe05be2ba32195496e58dc90  suno/bark_v0/0f6f3420c8bb574f74e75e6f7f59a510.pt
b3e42bcbab23b688355cd44128c4cdd3  suno/bark_v0/41a4361a0bb21b667a35fbf76a309a77.pt
59d184ed44e3650774a2f0503a48a97b  suno/bark_v0/6285677e88715abde42a9924db939b3b.pt
8a98094e5e3a255a5c9c0ab7efe8fd28  suno/bark_v0/751d4d3d562e63ead5311ebe2a5f45a8.pt
5fe964825e3b0321f9d5f3857b89194d  suno/bark_v0/db7988c269f58606a4b3a3d3497c6b95.pt
54afa89d65e318d4f5f80e8e8799026a  suno/bark_v0/e32937063d7ccececc61b2d2a3bb0a13.pt

and the checksums as stored in generate.py:

$ grep -B1 checksum ~/.cache/pypoetry/virtualenvs/third-brain-IMBisF_0-py3.10/lib/python3.10/site-packages/bark/generation.py
        "path": os.path.join(REMOTE_BASE_URL, "text.pt"),
        "checksum": "b3e42bcbab23b688355cd44128c4cdd3",
--
        "path": os.path.join(REMOTE_BASE_URL, "coarse.pt"),
        "checksum": "5fe964825e3b0321f9d5f3857b89194d",
--
        "path": os.path.join(REMOTE_BASE_URL, "fine.pt"),
        "checksum": "5428d1befe05be2ba32195496e58dc90",
--
        "path": os.path.join(REMOTE_BASE_URL, "text_2.pt"),
        "checksum": "54afa89d65e318d4f5f80e8e8799026a",
--
        "path": os.path.join(REMOTE_BASE_URL, "coarse_2.pt"),
        "checksum": "8a98094e5e3a255a5c9c0ab7efe8fd28",
--
        "path": os.path.join(REMOTE_BASE_URL, "fine_2.pt"),
        "checksum": "59d184ed44e3650774a2f0503a48a97b",

actually looks like everything matches up nicely.

khimaros avatar Apr 23 '23 19:04 khimaros

are all three models needed ? can we just use one ?

wiz64 avatar Jul 03 '23 16:07 wiz64

this should work to download all of the files (with resume):

for model in text coarse fine text_2 coarse_2 fine_2; do
    remote_url="https://dl.suno-models.io/bark/models/v0/${model}.pt"
    remote_md5=$(echo -en "${remote_url}" | md5sum | awk '{ print $1 }')
    out_path=~/.cache/suno/bark_v0/${remote_md5}.pt
    echo "fetching model ${model} ${remote_url} to ${out_path} ..."
    wget -c "${remote_url}" -O "${out_path}"
done

this is the list of files with their md5sum after finishing on my computer:

$ md5sum ~/.cache/suno/bark_v0/* | sed -r 's/\/home\/(.*?)\/.cache\///g'
5428d1befe05be2ba32195496e58dc90  suno/bark_v0/0f6f3420c8bb574f74e75e6f7f59a510.pt
b3e42bcbab23b688355cd44128c4cdd3  suno/bark_v0/41a4361a0bb21b667a35fbf76a309a77.pt
59d184ed44e3650774a2f0503a48a97b  suno/bark_v0/6285677e88715abde42a9924db939b3b.pt
8a98094e5e3a255a5c9c0ab7efe8fd28  suno/bark_v0/751d4d3d562e63ead5311ebe2a5f45a8.pt
5fe964825e3b0321f9d5f3857b89194d  suno/bark_v0/db7988c269f58606a4b3a3d3497c6b95.pt
54afa89d65e318d4f5f80e8e8799026a  suno/bark_v0/e32937063d7ccececc61b2d2a3bb0a13.pt

and the checksums as stored in generate.py:

$ grep -B1 checksum ~/.cache/pypoetry/virtualenvs/third-brain-IMBisF_0-py3.10/lib/python3.10/site-packages/bark/generation.py
        "path": os.path.join(REMOTE_BASE_URL, "text.pt"),
        "checksum": "b3e42bcbab23b688355cd44128c4cdd3",
--
        "path": os.path.join(REMOTE_BASE_URL, "coarse.pt"),
        "checksum": "5fe964825e3b0321f9d5f3857b89194d",
--
        "path": os.path.join(REMOTE_BASE_URL, "fine.pt"),
        "checksum": "5428d1befe05be2ba32195496e58dc90",
--
        "path": os.path.join(REMOTE_BASE_URL, "text_2.pt"),
        "checksum": "54afa89d65e318d4f5f80e8e8799026a",
--
        "path": os.path.join(REMOTE_BASE_URL, "coarse_2.pt"),
        "checksum": "8a98094e5e3a255a5c9c0ab7efe8fd28",
--
        "path": os.path.join(REMOTE_BASE_URL, "fine_2.pt"),
        "checksum": "59d184ed44e3650774a2f0503a48a97b",

actually looks like everything matches up nicely.

I get a syntax error when using this code

image

kevinambrose avatar Nov 28 '23 15:11 kevinambrose