better access token loading
Browse files- nerf/sd.py +3 -3
- 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]
|
21 |
except FileNotFoundError as e:
|
22 |
-
|
23 |
-
print(f'[INFO]
|
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
|
|
|
|
|
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
|