Downloading and caching ability when loading checkpoints (similar to Transformers API).
Can now provide a checkpoint filename or a checkpoint URL (or just a file path as before). Regardless, value passed to checkpoint_path in Phonemizer.from_checkpoint() should end with .pt. See test results below.
If just a checkpoint name is provided, it will try to retrieve the checkpoint under the DEFAULT_MODEL_BUCKET (see dp/model/model.py).
>>> phonemizer = Phonemizer.from_checkpoint('en_us_cmudict_forward.pt')
Loading model from /PATH/TO/.cache/cached_path/6c84425c...
>>>
Cached model loaded
>>> phonemizer = Phonemizer.from_checkpoint('en_us_cmudict_forward.pt')
Loading model from /PATH/TO/.cache/cached_path/6c84425c...
>>>
URL to checkpoint provided
>>> phonemizer = Phonemizer.from_checkpoint('https://public-asai-dl-models.s3.eu-central-1.amazonaws.com/DeepPhonemizer/en_us_cmudict_ipa_forward.pt')
Loading model from /PATH/TO/.cache/cached_path/3f662135...
>>>
Cached model loaded (with just checkpoint name)
>>> phonemizer = Phonemizer.from_checkpoint('en_us_cmudict_ipa_forward.pt')
en_us_cmudict_ipa_forward.pt already exists in cache.
Loading model from /PATH/TO/.cache/cached_path/3f662135...
>>>
Cached model loaded (with checkpoint URL)
>>> phonemizer = Phonemizer.from_checkpoint('https://public-asai-dl-models.s3.eu-central-1.amazonaws.com/DeepPhonemizer/en_us_cmudict_ipa_forward.pt')
en_us_cmudict_ipa_forward.pt already exists in cache.
Loading model from /PATH/TO/.cache/cached_path/3f662135...
>>>
Downloading and caching ability when loading checkpoints (similar to Transformers API).
checkpoint_path
inPhonemizer.from_checkpoint()
should end with.pt
. See test results below.DEFAULT_MODEL_BUCKET
(seedp/model/model.py
).Why?
Test cases:
Invalid file
Invalid checkpoint file
Checkpoint name provided
Cached model loaded
URL to checkpoint provided
Cached model loaded (with just checkpoint name)
Cached model loaded (with checkpoint URL)