nateraw / stable-diffusion-videos

Create 🔥 videos with Stable Diffusion by exploring the latent space and morphing between text prompts
Apache License 2.0
4.4k stars 421 forks source link

RE: Token #80

Open ClickToConfirm opened 1 year ago

ClickToConfirm commented 1 year ago

Unable to copy paste token from Huggingface, regards login. tried both Powershell and CMD

nateraw commented 1 year ago

Hi there - what exactly is the problem?

ClickToConfirm commented 1 year ago

I'm unable to copy and past the token from my hugging face account into either Command Prompt nor Powershell, is there another way to login?

nateraw commented 1 year ago

Many ways to deal with this...

One way is to just pass the token directly to pipeline on init with use_auth_token.

from stable_diffusion_videos import StableDiffusionWalkPipeline
import torch

pipeline = StableDiffusionWalkPipeline.from_pretrained(
    "CompVis/stable-diffusion-v1-4",
    use_auth_token="YOUR TOKEN HERE",
    torch_dtype=torch.float16,
    revision="fp16",
).to("cuda")

I don't like tokens in my code though...you can write a script real quick to do this separately. (Relevant Docs Link)

from huggingface_hub import HfFolder

HfFolder().save_token("YOUR TOKEN")

If you do the above, you should be logged in, and can use the code as you were before with use_auth_token=True. You can verify by running huggingface-cli whoami from the terminal.

ClickToConfirm commented 1 year ago

So, which file do I need to modify in order to acheive this task?

nateraw commented 1 year ago

You could run that last snippet in a separate file, and you'll be logged in. By running it, it creates the ~/.huggingface/token file which contains your token. This is how we check if you're logged in.