Skip to content

Commit

Permalink
Install diffusers before checking for token. (#2072)
Browse files Browse the repository at this point in the history
Summary:
This PR moves the `install_diffusers()` call before checking whether HF token is in the environment. This is so users don't need to set the token at the time of installation.

Pull Request resolved: #2072

Reviewed By: aaronenyeshi

Differential Revision: D51749249

Pulled By: xuzhao9

fbshipit-source-id: 7b0b37c530af17f23cde787198e88bfea6507004
  • Loading branch information
ysiraichi authored and facebook-github-bot committed Dec 1, 2023
1 parent 083a56d commit 0f27ba1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ def load_model_checkpoint():
StableDiffusionPipeline.from_pretrained(MODEL_NAME, torch_dtype=torch.float16, safety_checker=None)

if __name__ == "__main__":
install_diffusers()
if not 'HUGGING_FACE_HUB_TOKEN' in os.environ:
warnings.warn("Make sure to set `HUGGINGFACE_HUB_TOKEN` so you can download weights")
else:
install_diffusers()
load_model_checkpoint()
2 changes: 1 addition & 1 deletion torchbenchmark/models/stable_diffusion_unet/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ def load_model_checkpoint():
StableDiffusionPipeline.from_pretrained(MODEL_NAME, torch_dtype=torch.float16, safety_checker=None)

if __name__ == "__main__":
install_diffusers()
if not 'HUGGING_FACE_HUB_TOKEN' in os.environ:
warnings.warn("Make sure to set `HUGGINGFACE_HUB_TOKEN` so you can download weights")
else:
install_diffusers()
load_model_checkpoint()

0 comments on commit 0f27ba1

Please sign in to comment.