Comments (7)
I got remi files(0.txt and 1.txt) Then how to get midi file to remi files??
I have the same problem that it only generates remi files. The solution is to fix bugs in 2-attribute2music_model/midiprocessor/enc_remigen2_utils.py
change miditoolkit.containers
to miditoolkit.midi.containers
after that, you can run the scripts below to generate midi files
import os
from midiprocessor import MidiDecoder, MidiEncoder
date = "0117"
midi_root = f"./generation/{date}/linear_mask-1billion-attribute2music/infer_test/topk15-t1.0-ngram0"
midi_decoder = MidiDecoder("REMIGEN2")
print(midi_decoder)
midi_list = []
error_midi_list = []
for folder_name in os.listdir(midi_root):
folder_dir = os.path.join(midi_root, folder_name)
# not folder, Using_pred_labels.txt etc
if os.path.isfile(folder_dir):
continue
# remi_name: 0.txt, 1.txt...
remi_dir = os.path.join(folder_dir, 'remi')
midi_dir = os.path.join(folder_dir, 'midi')
for remi_name in os.listdir(remi_dir):
with open(os.path.join(remi_dir, remi_name), 'r') as f:
hypo_str = f.read()
# since the seq looks like this: prefix <seq> remi
# we have to get the remi tokens by discard the prefix tokens and <seq>
# orginal:
# remi_token = hypo_str.split(" ")[sep_pos[id_] + 1:]
remi_token = hypo_str.split(" <sep> ")[1].split(" ")
os.makedirs(midi_dir, exist_ok=True)
midi_save_path = os.path.join(midi_dir, remi_name.replace('.txt', '.mid'))
midi_list.append(midi_save_path)
try:
midi_obj = midi_decoder.decode_from_token_str_list(remi_token)
midi_obj.dump(midi_save_path)
except:
error_midi_list.append(midi_save_path)
print(len(midi_list))
print(len(error_midi_list))
I also got the assertion error as @cpadilha did. 39/560 midi files have that problem.
from muzic.
Same issue. Did you manage to find a solution?
from muzic.
I got remi files(0.txt and 1.txt) Then how to get midi file to remi files??
from muzic.
@feiyuehchen Thank you so much. This works well
from muzic.
@feiyuehchen Sir, I wonder one more thing.
What should I do to use the text I want as an input?
from muzic.
@Subin-Kim46 you could print hypo_str
to know more
prefix_input = hypo_str.split(" <sep> ")[0].split(" ")
from muzic.
@feiyuehchen Thank you so much
from muzic.
Related Issues (20)
- [MusicAgent] The dependent libraries are confilcts.
- ckpt not found in checkpoints/0102_xiaoma_pe HOT 2
- 【MusicBERT】ValueError: loaded state dict contains a parameter group that doesn't match the size of optimizer's group HOT 2
- 【MusicAgent】Database has not enough pieces to support ROC. HOT 5
- 【MUSICBERT】 ModuleNotFoundError
- [Telemelody] Pipeline of Collecting Lyric-Rhythm Data
- 【Musecoco CausalDotProduct.dot none type】 HOT 1
- [Musecoco] how to change input text?
- 【roc】What do the parameters represent?
- [songmass] SongMASS Melody infer error HOT 2
- Getmusic GPU memory requirements and CPU usage
- [MuseCoco] Checpoint for Text2attribute:model HOT 1
- [MuseCoco] Request for Checkpoint of the "large" model
- [clamp] size mismatch for text_enc.embeddings
- [clamp] The cmd command is only applicable to Windows
- [clamp] What prompt was used when evaluating CLaMP in the zero-shot setting on the VGMIDI dataset for emotion?
- [MUSECOCO] Cannot load file checkpoint
- [Telemelody] Are there some ways to generate corresponding chords for a given lyric? Since in this way, I can only input the chord and get an output lyric
- [Museformer] Can I get detailed package version requirements for museformer?
- [Museformer] 'params.dataset.dataset_impl' not found when executing mf-lmd6remi-1.sh
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from muzic.