Skip to content

Commit

Permalink
Fix model conversion (PABannier#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
vietanhdev committed Aug 16, 2023
1 parent 4f6bf47 commit 5767cf1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,12 @@ In order to build bark.cpp you have two different options. We recommend using `C
### Prepare data & Run

```bash
# obtain the original bark and encodec weights and place them in ./models
python3 download_weights.py --download-dir ./models

# install Python dependencies
python3 -m pip install -r requirements.txt

# obtain the original bark and encodec weights and place them in ./models
python3 download_weights.py --download-dir ./models

# convert the model to ggml format
python3 convert.py \
--dir-model ./models \
Expand Down
6 changes: 3 additions & 3 deletions download_weights.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import torch


ENCODEC_PATH = Path("https://dl.fbaipublicfiles.com/encodec/v0/encodec_24khz-d7cc33bc.th")
ENCODEC_PATH = "https://dl.fbaipublicfiles.com/encodec/v0/encodec_24khz-d7cc33bc.th"

REMOTE_MODEL_PATHS = {
"text": {
Expand Down Expand Up @@ -39,11 +39,11 @@

print(" ### Downloading EnCodec weights...")
state_dict = torch.hub.load_state_dict_from_url(
str(ENCODEC_PATH),
ENCODEC_PATH,
map_location="cpu",
check_hash=True
)
with open(out_dir / ENCODEC_PATH.name, "wb") as fout:
with open(out_dir / Path(ENCODEC_PATH).name, "wb") as fout:
torch.save(state_dict, fout)

print("Done.")

0 comments on commit 5767cf1

Please sign in to comment.