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

FbankOpts (and others) conversion to/from dict #8

Closed
pzelasko opened this issue Oct 14, 2021 · 4 comments
Closed

FbankOpts (and others) conversion to/from dict #8

pzelasko opened this issue Oct 14, 2021 · 4 comments

Comments

@pzelasko
Copy link

Would it be possible to add a conversion mechanism for the Opts classes to/from dict? It would make it much easier for me to integrate kaldifeat in Lhotse. I'm using dataclasses for configuration of all feature extractors, like this:

https://github.com/lhotse-speech/lhotse/blob/f5bd2063291b7d789d4b8a2a50396d2ffa76eb2c/lhotse/features/fbank.py#L9-L31

Example API could look like this:

# Read a dict
config = {"frame_shift": 0.012, "use_energy": True}
extractor = kaldifeat.Fbank(kaldifeat.FbankOptions.from_dict(config))

# Store to a dict
config2 = extractor.opts.to_dict()
# config2 = {... a list of all settings ...}
@csukuangfj
Copy link
Owner

Yes, it's doable. Will add it tomorrow.

@csukuangfj
Copy link
Owner

@pzelasko
Please install kaldifeat v1.8 from PyPI, i.e.,

pip install -v kaldifeat==1.8

Fixed and merged in #9

@pzelasko
Copy link
Author

Thanks, will check it out!

@pzelasko
Copy link
Author

It works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants