Commit
·
81a86be
1
Parent(s):
5b66613
Update app.py
Browse files
app.py
CHANGED
@@ -20,7 +20,7 @@ def song_generator(input_prompt):
|
|
20 |
# set pad_token_id to eos_token_id because OPT does not have a PAD token
|
21 |
model.config.pad_token_id = model.config.eos_token_id
|
22 |
input_ids = tokenizer(input_prompt, return_tensors="pt")
|
23 |
-
stopping_criteria = StoppingCriteriaList([MaxLengthCriteria(max_length=
|
24 |
outputs = model.contrastive_search(
|
25 |
**input_ids, penalty_alpha=0.6, top_k=15, stopping_criteria=stopping_criteria, pad_token_id=tokenizer.eos_token_id,
|
26 |
)
|
@@ -35,7 +35,7 @@ submit = st.button('Generate')
|
|
35 |
input_song = query
|
36 |
|
37 |
if submit:
|
38 |
-
st.subheader('Song generated')
|
39 |
|
40 |
with st.spinner(text='This may take a moment...'):
|
41 |
output_sentence = song_generator(input_song)
|
|
|
20 |
# set pad_token_id to eos_token_id because OPT does not have a PAD token
|
21 |
model.config.pad_token_id = model.config.eos_token_id
|
22 |
input_ids = tokenizer(input_prompt, return_tensors="pt")
|
23 |
+
stopping_criteria = StoppingCriteriaList([MaxLengthCriteria(max_length=30)])
|
24 |
outputs = model.contrastive_search(
|
25 |
**input_ids, penalty_alpha=0.6, top_k=15, stopping_criteria=stopping_criteria, pad_token_id=tokenizer.eos_token_id,
|
26 |
)
|
|
|
35 |
input_song = query
|
36 |
|
37 |
if submit:
|
38 |
+
st.subheader('Song generated is ')
|
39 |
|
40 |
with st.spinner(text='This may take a moment...'):
|
41 |
output_sentence = song_generator(input_song)
|