VirusDumb commited on
Commit
cc845ea
·
1 Parent(s): 62f7536

GPU hack fixes image res

Browse files
Files changed (1) hide show
  1. images.py +6 -2
images.py CHANGED
@@ -7,13 +7,17 @@ One model, one `image=` parameter does both jobs:
7
  Shared art_style + a fixed per-adventure seed give every quest a cohesive look. Always EDIT
8
  the initial image for success/failure states (consistency) - never text-to-image from scratch.
9
 
10
- Pipeline loaded at module level; CUDA emulation makes that safe outside @spaces.GPU. The
11
- actual .to("cuda") + inference happen inside the GPU-decorated functions.
 
 
 
12
  """
13
  from __future__ import annotations
14
 
15
  import base64
16
  import io
 
17
 
18
  import spaces
19
  import torch
 
7
  Shared art_style + a fixed per-adventure seed give every quest a cohesive look. Always EDIT
8
  the initial image for success/failure states (consistency) - never text-to-image from scratch.
9
 
10
+ Loading happens at MODULE LEVEL (startup), incl. `.to("cuda")`. Outside @spaces.GPU, ZeroGPU
11
+ runs a CUDA-emulation mode, so the placement is recorded now and realized on the real GPU when
12
+ it attaches per call. This keeps the ~13GB load OFF the metered GPU clock (the @spaces.GPU call
13
+ only pays for inference) and is the pattern HF recommends — lazy-loading inside the call is
14
+ "significantly less efficient" (and made every generation slow).
15
  """
16
  from __future__ import annotations
17
 
18
  import base64
19
  import io
20
+ import os
21
 
22
  import spaces
23
  import torch