Spaces:
Running
Running
admin
commited on
Commit
Β·
eb1965e
1
Parent(s):
40fefc5
add ms link
Browse files
app.py
CHANGED
@@ -55,7 +55,8 @@ def get_args(parser: argparse.ArgumentParser):
|
|
55 |
default=1.2,
|
56 |
help="the temperature of the sampling operation",
|
57 |
)
|
58 |
-
parser.add_argument("-seed", type=int, default=None,
|
|
|
59 |
parser.add_argument(
|
60 |
"-show_control_code",
|
61 |
type=bool,
|
@@ -149,9 +150,10 @@ def generate_music(
|
|
149 |
|
150 |
else:
|
151 |
prefix = patchilizer.decode(input_patches[0])
|
152 |
-
remaining_tokens = prompt[len(prefix)
|
153 |
tokens = torch.tensor(
|
154 |
-
[patchilizer.bos_token_id] +
|
|
|
155 |
device=DEVICE,
|
156 |
)
|
157 |
|
@@ -222,7 +224,8 @@ def generate_music(
|
|
222 |
tunes = tunes.replace(f"\nK:{K_val}\n", f"\nK:{K_val.split('m')[0]}\n")
|
223 |
|
224 |
elif (mode == "minor") and (not "m" in K_val):
|
225 |
-
tunes = tunes.replace(
|
|
|
226 |
|
227 |
print("Generation time: {:.2f} seconds".format(time.time() - start_time))
|
228 |
timestamp = time.strftime("%a_%d_%b_%Y_%H_%M_%S", time.localtime())
|
@@ -398,6 +401,8 @@ if __name__ == "__main__":
|
|
398 |
shutil.rmtree("./flagged")
|
399 |
|
400 |
with gr.Blocks() as demo:
|
|
|
|
|
401 |
with gr.Row():
|
402 |
with gr.Column():
|
403 |
dataset_option = gr.Dropdown(
|
|
|
55 |
default=1.2,
|
56 |
help="the temperature of the sampling operation",
|
57 |
)
|
58 |
+
parser.add_argument("-seed", type=int, default=None,
|
59 |
+
help="seed for randomstate")
|
60 |
parser.add_argument(
|
61 |
"-show_control_code",
|
62 |
type=bool,
|
|
|
150 |
|
151 |
else:
|
152 |
prefix = patchilizer.decode(input_patches[0])
|
153 |
+
remaining_tokens = prompt[len(prefix):]
|
154 |
tokens = torch.tensor(
|
155 |
+
[patchilizer.bos_token_id] +
|
156 |
+
[ord(c) for c in remaining_tokens],
|
157 |
device=DEVICE,
|
158 |
)
|
159 |
|
|
|
224 |
tunes = tunes.replace(f"\nK:{K_val}\n", f"\nK:{K_val.split('m')[0]}\n")
|
225 |
|
226 |
elif (mode == "minor") and (not "m" in K_val):
|
227 |
+
tunes = tunes.replace(
|
228 |
+
f"\nK:{K_val}\n", f"\nK:{K_val.replace('dor', '')}min\n")
|
229 |
|
230 |
print("Generation time: {:.2f} seconds".format(time.time() - start_time))
|
231 |
timestamp = time.strftime("%a_%d_%b_%Y_%H_%M_%S", time.localtime())
|
|
|
401 |
shutil.rmtree("./flagged")
|
402 |
|
403 |
with gr.Blocks() as demo:
|
404 |
+
gr.Markdown(
|
405 |
+
"## The current CPU-based version on HuggingFace has slow inference, you can access the GPU-based mirror on [ModelScope](https://www.modelscope.cn/studios/monetjoe/EMusicGen)")
|
406 |
with gr.Row():
|
407 |
with gr.Column():
|
408 |
dataset_option = gr.Dropdown(
|