Spaces:
Sleeping
Sleeping
Hal Swift commited on
Commit ·
217cd93
1
Parent(s): 63ebf21
Deploy v1.39
Browse files- Dockerfile +4 -4
- app.py +27 -24
Dockerfile
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
-
# [Forge Log #
|
| 2 |
-
#
|
| 3 |
-
ARG CACHE_BUSTER=
|
| 4 |
|
| 5 |
FROM python:3.8-slim-bullseye
|
| 6 |
|
|
@@ -26,7 +26,7 @@ RUN mkdir /models /models_tmp && \
|
|
| 26 |
rm /models/model.zip
|
| 27 |
|
| 28 |
RUN pip install --no-cache-dir --upgrade pip setuptools wheel && \
|
| 29 |
-
pip install --no-cache-dir numpy<1.24 scipy h5py resampy==0.2.2 && \
|
| 30 |
pip install --no-cache-dir --no-deps crepe==0.0.16
|
| 31 |
|
| 32 |
COPY requirements.txt requirements.txt
|
|
|
|
| 1 |
+
# [Forge Log #78] Build v1.39 - Fix Shell Syntax
|
| 2 |
+
# Quoting version constraints to prevent shell redirection errors.
|
| 3 |
+
ARG CACHE_BUSTER=20251219183000
|
| 4 |
|
| 5 |
FROM python:3.8-slim-bullseye
|
| 6 |
|
|
|
|
| 26 |
rm /models/model.zip
|
| 27 |
|
| 28 |
RUN pip install --no-cache-dir --upgrade pip setuptools wheel && \
|
| 29 |
+
pip install --no-cache-dir "numpy<1.24" scipy h5py resampy==0.2.2 && \
|
| 30 |
pip install --no-cache-dir --no-deps crepe==0.0.16
|
| 31 |
|
| 32 |
COPY requirements.txt requirements.txt
|
app.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
-
# [Forge Log #
|
| 2 |
-
# 'Vanguard
|
| 3 |
-
#
|
| 4 |
-
print("--- [CANARY] DecentSampler DDSP Server v1.
|
| 5 |
print("--- [CANARY] Executing Verified Production App ---")
|
| 6 |
|
| 7 |
import os
|
|
@@ -34,17 +34,17 @@ import io
|
|
| 34 |
def find_tae():
|
| 35 |
try:
|
| 36 |
import ddsp.training.models.midi_autoencoder as ma
|
| 37 |
-
return ma.MidiAutoencoder
|
| 38 |
except: pass
|
| 39 |
try:
|
| 40 |
import ddsp.training.models as m
|
| 41 |
-
return m.TranscribingAutoencoder
|
| 42 |
except: pass
|
| 43 |
return None
|
| 44 |
|
| 45 |
TAE_CLASS = find_tae()
|
| 46 |
|
| 47 |
-
# --- Deep-
|
| 48 |
def find_note_synth():
|
| 49 |
target = 'note_expression_synthesis'
|
| 50 |
try:
|
|
@@ -53,8 +53,8 @@ def find_note_synth():
|
|
| 53 |
return lambda model, pitches, note_lengths, **kwargs: getattr(ma, target)(model, pitches, note_lengths, **kwargs)
|
| 54 |
except: pass
|
| 55 |
|
| 56 |
-
def
|
| 57 |
-
"""
|
| 58 |
p_tensor = tf.convert_to_tensor(pitches, dtype=tf.float32)
|
| 59 |
l_tensor = tf.convert_to_tensor(note_lengths, dtype=tf.float32)
|
| 60 |
midi_dicts = [
|
|
@@ -62,16 +62,19 @@ def find_note_synth():
|
|
| 62 |
{'midi': {'pitch': p_tensor, 'duration': l_tensor}},
|
| 63 |
{'inputs': {'pitch': p_tensor, 'duration': l_tensor}}
|
| 64 |
]
|
| 65 |
-
methods_to_try = ['
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
|
|
|
|
|
|
|
|
|
| 75 |
for name in methods_to_try:
|
| 76 |
method = getattr(obj, name, None)
|
| 77 |
if method and callable(method):
|
|
@@ -88,7 +91,7 @@ def find_note_synth():
|
|
| 88 |
for m_dict in midi_dicts:
|
| 89 |
try: return model(m_dict, training=False)
|
| 90 |
except: pass
|
| 91 |
-
for obj in
|
| 92 |
for attr_name in dir(obj):
|
| 93 |
if attr_name.startswith('_'): continue
|
| 94 |
attr = getattr(obj, attr_name)
|
|
@@ -96,9 +99,9 @@ def find_note_synth():
|
|
| 96 |
for m_dict in midi_dicts:
|
| 97 |
try: return attr(m_dict)
|
| 98 |
except: pass
|
| 99 |
-
raise AttributeError(f"Vanguard
|
| 100 |
|
| 101 |
-
return
|
| 102 |
|
| 103 |
NOTE_SYNTH_FN = find_note_synth()
|
| 104 |
|
|
@@ -140,7 +143,7 @@ def note_to_midi(note_name: str) -> float:
|
|
| 140 |
|
| 141 |
@app.get("/")
|
| 142 |
def read_root():
|
| 143 |
-
return {"message": "DDSP Server Online", "canary": "v1.
|
| 144 |
|
| 145 |
@app.post("/generate-note")
|
| 146 |
async def generate_note(request: NoteRequest):
|
|
@@ -158,4 +161,4 @@ async def generate_note(request: NoteRequest):
|
|
| 158 |
wav_io.seek(0)
|
| 159 |
return Response(content=wav_io.getvalue(), media_type="audio/wav")
|
| 160 |
except Exception as e:
|
| 161 |
-
raise HTTPException(status_code=500, detail=f"[Vanguard V1.
|
|
|
|
| 1 |
+
# [Forge Log #78] The Canary Banner v1.39
|
| 2 |
+
# 'Vanguard Mu' Protocol - Deep-Dive Synthesis Discovery.
|
| 3 |
+
# Prioritizes explicit paths found in common DDSP 1.6.5 Gin exports.
|
| 4 |
+
print("--- [CANARY] DecentSampler DDSP Server v1.39 ---")
|
| 5 |
print("--- [CANARY] Executing Verified Production App ---")
|
| 6 |
|
| 7 |
import os
|
|
|
|
| 34 |
def find_tae():
|
| 35 |
try:
|
| 36 |
import ddsp.training.models.midi_autoencoder as ma
|
| 37 |
+
if hasattr(ma, 'MidiAutoencoder'): return ma.MidiAutoencoder
|
| 38 |
except: pass
|
| 39 |
try:
|
| 40 |
import ddsp.training.models as m
|
| 41 |
+
if hasattr(m, 'TranscribingAutoencoder'): return m.TranscribingAutoencoder
|
| 42 |
except: pass
|
| 43 |
return None
|
| 44 |
|
| 45 |
TAE_CLASS = find_tae()
|
| 46 |
|
| 47 |
+
# --- Deep-Dive Synth 'Vanguard' Ladder [Forge Log #78] ---
|
| 48 |
def find_note_synth():
|
| 49 |
target = 'note_expression_synthesis'
|
| 50 |
try:
|
|
|
|
| 53 |
return lambda model, pitches, note_lengths, **kwargs: getattr(ma, target)(model, pitches, note_lengths, **kwargs)
|
| 54 |
except: pass
|
| 55 |
|
| 56 |
+
def deep_dive_synth_wrapper(model, pitches, note_lengths, **kwargs):
|
| 57 |
+
"""Mu Protocol: Explicit proxy mapping and atomic probing."""
|
| 58 |
p_tensor = tf.convert_to_tensor(pitches, dtype=tf.float32)
|
| 59 |
l_tensor = tf.convert_to_tensor(note_lengths, dtype=tf.float32)
|
| 60 |
midi_dicts = [
|
|
|
|
| 62 |
{'midi': {'pitch': p_tensor, 'duration': l_tensor}},
|
| 63 |
{'inputs': {'pitch': p_tensor, 'duration': l_tensor}}
|
| 64 |
]
|
| 65 |
+
methods_to_try = ['decode', 'midi_to_audio', 'synthesize', 'synthesize_audio', 'call', '__call__', 'predict']
|
| 66 |
+
probe_queue = []
|
| 67 |
+
if model:
|
| 68 |
+
probe_queue.append(model)
|
| 69 |
+
for path in ['ae.decoder', 'processor_group', 'ae', 'nn', 'decoder', 'processor']:
|
| 70 |
+
try:
|
| 71 |
+
obj = model
|
| 72 |
+
for part in path.split('.'):
|
| 73 |
+
obj = getattr(obj, part)
|
| 74 |
+
probe_queue.append(obj)
|
| 75 |
+
except AttributeError: pass
|
| 76 |
+
|
| 77 |
+
for obj in probe_queue:
|
| 78 |
for name in methods_to_try:
|
| 79 |
method = getattr(obj, name, None)
|
| 80 |
if method and callable(method):
|
|
|
|
| 91 |
for m_dict in midi_dicts:
|
| 92 |
try: return model(m_dict, training=False)
|
| 93 |
except: pass
|
| 94 |
+
for obj in probe_queue:
|
| 95 |
for attr_name in dir(obj):
|
| 96 |
if attr_name.startswith('_'): continue
|
| 97 |
attr = getattr(obj, attr_name)
|
|
|
|
| 99 |
for m_dict in midi_dicts:
|
| 100 |
try: return attr(m_dict)
|
| 101 |
except: pass
|
| 102 |
+
raise AttributeError(f"Vanguard Mu Failure: Exhausted all synthesis paths.")
|
| 103 |
|
| 104 |
+
return deep_dive_synth_wrapper
|
| 105 |
|
| 106 |
NOTE_SYNTH_FN = find_note_synth()
|
| 107 |
|
|
|
|
| 143 |
|
| 144 |
@app.get("/")
|
| 145 |
def read_root():
|
| 146 |
+
return {"message": "DDSP Server Online", "canary": "v1.39"}
|
| 147 |
|
| 148 |
@app.post("/generate-note")
|
| 149 |
async def generate_note(request: NoteRequest):
|
|
|
|
| 161 |
wav_io.seek(0)
|
| 162 |
return Response(content=wav_io.getvalue(), media_type="audio/wav")
|
| 163 |
except Exception as e:
|
| 164 |
+
raise HTTPException(status_code=500, detail=f"[Vanguard V1.39] {str(e)}")
|