ashawkey commited on
Commit
dca1681
1 Parent(s): 69fbfd2

better access token loading

Browse files
Files changed (2) hide show
  1. nerf/sd.py +3 -3
  2. readme.md +3 -1
nerf/sd.py CHANGED
@@ -17,10 +17,10 @@ class StableDiffusion(nn.Module):
17
  try:
18
  with open('./TOKEN', 'r') as f:
19
  self.token = f.read().replace('\n', '') # remove the last \n!
20
- print(f'[INFO] successfully loaded hugging face user token!')
21
  except FileNotFoundError as e:
22
- print(e)
23
- print(f'[INFO] Please first create a file called TOKEN and copy your hugging face access token into it to download stable diffusion checkpoints.')
24
 
25
  self.device = device
26
  self.num_train_timesteps = 1000
 
17
  try:
18
  with open('./TOKEN', 'r') as f:
19
  self.token = f.read().replace('\n', '') # remove the last \n!
20
+ print(f'[INFO] loaded hugging face access token from ./TOKEN!')
21
  except FileNotFoundError as e:
22
+ self.token = True
23
+ print(f'[INFO] try to load hugging face access token from the default plase, make sure you have run `huggingface-cli login`.')
24
 
25
  self.device = device
26
  self.num_train_timesteps = 1000
readme.md CHANGED
@@ -33,7 +33,9 @@ git clone https://github.com/ashawkey/stable-dreamfusion.git
33
  cd stable-dreamfusion
34
  ```
35
 
36
- **Important**: To download the Stable Diffusion model checkpoint, you should create a file called `TOKEN` under this directory (i.e., `stable-dreamfusion/TOKEN`) and copy your hugging face [access token](https://huggingface.co/docs/hub/security-tokens) into it.
 
 
37
 
38
  ### Install with pip
39
  ```bash
 
33
  cd stable-dreamfusion
34
  ```
35
 
36
+ **Important**: To download the Stable Diffusion model checkpoint, you should provide your [access token](https://huggingface.co/settings/tokens). You could choose either of the following ways:
37
+ * Run `huggingface-cli login` and enter your token.
38
+ * Create a file called `TOKEN` under this directory (i.e., `stable-dreamfusion/TOKEN`) and copy your token into it.
39
 
40
  ### Install with pip
41
  ```bash