multimodalart HF Staff commited on
Commit
af88b54
·
verified ·
1 Parent(s): 2f2192c

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -88,9 +88,11 @@ async def set_collider(request: Request):
88
  prev = read_slot(sid) or {}
89
  write_slot(sid, {
90
  "style_tokens": tokens,
91
- "temperature": float(body.get("temperature", 1.3)),
92
- "top_k": int(body.get("top_k", 40)),
93
- "cfg_musiccoca": float(body.get("cfg", 3.0)),
 
 
94
  "model": body.get("model", prev.get("model", "mrt2_base")),
95
  "buffer": int(body.get("buffer", 0)),
96
  })
@@ -137,7 +139,8 @@ def stream(session_id: str) -> str:
137
  aset = set(active)
138
  notes = [8 if i in aset else -1 for i in range(128)]
139
  cfgs = [discretize_cfg(c.get("cfg_musiccoca", 3.0), 0.2, 40),
140
- discretize_cfg(c.get("cfg_notes", 2.4), 0.2, 40), discretize_cfg(1.0, 1.0, 8)]
 
141
  cond = model._conditioning((list(tokens) + [-1] * model.num_musiccoca)[:model.num_musiccoca],
142
  notes, drums, cfgs)
143
  source = model.model.encode(cond).to(dt)
 
88
  prev = read_slot(sid) or {}
89
  write_slot(sid, {
90
  "style_tokens": tokens,
91
+ "temperature": float(body.get("temperature", 1.1)),
92
+ "top_k": int(body.get("top_k", 50)),
93
+ "cfg_musiccoca": float(body.get("cfg", 1.6)),
94
+ "cfg_notes": float(body.get("cfg_notes", 2.4)),
95
+ "cfg_drums": float(body.get("cfg_drums", 4.0)),
96
  "model": body.get("model", prev.get("model", "mrt2_base")),
97
  "buffer": int(body.get("buffer", 0)),
98
  })
 
139
  aset = set(active)
140
  notes = [8 if i in aset else -1 for i in range(128)]
141
  cfgs = [discretize_cfg(c.get("cfg_musiccoca", 3.0), 0.2, 40),
142
+ discretize_cfg(c.get("cfg_notes", 2.4), 0.2, 40),
143
+ discretize_cfg(c.get("cfg_drums", 4.0), 1.0, 8)]
144
  cond = model._conditioning((list(tokens) + [-1] * model.num_musiccoca)[:model.num_musiccoca],
145
  notes, drums, cfgs)
146
  source = model.model.encode(cond).to(dt)