TomRB22 commited on
Commit
40ba3da
1 Parent(s): 0daad5a

Starting adding documentation to the README file

Browse files
Files changed (1) hide show
  1. README.md +25 -155
README.md CHANGED
@@ -20,7 +20,7 @@ By the use of the aforementioned autoencoder, it allows the user to encode piano
20
  ### Model Description
21
 
22
  <figure>
23
- <img src="https://huggingface.co/TomRB22/pivaenist/resolve/main/.images/architecture.png" style="width:100%">
24
  <figcaption align = "center"><b>Pivaenist's architecture.</b></figcaption>
25
  </figure>
26
 
@@ -30,8 +30,6 @@ By the use of the aforementioned autoencoder, it allows the user to encode piano
30
 
31
  ### Sources
32
 
33
- <!-- Provide the basic links for the model. -->
34
-
35
  **Code:** Some of the code of this repository includes modifications (not the entire code, due to the differences in the architecture) or implementations from the following sites:
36
  1. [TensorFlow. (n.d.). Generate music with an RNN | TensorFlow Core](https://www.tensorflow.org/tutorials/audio/music_generation) - Tensorflow tutorial where pretty-midi is used
37
  2. [Han, X. (2020, September 1). VAE with TensorFlow: 6 Ways](https://towardsdatascience.com/vae-with-tensorflow-6-ways-9c689cb76829) - VAE explanation and code
@@ -39,45 +37,12 @@ By the use of the aforementioned autoencoder, it allows the user to encode piano
39
 
40
  There might be acknowledgments missing. If you find some other resemblance to a site's code, please notify me and I will make sure of including it.
41
 
42
- ## Uses
43
- <!-- MENTION COLAB HERE -->
44
-
45
- <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
46
-
47
 
48
  ### Using pivaenist in colab
49
 
50
- <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
51
-
52
  If you preferred directly using or testing the model without the need to install it, you can use the following colab notebook and follow its instructions. Moreover, this serves as an example of use.
53
  [colab link]
54
 
55
- [More Information Needed]
56
-
57
- ### Downstream Use [optional]
58
-
59
- <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
60
-
61
- [More Information Needed]
62
-
63
- ### Out-of-Scope Use
64
-
65
- <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
66
-
67
- [More Information Needed]
68
-
69
- ## Bias, Risks, and Limitations
70
-
71
- <!-- This section is meant to convey both technical and sociotechnical limitations. -->
72
-
73
- [More Information Needed]
74
-
75
- ### Recommendations
76
-
77
- <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
78
-
79
- Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
80
-
81
  ## Installation
82
 
83
  To install the model, you will need to **change your working directory to the desired installation location** and execute the following commands:
@@ -105,133 +70,38 @@ The first one will clone the repository. Then, fluidsynth, a real-time MIDI synt
105
  Pivaenist was trained on the [MAESTRO v2.0.0 dataset](https://magenta.tensorflow.org/datasets/maestro), which contains 1282 midi files [check it in colab]. Their preprocessing involves splitting each note in pitch, duration and step, which compose a column of a 3xN matrix (which we call song map), where N is the number of notes and a row represents sequentially the different pitches, durations and steps. The VAE's objective is to reconstruct these matrices, making it then possible to generate random maps by sampling from the distribution, and then convert them to a MIDI file.
106
 
107
  <figure>
108
- <img src="https://huggingface.co/TomRB22/pivaenist/resolve/main/.images/map_example.png" style="width:50%">
109
- <figcaption align = "center"><b>A cropped example of a song map.</b></figcaption>
110
  </figure>
111
 
112
- ### Training Data
113
-
114
- <!-- This should link to a Data Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
115
-
116
- [More Information Needed]
117
-
118
- ### Training Procedure
119
-
120
- <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
121
-
122
- #### Preprocessing [optional]
123
-
124
- [More Information Needed]
125
-
126
-
127
- #### Training Hyperparameters
128
-
129
- - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
130
-
131
- #### Speeds, Sizes, Times [optional]
132
-
133
- <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
134
-
135
- [More Information Needed]
136
-
137
- ## Evaluation
138
-
139
- <!-- This section describes the evaluation protocols and provides the results. -->
140
-
141
- ### Testing Data, Factors & Metrics
142
-
143
- #### Testing Data
144
-
145
- <!-- This should link to a Data Card if possible. -->
146
-
147
- [More Information Needed]
148
-
149
- #### Factors
150
-
151
- <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
152
-
153
- [More Information Needed]
154
-
155
- #### Metrics
156
-
157
- <!-- These are the evaluation metrics being used, ideally with a description of why. -->
158
-
159
- [More Information Needed]
160
-
161
- ### Results
162
-
163
- [More Information Needed]
164
-
165
- #### Summary
166
-
167
-
168
-
169
- ## Model Examination [optional]
170
-
171
- <!-- Relevant interpretability work for the model goes here -->
172
 
173
- [More Information Needed]
174
-
175
- ## Environmental Impact
176
-
177
- <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
178
-
179
- Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
180
-
181
- - **Hardware Type:** [More Information Needed]
182
- - **Hours used:** [More Information Needed]
183
- - **Cloud Provider:** [More Information Needed]
184
- - **Compute Region:** [More Information Needed]
185
- - **Carbon Emitted:** [More Information Needed]
186
-
187
- ## Technical Specifications [optional]
188
-
189
- ### Model Architecture and Objective
190
-
191
- [More Information Needed]
192
-
193
- ### Compute Infrastructure
194
-
195
- [More Information Needed]
196
 
197
- #### Hardware
198
 
199
- [More Information Needed]
200
-
201
- #### Software
202
-
203
- [More Information Needed]
204
-
205
- ## Citation [optional]
206
-
207
- <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
208
-
209
- **BibTeX:**
210
-
211
- [More Information Needed]
212
-
213
- **APA:**
214
-
215
- [More Information Needed]
216
-
217
- ## Glossary [optional]
218
-
219
- <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
220
-
221
- [More Information Needed]
222
-
223
- ## More Information [optional]
224
-
225
- [More Information Needed]
226
 
227
- ## Model Card Authors [optional]
 
228
 
229
- [More Information Needed]
 
230
 
231
- ## Model Card Contact
232
 
233
- [More Information Needed]
 
 
 
234
 
235
- ## Documentation
 
 
236
 
237
- ###
 
 
20
  ### Model Description
21
 
22
  <figure>
23
+ <img src="https://huggingface.co/TomRB22/pivaenist/resolve/main/.images/architecture.png" style="width:100%; display:block; margin:auto">
24
  <figcaption align = "center"><b>Pivaenist's architecture.</b></figcaption>
25
  </figure>
26
 
 
30
 
31
  ### Sources
32
 
 
 
33
  **Code:** Some of the code of this repository includes modifications (not the entire code, due to the differences in the architecture) or implementations from the following sites:
34
  1. [TensorFlow. (n.d.). Generate music with an RNN | TensorFlow Core](https://www.tensorflow.org/tutorials/audio/music_generation) - Tensorflow tutorial where pretty-midi is used
35
  2. [Han, X. (2020, September 1). VAE with TensorFlow: 6 Ways](https://towardsdatascience.com/vae-with-tensorflow-6-ways-9c689cb76829) - VAE explanation and code
 
37
 
38
  There might be acknowledgments missing. If you find some other resemblance to a site's code, please notify me and I will make sure of including it.
39
 
 
 
 
 
 
40
 
41
  ### Using pivaenist in colab
42
 
 
 
43
  If you preferred directly using or testing the model without the need to install it, you can use the following colab notebook and follow its instructions. Moreover, this serves as an example of use.
44
  [colab link]
45
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  ## Installation
47
 
48
  To install the model, you will need to **change your working directory to the desired installation location** and execute the following commands:
 
70
  Pivaenist was trained on the [MAESTRO v2.0.0 dataset](https://magenta.tensorflow.org/datasets/maestro), which contains 1282 midi files [check it in colab]. Their preprocessing involves splitting each note in pitch, duration and step, which compose a column of a 3xN matrix (which we call song map), where N is the number of notes and a row represents sequentially the different pitches, durations and steps. The VAE's objective is to reconstruct these matrices, making it then possible to generate random maps by sampling from the distribution, and then convert them to a MIDI file.
71
 
72
  <figure>
73
+ <img src="https://huggingface.co/TomRB22/pivaenist/resolve/main/.images/map_example.png" style="width:30%; display:block; margin:auto">
74
+ <figcaption align = "center"><b>A horizontally cropped example of a song map.</b></figcaption>
75
  </figure>
76
 
77
+ # Documentation
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
 
79
+ ## **_Audio_**
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
 
81
+ ### midi_to_notes
82
 
83
+ ```python
84
+ def midi_to_notes(midi_file: str) -> pd.DataFrame:
85
+ ```
86
+ Convert midi file to "song map" (dataframe where each note is broken
87
+ into its components)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
 
89
+ Parameters:
90
+ * midi_file (str): Path to the midi file.
91
 
92
+ Returns:
93
+ * pd.Dataframe: 3xN matrix where each column is a note, composed of pitch, duration and step.
94
 
95
+ ### display_audio
96
 
97
+ ```python
98
+ def display_audio(pm: pretty_midi.PrettyMIDI, seconds=-1) -> display.Audio:
99
+ ```
100
+ Display a song in PrettyMIDI format as a display.Audio object. This method is especially useful in a Jupyter notebook.
101
 
102
+ Parameters
103
+ * pm (pretty_midi.PrettyMIDI): PrettyMIDI object containing a song.
104
+ * seconds (int): Time fraction of the song to be displayed. When set to -1, the full length is taken.
105
 
106
+ Returns
107
+ * display.Audio: Song as an object allowing for display.