Skip to content

Commit cac619f

Browse files
committed
fix bug
1 parent 2678708 commit cac619f

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

Diff for: NotaGenNode.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,11 @@ def inference_patch(self, model, period, composer, instrumentation,
120120
nota_model_path = os.path.join(self.nota_model_path, model)
121121
if self.model_cache is None:
122122
checkpoint = torch.load(nota_model_path, map_location=torch.device(self.device))
123-
self.model_cache = checkpoint
124-
else:
125-
checkpoint = self.model_cache
126-
nota_model.load_state_dict(checkpoint['model'])
123+
NotaGenRun.model_cache = checkpoint
124+
del checkpoint
125+
torch.cuda.empty_cache()
126+
127+
nota_model.load_state_dict(self.model_cache['model'])
127128
nota_model = nota_model.to(self.device)
128129
nota_model.eval()
129130

@@ -338,9 +339,8 @@ def inference_patch(self, model, period, composer, instrumentation,
338339
if unload_model:
339340
del patchilizer
340341
del nota_model
341-
del checkpoint
342+
NotaGenRun.model_cache = None
342343
torch.cuda.empty_cache()
343-
self.model_cache = None
344344

345345
return (
346346
audio,
@@ -352,9 +352,9 @@ def inference_patch(self, model, period, composer, instrumentation,
352352
if unload_model:
353353
del patchilizer
354354
del nota_model
355-
del checkpoint
355+
NotaGenRun.model_cache = None
356356
torch.cuda.empty_cache()
357-
self.model_cache = None
357+
358358
print(f".abc and .xml was saved to {INTERLEAVED_OUTPUT_FOLDER} and {ORIGINAL_OUTPUT_FOLDER}")
359359
raise Exception("Conversion of .mp3 and .png failed, try again or check if MuseScore4 installation was successful.")
360360

Diff for: pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[project]
22
name = "notagen-mw"
33
description = "Symbolic Music Generation, NotaGen node for ComfyUI."
4-
version = "2.2.2"
4+
version = "2.2.3"
55
license = {file = "LICENSE"}
66

77
[project.urls]

0 commit comments

Comments
 (0)