Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -199,7 +199,6 @@ def compose_language_descriptions(prompt):
|
|
199 |
return out_img
|
200 |
|
201 |
# create model for CLEVR Objects
|
202 |
-
timestep_respacing = 100
|
203 |
clevr_options = model_and_diffusion_defaults_for_clevr()
|
204 |
|
205 |
flags = {
|
@@ -215,7 +214,7 @@ flags = {
|
|
215 |
"num_classes": '2',
|
216 |
"dataset": "clevr_pos",
|
217 |
"use_fp16": has_cuda,
|
218 |
-
"timestep_respacing":
|
219 |
}
|
220 |
|
221 |
for key, val in flags.items():
|
@@ -228,6 +227,7 @@ if has_cuda:
|
|
228 |
|
229 |
clevr_model.to(device)
|
230 |
clevr_model.load_state_dict(th.load(download_model('clevr_pos'), device))
|
|
|
231 |
|
232 |
def compose_clevr_objects(prompt):
|
233 |
print(prompt)
|
@@ -248,14 +248,13 @@ def compose_clevr_objects(prompt):
|
|
248 |
half_eps = uncond_eps + guidance_scale * (cond_eps - uncond_eps)
|
249 |
eps = th.cat([half_eps] * x_t.size(0), dim=0)
|
250 |
return th.cat([eps, rest], dim=1)
|
251 |
-
|
252 |
-
masks = [True] * (len(coordinates) - 1) + [False]
|
253 |
-
model_kwargs = dict(
|
254 |
-
y=th.tensor(coordinates, dtype=th.float, device=device),
|
255 |
-
masks=th.tensor(masks, dtype=th.bool, device=device)
|
256 |
-
)
|
257 |
|
258 |
def sample(coordinates):
|
|
|
|
|
|
|
|
|
|
|
259 |
samples = clevr_diffusion.p_sample_loop(
|
260 |
model_fn,
|
261 |
(len(coordinates), 3, options["image_size"], options["image_size"]),
|
|
|
199 |
return out_img
|
200 |
|
201 |
# create model for CLEVR Objects
|
|
|
202 |
clevr_options = model_and_diffusion_defaults_for_clevr()
|
203 |
|
204 |
flags = {
|
|
|
214 |
"num_classes": '2',
|
215 |
"dataset": "clevr_pos",
|
216 |
"use_fp16": has_cuda,
|
217 |
+
"timestep_respacing": '100'
|
218 |
}
|
219 |
|
220 |
for key, val in flags.items():
|
|
|
227 |
|
228 |
clevr_model.to(device)
|
229 |
clevr_model.load_state_dict(th.load(download_model('clevr_pos'), device))
|
230 |
+
print('total clevr_pos parameters', sum(x.numel() for x in clevr_model.parameters()))
|
231 |
|
232 |
def compose_clevr_objects(prompt):
|
233 |
print(prompt)
|
|
|
248 |
half_eps = uncond_eps + guidance_scale * (cond_eps - uncond_eps)
|
249 |
eps = th.cat([half_eps] * x_t.size(0), dim=0)
|
250 |
return th.cat([eps, rest], dim=1)
|
|
|
|
|
|
|
|
|
|
|
|
|
251 |
|
252 |
def sample(coordinates):
|
253 |
+
masks = [True] * (len(coordinates) - 1) + [False]
|
254 |
+
model_kwargs = dict(
|
255 |
+
y=th.tensor(coordinates, dtype=th.float, device=device),
|
256 |
+
masks=th.tensor(masks, dtype=th.bool, device=device)
|
257 |
+
)
|
258 |
samples = clevr_diffusion.p_sample_loop(
|
259 |
model_fn,
|
260 |
(len(coordinates), 3, options["image_size"], options["image_size"]),
|