AbstractPhil commited on
Commit
7229198
Β·
1 Parent(s): 620a643
__pycache__/configs.cpython-310.pyc CHANGED
Binary files a/__pycache__/configs.cpython-310.pyc and b/__pycache__/configs.cpython-310.pyc differ
 
__pycache__/two_stream_shunt_adapter.cpython-310.pyc CHANGED
Binary files a/__pycache__/two_stream_shunt_adapter.cpython-310.pyc and b/__pycache__/two_stream_shunt_adapter.cpython-310.pyc differ
 
app.py CHANGED
@@ -31,12 +31,22 @@ config_l = T5_SHUNT_REPOS["clip_l"]["config"]
31
  config_g = T5_SHUNT_REPOS["clip_g"]["config"]
32
 
33
  # ─── Loader ───────────────────────────────────────────────────
 
 
34
  def load_adapter(repo, filename, config):
35
  path = hf_hub_download(repo_id=repo, filename=filename)
36
- model = TwoStreamShuntAdapter(config).to(device).eval()
37
- model.load_state_dict(load_file(path, device=device))
 
 
 
 
 
 
 
38
  return model
39
 
 
40
  # ─── Visualization ────────────────────────────────────────────
41
  def plot_heat(mat, title):
42
  import io
 
31
  config_g = T5_SHUNT_REPOS["clip_g"]["config"]
32
 
33
  # ─── Loader ───────────────────────────────────────────────────
34
+ from safetensors.torch import safe_open
35
+
36
  def load_adapter(repo, filename, config):
37
  path = hf_hub_download(repo_id=repo, filename=filename)
38
+
39
+ # Fallback-safe loading for ZeroGPU
40
+ model = TwoStreamShuntAdapter(config).eval()
41
+ tensors = {}
42
+ with safe_open(path, framework="pt", device="cpu") as f:
43
+ for key in f.keys():
44
+ tensors[key] = f.get_tensor(key)
45
+ model.load_state_dict(tensors)
46
+ model.to(device)
47
  return model
48
 
49
+
50
  # ─── Visualization ────────────────────────────────────────────
51
  def plot_heat(mat, title):
52
  import io