Spaces:
Runtime error
Runtime error
first commit
Browse files- lib/util.py +10 -2
lib/util.py
CHANGED
@@ -25,8 +25,16 @@ import torch.nn as nn
|
|
25 |
import numpy as np
|
26 |
from einops import repeat
|
27 |
|
28 |
-
from ..utils import instantiate_from_config
|
29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
|
31 |
def make_beta_schedule(schedule, n_timestep, linear_start=1e-4, linear_end=2e-2, cosine_s=8e-3):
|
32 |
if schedule == "linear":
|
|
|
25 |
import numpy as np
|
26 |
from einops import repeat
|
27 |
|
28 |
+
#from ..utils import instantiate_from_config
|
29 |
+
|
30 |
+
def instantiate_from_config(config):
|
31 |
+
if not "target" in config:
|
32 |
+
if config == '__is_first_stage__':
|
33 |
+
return None
|
34 |
+
elif config == "__is_unconditional__":
|
35 |
+
return None
|
36 |
+
raise KeyError("Expected key `target` to instantiate.")
|
37 |
+
return get_obj_from_str(config["target"])(**config.get("params", dict()))
|
38 |
|
39 |
def make_beta_schedule(schedule, n_timestep, linear_start=1e-4, linear_end=2e-2, cosine_s=8e-3):
|
40 |
if schedule == "linear":
|