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

Pretrained.from_hparams() failing on windows when non admin #1155

Open
gfournier opened this issue Nov 24, 2021 · 7 comments · May be fixed by #2476
Open

Pretrained.from_hparams() failing on windows when non admin #1155

gfournier opened this issue Nov 24, 2021 · 7 comments · May be fixed by #2476
Assignees
Projects

Comments

@gfournier
Copy link

gfournier commented Nov 24, 2021

The following code is failing on windows with non-admin rights (not a big issue but sadly a "standard" case in lots of "big" companies) due to symlinks.

EncoderClassifier.from_hparams(
  source=r"C:\path\to\pretrained\model",
  savedir="./tmp",
  overrides={"pretrained_path": r"C:\path\to\pretrained\model"})

I fixed it locally by copying models to savedir instead of making a symlink (fetching.py:L102), BUT I will not submit it as a fix.

try:
  destination.symlink_to(sourcepath)
except:
  import shutil
  shutil.copyfile(sourcepath, destination)

I can start working on local loading feature in a PR if you're interested. When loading from local, we could even avoid copying or symlinking directories and loading directly from the local folder for example.

@gfournier
Copy link
Author

EDIT: it works well for following configuration as a workround, I let you decide if you need a better solution :)

EncoderClassifier.from_hparams(
  source=r"C:\path\to\pretrained\model",
  savedir=r"C:\path\to\pretrained\model",
  overrides={"pretrained_path": r"C:\path\to\pretrained\model"})

@Gastron
Copy link
Collaborator

Gastron commented Nov 24, 2021

Yes, this is a known issue, see for instance #893. Thanks for a new workaround idea! At the moment we don't plan to change this implementation just for Windows users who cannot run with the right permissions. However, this might get solved as a side product if we decide to move away from symlinks to real copies - which seems to be behaviour that multiple users expect.

@gfournier
Copy link
Author

I found a new one with latest version 0.5.11:
https://github.com/speechbrain/speechbrain/blame/9d56d50809d8745cc7dafa930aec554145be4028/speechbrain/pretrained/interfaces.py#L281

A fetch of a custom.py file has been introduced and a symlink is created if the file is missing.
This customization cannot be bypassed by passing None for example.

@Gastron
Copy link
Collaborator

Gastron commented Feb 11, 2022

Ooh that is just a bug in how local sources are handled!

@anautsch anautsch added this to To do in CI/CD via automation Apr 21, 2022
@padmalcom
Copy link
Contributor

FYI this issue still exists for Tacotron2.from_hparams on Windows.

@Adel-Moumen
Copy link
Collaborator

Hello,

Any news on this issue please?

Thanks.

@tomwagstaff-opml
Copy link

I'd also be interested in an update. There are quite a few of us Windows users out there without admin rights 😅

Even some further explanation / documentation of the workarounds would be useful, although in my case I'm using a package that depends on speechbrain so I can't implement any workarounds directly.

@asumagic asumagic linked a pull request Mar 27, 2024 that will close this issue
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
CI/CD
To do
Development

Successfully merging a pull request may close this issue.

5 participants