Skip to content

Commit

Permalink
upd emopia dataset
Browse files Browse the repository at this point in the history
  • Loading branch information
monetjoe committed May 25, 2024
1 parent cbca095 commit 16862a9
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
# emo-abc-gen
Emotionally Conditioned Music Generation in ABC Notation with Chord

## Maintenance
```bash
git clone git@gitee.com:MuGeminorum/emo-abc-gen.git
cd emo-abc-gen
```
2 changes: 1 addition & 1 deletion prompt.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
A:Mondstadt
A:Q1
S:2
B:9
E:4
Expand Down
22 changes: 15 additions & 7 deletions train.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,17 +141,25 @@ def eval_epoch(model): # do one epoch for eval

if __name__ == "__main__":
# load data
ds = MsDataset.load("monetjoe/EMOPIA_abc", subset_name="default", split="train")
emopia = []
for item in ds:
emopia.append(
trainset = MsDataset.load("monetjoe/EMOPIA_abc", split="train")
evalset = MsDataset.load("monetjoe/EMOPIA_abc", split="test")
train_set, eval_set = [], []
for song in trainset:
train_set.append(
{
"control code": "A:" + item["label"] + "\n" + item["prompt"],
"abc notation": item["data"],
"control code": "A:" + song["label"] + "\n" + song["prompt"],
"abc notation": song["data"],
}
)

for song in evalset:
eval_set.append(
{
"control code": "A:" + song["label"] + "\n" + song["prompt"],
"abc notation": song["data"],
}
)

train_set, eval_set = split_data(emopia)
batch_size, patchilizer, model, scaler, is_autocast, optimizer = init()

train_set = DataLoader(
Expand Down

0 comments on commit 16862a9

Please sign in to comment.