Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Pickling Windows #107

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
description='Training and inference tools for generative audio models from Stability AI',
packages=find_packages(),
install_requires=[
'dill',
'aeiou==0.0.20',
'alias-free-torch==0.0.6',
'auraloss==0.4.0',
Expand Down Expand Up @@ -41,4 +42,4 @@
'webdataset==0.2.48',
'x-transformers<1.27.0'
],
)
)
9 changes: 5 additions & 4 deletions stable_audio_tools/data/dataset.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import importlib
import dill
import numpy as np
import io
import os
Expand Down Expand Up @@ -155,7 +156,7 @@ def __init__(
self.root_paths.append(config.path)
self.filenames.extend(get_audio_filenames(config.path, keywords))
if config.custom_metadata_fn is not None:
self.custom_metadata_fns[config.path] = config.custom_metadata_fn
self.custom_metadata_fns[config.path] = dill.dumps(config.custom_metadata_fn)

print(f'Found {len(self.filenames)} files')

Expand Down Expand Up @@ -216,8 +217,8 @@ def __getitem__(self, idx):

for custom_md_path in self.custom_metadata_fns.keys():
if custom_md_path in audio_filename:
custom_metadata_fn = self.custom_metadata_fns[custom_md_path]
custom_metadata = custom_metadata_fn(info, audio)
custom_metadata_fn_deserialized = dill.loads(self.custom_metadata_fns[custom_md_path])
custom_metadata = custom_metadata_fn_deserialized(info, audio)
info.update(custom_metadata)

if "__reject__" in info and info["__reject__"]:
Expand Down Expand Up @@ -651,4 +652,4 @@ def create_dataloader_from_config(dataset_config, batch_size, sample_size, sampl
persistent_workers=True,
force_channels=force_channels,
epoch_steps=dataset_config.get("epoch_steps", 2000)
).data_loader
).data_loader