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

Speechbrain downloads pretrained models even if local files are passed #1253

Open
gabrielziegler3 opened this issue Jan 14, 2022 · 3 comments
Assignees
Labels
bug Something isn't working confirmed Bug officially confirmed or reproducible; discuss resolution or start writing PR
Projects

Comments

@gabrielziegler3
Copy link

I noticed that when I ran the example for using ECAPATDNN's pretrained model after downloading the files, speechbrain will read the first two files from filesystem and then will start to request the other files from https://huggingface.co/speechbrain/spkrec-ecapa-voxceleb

To reproduce, run:

import torchaudio
from speechbrain.pretrained import EncoderClassifier
classifier = EncoderClassifier.from_hparams(source="path/to/downloaded/model/dir")
signal, fs =torchaudio.load('samples/audio_samples/example1.wav')
embeddings = classifier.encode_batch(signal)

This behaviour may be seamless for most users, but if you do not have internet in an environment and just wants to load the files from filesystem you will not be able to do so with the from_params method.

I figured what was making speechbrain fallback for requests and I am opening a PR to fix this issue.

@Gastron
Copy link
Collaborator

Gastron commented Jan 17, 2022

Actually I think the issue is in the hyperparams.yaml file in that particular repo (and unfortunately this pattern may occur elsewhere): https://huggingface.co/speechbrain/spkrec-ecapa-voxceleb/blob/main/hyperparams.yaml#L54-L58

There hyperparams.yaml explicitly specifies the location of the files. This overrides any default_source given to the Pretrainer. There is no need to explicitly specify the location, it would be more flexible if the paths weren't specified. @mravanelli can you remove those lines?

@wengbenjue
Copy link

When I load local file,It occur OSError: [Errno 62] Too many levels of symbolic links: 'pretrained_models/EncoderClassifier-3077685261458028297/embedding_model.ckpt',

`
verification = SpeakerRecognition.from_hparams(source="/speaker_verification/tdnn/model/CKPT+2022-04-17+20-14-58+00",savedir="pretrained_models/CKPT+2022-04-17+20-14-58+00")

score, prediction = verification.verify_files("speechbrain/spkrec-ecapa-voxceleb/example1.wav", "speechbrain/spkrec-ecapa-voxceleb/example2.flac")
print(score,prediction)
score, prediction = verification.verify_files("speechbrain/spkrec-ecapa-voxceleb/example1.wav", "speechbrain/spkrec-ecapa-voxceleb/example1.wav")
print(score,prediction)
`

@anautsch anautsch added this to To do in CI/CD via automation Apr 21, 2022
@anautsch anautsch moved this from To do to Performance & housekeeping in CI/CD Apr 21, 2022
@Adel-Moumen
Copy link
Collaborator

Hello,

Any news regarding this issue please? Thanks.

Adel

@asumagic asumagic added confirmed Bug officially confirmed or reproducible; discuss resolution or start writing PR bug Something isn't working labels Jul 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working confirmed Bug officially confirmed or reproducible; discuss resolution or start writing PR
Projects
No open projects
CI/CD
Performance & housekeeping
Development

No branches or pull requests

5 participants