Skip to content

Commit

Permalink
MBD kept loading on each generation (#184)
Browse files Browse the repository at this point in the history
  • Loading branch information
GrandaddyShmax authored Aug 7, 2023
1 parent 1048255 commit f1ee52f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions demos/musicgen_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
MAX_BATCH_SIZE = 12
BATCHED_DURATION = 15
INTERRUPTING = False
MBD = None
# We have to wrap subprocess call to clean a bit the log when using gr.make_waveform
_old_call = sp.call

Expand Down Expand Up @@ -95,8 +96,9 @@ def load_model(version='facebook/musicgen-melody'):

def load_diffusion():
global MBD
print("loading MBD")
MBD = MultiBandDiffusion.get_mbd_musicgen()
if MBD is None:
print("loading MBD")
MBD = MultiBandDiffusion.get_mbd_musicgen()


def _do_predictions(texts, melodies, duration, progress=False, **gen_kwargs):
Expand Down

0 comments on commit f1ee52f

Please sign in to comment.