Spaces:
Runtime error
Runtime error
matthew null
commited on
Commit
·
52fedb9
0
Parent(s):
Duplicate from breadlicker45/Muse-gen
Browse files- .gitattributes +27 -0
- README.md +13 -0
- app.py +69 -0
- requirements.txt +3 -0
.gitattributes
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
5 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
6 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
7 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
8 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
9 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
10 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
11 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
12 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
13 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
14 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
15 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
16 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
17 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
18 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
19 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
20 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
21 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
22 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
23 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
24 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
25 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
26 |
+
*.zstandard filter=lfs diff=lfs merge=lfs -text
|
27 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
title: Muse text gen
|
3 |
+
emoji: ⚡
|
4 |
+
colorFrom: blue
|
5 |
+
colorTo: white
|
6 |
+
sdk: streamlit
|
7 |
+
sdk_version: 1.9.0
|
8 |
+
app_file: app.py
|
9 |
+
pinned: true
|
10 |
+
duplicated_from: breadlicker45/Muse-gen
|
11 |
+
---
|
12 |
+
|
13 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces#reference
|
app.py
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import time
|
3 |
+
from transformers import pipeline
|
4 |
+
import torch
|
5 |
+
trust_remote_code=True
|
6 |
+
st.markdown('## Text-generation gpt Muse from Breadlicker45')
|
7 |
+
use_auth_token=True
|
8 |
+
@st.cache(allow_output_mutation=True, suppress_st_warning =True, show_spinner=False)
|
9 |
+
def get_model():
|
10 |
+
return pipeline('text-generation', model=model, do_sample=True)
|
11 |
+
|
12 |
+
col1, col2 = st.columns([2,1])
|
13 |
+
|
14 |
+
with st.sidebar:
|
15 |
+
st.markdown('## Model Parameters')
|
16 |
+
|
17 |
+
max_length = st.slider('Max text length', 80, 2000, 80)
|
18 |
+
|
19 |
+
min_length = st.slider('Min text length', 80, 500, 80)
|
20 |
+
|
21 |
+
num_beams = st.slider('N° tree beams search', 1, 15, 1)
|
22 |
+
|
23 |
+
temperature = st.slider('temperature', 0.0, 1.0, 0.5, 0.1)
|
24 |
+
|
25 |
+
early_stopping = st.selectbox(
|
26 |
+
'Early stopping text generation',
|
27 |
+
('True', 'False'), key={'True' : True, 'False': False}, index=0)
|
28 |
+
|
29 |
+
no_ngram_repeat = st.slider('Max repetition limit', 1, 3, 1)
|
30 |
+
|
31 |
+
st.markdown('## how to convert it into midi. go to this site https://mrcheeze.github.io/musenet-midi/ and then paste the numbers/musenet encoders you get from the ai into the big box and then click export midi')
|
32 |
+
|
33 |
+
|
34 |
+
with col1:
|
35 |
+
prompt= st.text_area('Your prompt here',
|
36 |
+
'''2623 2619 3970 3976 2607 3973 2735 3973 2598 3985 2726 3973 2607 4009 2735 3973 2598 3973 2726 3973 2607 3973 2735 4009''')
|
37 |
+
|
38 |
+
with col2:
|
39 |
+
select_model = st.radio(
|
40 |
+
"Select the model to use:",
|
41 |
+
('MuseWeb', 'MusePy', 'MuseNeo', 'MusePy-1-1', 'MuseCan'), index = 4)
|
42 |
+
|
43 |
+
if select_model == 'MuseWeb':
|
44 |
+
model = 'breadlicker45/museweb'
|
45 |
+
elif select_model == 'MusePy':
|
46 |
+
model = 'breadlicker45/MusePy'
|
47 |
+
elif select_model == 'MuseNeo':
|
48 |
+
model = 'breadlicker45/MuseNeo'
|
49 |
+
elif select_model == 'MusePy-1-1':
|
50 |
+
model = 'BreadAi/MusePy-1-1'
|
51 |
+
elif select_model == 'MuseCan':
|
52 |
+
model = 'BreadAi/MuseCan'
|
53 |
+
|
54 |
+
with st.spinner('Loading Model... (This may take a while)'):
|
55 |
+
generator = get_model()
|
56 |
+
st.success('Model loaded correctly!')
|
57 |
+
|
58 |
+
gen = st.info('Generating text...')
|
59 |
+
answer = generator(prompt,
|
60 |
+
max_length=max_length, no_repeat_ngram_size=no_ngram_repeat,
|
61 |
+
early_stopping=early_stopping, num_beams=num_beams, min_length=min_length, temperature=temperature)
|
62 |
+
gen.empty()
|
63 |
+
|
64 |
+
lst = answer[0]['generated_text']
|
65 |
+
|
66 |
+
t = st.empty()
|
67 |
+
for i in range(len(lst)):
|
68 |
+
t.markdown("#### %s" % lst[0:i])
|
69 |
+
time.sleep(0.04)
|
requirements.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
streamlit
|
2 |
+
transformers
|
3 |
+
torch
|