instruction stringclasses 100
values | code stringlengths 78 193k | response stringlengths 259 170k | file stringlengths 59 203 |
|---|---|---|---|
Generate descriptive docstrings automatically | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""MusicVAE data library for hierarchical converters."""
import abc
import random
@@ -28,6 +29,20 @@
def split_performance(performance, steps_per_segment, new_performance_fn,
... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/music_vae/data_hierarchical.py |
Generate docstrings for this script | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""LSTM-based encoders and decoders for MusicVAE."""
import abc
from magenta.common import flatten_maybe_padded_sequences
@@ -30,6 +31,7 @@
class LstmEncoder(base_model.BaseEncode... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/music_vae/lstm_models.py |
Write proper docstrings for these functions | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,34 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+r"""Beam job to preprocess a TFRecord of NoteSequences for training a MusicVAE.
+
+Splits a TFRecord of NoteSequences (as prepared by `convert_to_note_sequences`)
+into individual exampl... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/music_vae/preprocess_tfrecord.py |
Add docstrings with type hints explained | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,14 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Reading MNIST dataset locally.
+
+This library contains functions used to read MNIST-family data such as vanilla
+MNIST or Fashion-MNIST. Typical usage is:
+
+ data_dir = ...
+ trai... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/latent_transfer/local_mnist.py |
Create documentation strings for testing functions | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""A library of functions that help with causal masking."""
from __future__ import absolute_import
from __future__ import division
@@ -21,6 +22,14 @@
def shift_right(x):
+ """Shi... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/nsynth/wavenet/masked.py |
Add docstrings to clarify complex logic | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Autoencoder model for training on spectrograms."""
from magenta.contrib import training as contrib_training
from magenta.models.nsynth import utils
import numpy as np
@@ -20,6 +21,1... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/nsynth/baseline/models/ae.py |
Create docstrings for API functions | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Melody RNN model."""
import copy
@@ -26,9 +27,29 @@
class MelodyRnnModel(events_rnn_model.EventSequenceRnnModel):
+ """Class for RNN melody generation models."""
def gen... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/melody_rnn/melody_rnn_model.py |
Add docstrings for better understanding | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Melody RNN generation code as a SequenceGenerator interface."""
import functools
@@ -22,9 +23,22 @@
class MelodyRnnSequenceGenerator(sequence_generator.BaseSequenceGenerator):... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/melody_rnn/melody_rnn_sequence_generator.py |
Generate docstrings for script automation | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""A WaveNet-style AutoEncoder Configuration and FastGeneration Config."""
from magenta.models.nsynth import reader
from magenta.models.nsynth import utils
@@ -20,11 +21,22 @@
cla... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/nsynth/wavenet/h512_bo16.py |
Add missing documentation to my Python functions | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,11 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Nerual network components.
+
+This library containts nerual network components in either raw TF or sonnet
+Module.
+"""
import numpy as np
import sonnet as snt
@@ -19,6 +24,7 @@
... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/latent_transfer/nn.py |
Improve my code by adding docstrings | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Pipeline to create MelodyRNN dataset."""
from magenta.pipelines import dag_pipeline
from magenta.pipelines import melody_pipelines
@@ -23,8 +24,16 @@
class EncoderPipeline(pipe... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/melody_rnn/melody_rnn_pipeline.py |
Add docstrings to improve readability | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,13 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Model in the dapaspace (e.g. pre-trained VAE).
+
+The whole experiment handles transfer between latent space
+of generative models that model the data. This file defines models
+that ... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/latent_transfer/model_dataspace.py |
Add docstrings to my Python code | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""MusicVAE generation script."""
# TODO(adarob): Add support for models with conditioning.
@@ -71,6 +72,7 @@
def _slerp(p0, p1, t):
+ """Spherical linear interpolation."""
o... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/music_vae/music_vae_generate.py |
Add minimal docstrings for each function | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""MusicVAE data library."""
import abc
import collections
import copy
@@ -78,6 +79,7 @@
def _maybe_pad_seqs(seqs, dtype, depth):
+ """Pads sequences to match the longest and retu... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/music_vae/data.py |
Add docstrings to existing functions | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""A class for sampling, encoding, and decoding from trained MusicVAE models."""
import copy
import os
import re
@@ -31,6 +32,22 @@
class TrainedModel(object):
+ """An interface t... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/music_vae/trained_model.py |
Write proper docstrings for these functions | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Provides a class, defaults, and utils for Melody RNN model configuration."""
from magenta.contrib import training as contrib_training
from magenta.models.melody_rnn import melody_r... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/melody_rnn/melody_rnn_config_flags.py |
Document functions with clear intent | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,12 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Inference for onset conditioned model.
+
+A histogram summary will be written for every example processed, and the
+resulting MIDI and pianoroll images will also be written for every ... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/onsets_frames_transcription/infer.py |
Fully document this Python code with docstrings | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Utilities for creating EstimatorSpecs for Onsets and Frames models."""
import functools
@@ -28,6 +29,7 @@ def _drums_only_metric_ops(features, labels, frame_probs, onset_probs,
... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/onsets_frames_transcription/estimator_spec_util.py |
Auto-generate documentation strings for this file | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,25 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Create TF graphs for calculating log-mel-spectral features.
+
+NOTE: This code is very experimental and will likely change, both in interface
+and what it outputs.
+
+The single publi... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/onsets_frames_transcription/melspec_input.py |
Generate docstrings for each module | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Run a pretrained autoencoder model on an entire dataset, saving encodings."""
import os
import sys
@@ -43,6 +44,13 @@
def save_arrays(savedir, hparams, z_val):
+ """Save array... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/nsynth/baseline/save_embeddings.py |
Expand my code with proper documentation strings | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Drum hit mappings."""
from magenta.models.onsets_frames_transcription import constants
from note_seq.protobuf import music_pb2
@@ -97,6 +98,25 @@ mapping_name,
... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/onsets_frames_transcription/drum_mappings.py |
Add concise docstrings to each method | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Utilities for inference."""
from __future__ import absolute_import
from __future__ import division
@@ -25,6 +26,21 @@
def probs_to_pianoroll_viterbi(frame_probs, onset_probs, a... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/onsets_frames_transcription/infer_util.py |
Help me write clear docstrings | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,14 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Utilities for "fast" wavenet generation with queues.
+
+For more information, see:
+
+Ramachandran, P., Le Paine, T., Khorrami, P., Babaeizadeh, M.,
+Chang, S., Zhang, Y., ... Huang, ... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/nsynth/wavenet/fastgen.py |
Write clean docstrings for readability | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,10 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Write spectrograms of wav files to JSON.
+
+Usage: onsets_frames_transcription_specjson file1.wav [file2.wav file3.wav]
+"""
from __future__ import absolute_import
from __future__... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/onsets_frames_transcription/onsets_frames_transcription_spectrogram_json.py |
Can you add docstrings to this Python file? | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""MusicVAE training script."""
import os
from magenta.models.music_vae import configs
@@ -83,6 +84,7 @@
# Should not be called from within the graph to avoid redundant summaries.
... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/music_vae/music_vae_train.py |
Auto-generate documentation strings for this file | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Utility functions for NSynth."""
import importlib
import os
@@ -29,18 +30,47 @@ # WaveNet Functions
#==============================================================================... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/nsynth/utils.py |
Add docstrings to incomplete code | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Module to load the Dataset."""
from __future__ import absolute_import
from __future__ import division
@@ -34,12 +35,21 @@
class NSynthDataset(object):
+ """Dataset object to h... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/nsynth/reader.py |
Add docstrings for production code | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,10 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Generate polyphonic performances from a trained checkpoint.
+
+Uses flags to define operation.
+"""
import ast
import os
import time
@@ -107,6 +111,7 @@
def get_checkpoint():
+... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/performance_rnn/performance_rnn_generate.py |
Generate docstrings for this script | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""SoX-based audio transform functions for the purpose of data augmentation."""
from __future__ import absolute_import
from __future__ import division
@@ -75,8 +76,22 @@
class Aud... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/onsets_frames_transcription/audio_transform.py |
Write proper docstrings for these functions | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+r"""Utilities for managing wav files and labels for transcription."""
from __future__ import absolute_import
from __future__ import division
@@ -32,6 +33,7 @@
def velocity_range_f... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/onsets_frames_transcription/audio_label_data_utils.py |
Create docstrings for API functions | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Constructs a Piano Genie model."""
from magenta.contrib import rnn as contrib_rnn
from magenta.models.piano_genie import util
@@ -27,6 +28,7 @@ rnn_nunits=1... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/piano_genie/model.py |
Create docstrings for API functions | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Performance RNN model."""
import collections
import functools
@@ -29,11 +30,36 @@
class PerformanceRnnModel(events_rnn_model.EventSequenceRnnModel):
+ """Class for RNN perform... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/performance_rnn/performance_model.py |
Generate NumPy-style docstrings | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Onset-focused model for piano and drum transcription, TPU compatible."""
from __future__ import absolute_import
from __future__ import division
@@ -27,6 +28,7 @@
def conv_net(i... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/onsets_frames_transcription/model_tpu.py |
Generate helpful docstrings for debugging | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Routines to reproduce "standard" Mel."""
import numpy as np
@@ -22,6 +23,15 @@
def HertzToMel(frequencies_hertz):
+ """Convert frequencies to mel scale using HTK formula.
+
+... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/onsets_frames_transcription/mfcc_mel.py |
Insert docstrings into my code | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Onset-focused model for piano transcription."""
from __future__ import absolute_import
from __future__ import division
@@ -34,6 +35,7 @@
def conv_net(inputs, hparams):
+ """Bu... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/onsets_frames_transcription/model.py |
Create structured documentation for my script | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,11 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Create the tfrecord files necessary for training onsets and frames.
+
+The training files are split in ~20 second chunks by default, the test files
+are not split.
+"""
import glob... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/onsets_frames_transcription/onsets_frames_transcription_create_dataset_maps.py |
Document this code for team use | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Library functions for creating dataset."""
import collections
import copy
@@ -29,6 +30,7 @@
def generate_mixes_using_all_examples(sourceid_to_exids, rs):
+ """Generates mixes ... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/onsets_frames_transcription/create_dataset_lib.py |
Generate docstrings with examples | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Provides function to build an RNN-NADE model's graph."""
import collections
@@ -28,6 +29,14 @@
class RnnNadeStateTuple(_RnnNadeStateTuple):
+ """Tuple used by RnnNade to stor... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/pianoroll_rnn_nade/pianoroll_rnn_nade_graph.py |
Add documentation for all methods | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Utilities for training."""
import collections
import copy
@@ -25,6 +26,7 @@
# Should not be called from within the graph to avoid redundant summaries.
def _trial_summary(hparams... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/onsets_frames_transcription/train_util.py |
Add docstrings following best practices | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,15 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Shared methods for providing data to transcription models.
+
+Glossary (definitions may not hold outside of this particular file):
+ sample: The value of an audio waveform at a discr... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/onsets_frames_transcription/data.py |
Help me comply with documentation standards | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Utility functions for Piano Genie."""
from __future__ import absolute_import
from __future__ import division
@@ -22,6 +23,7 @@
def demidify(pitches):
+ """Transforms MIDI pitc... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/piano_genie/util.py |
Create documentation for each function signature | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Beam pipeline for dataset creation."""
import hashlib
import os
@@ -58,6 +59,7 @@
def split_wav(input_example, min_length, max_length, sample_rate,
debug_output_di... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/onsets_frames_transcription/create_dataset.py |
Please document this code using docstrings | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""RNN-NADE model."""
from magenta.contrib import training as contrib_training
from magenta.models.pianoroll_rnn_nade import pianoroll_rnn_nade_graph
@@ -21,6 +22,7 @@
class Piano... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/pianoroll_rnn_nade/pianoroll_rnn_nade_model.py |
Document my Python code with docstrings | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,24 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Defines a class and operations for the MelodyRNN model.
+
+Note RNN Loader allows a basic melody prediction LSTM RNN model to be loaded
+from a checkpoint file, primed, and used to pr... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/rl_tuner/note_rnn_loader.py |
Generate docstrings for exported functions | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Beam pipeline to generate examples for a Score2Perf dataset."""
import copy
import functools
import hashlib
@@ -50,6 +51,7 @@
@typehints.with_output_types(typing.Tuple[str, str])
... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/score2perf/datagen_beam.py |
Turn comments into proper docstrings | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,10 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Generate polyphonic tracks from a trained checkpoint.
+
+Uses flags to define operation.
+"""
import ast
import os
import time
@@ -110,6 +114,7 @@
def get_checkpoint():
+ """G... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/polyphony_rnn/polyphony_rnn_generate.py |
Help me document legacy Python code | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Code for interacting with the TFLite model."""
import importlib
import numpy as np
@@ -31,6 +32,7 @@
class Model(object):
+ """Manage Onsets and Frames TFLite model."""
# M... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/onsets_frames_transcription/realtime/tflite_model.py |
Generate docstrings for this script | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,17 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Defines the main RL Tuner class.
+
+RL Tuner is a Deep Q Network (DQN) with augmented reward to create melodies
+by using reinforcement learning to fine-tune a trained Note RNN accord... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/rl_tuner/rl_tuner.py |
Include argument descriptions in docstrings | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Experimental realtime transcription demo."""
import multiprocessing
import threading
@@ -41,6 +42,7 @@
class TfLiteWorker(multiprocessing.Process):
+ """Process for executing ... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/onsets_frames_transcription/realtime/onsets_frames_transcription_realtime.py |
Write docstrings for this repository | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Performance RNN generation code as a SequenceGenerator interface."""
from __future__ import division
@@ -36,6 +37,7 @@
class PerformanceRnnSequenceGenerator(sequence_generator... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/performance_rnn/performance_sequence_generator.py |
Auto-generate documentation strings for this file | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Transcription metrics calculations."""
from __future__ import absolute_import
from __future__ import division
@@ -34,6 +35,15 @@
def f1_score(precision, recall):
+ """Creates ... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/onsets_frames_transcription/metrics.py |
Auto-generate documentation strings for this file | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Transcribe a recording of piano audio."""
from __future__ import absolute_import
from __future__ import division
@@ -56,6 +57,7 @@
def create_example(filename, sample_rate, loa... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/onsets_frames_transcription/onsets_frames_transcription_transcribe.py |
Write proper docstrings for these functions | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Performance generation from score in Tensor2Tensor."""
from __future__ import absolute_import
from __future__ import division
@@ -59,52 +60,69 @@
class Score2PerfProblem(proble... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/score2perf/score2perf.py |
Add docstrings for production code | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Piano Genie continuous eval script."""
import collections
import os
import time
@@ -172,6 +173,7 @@ saver = tf.train.Saver(genie_vars + [step], max_to_keep=None)
def _eval_al... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/piano_genie/eval.py |
Add missing documentation to my Python functions | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Polyphonic RNN model."""
from magenta.contrib import training as contrib_training
from magenta.models.polyphony_rnn import polyphony_encoder_decoder
@@ -21,15 +22,48 @@
class P... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/polyphony_rnn/polyphony_model.py |
Help me document legacy Python code | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Hyperparameter configurations for Piano Genie."""
from __future__ import absolute_import
from __future__ import division
@@ -20,6 +21,7 @@
class BasePianoGenieConfig(object):
+... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/piano_genie/configs.py |
Please document this code using docstrings | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Gold standard musical sequences."""
from __future__ import absolute_import
from __future__ import division
@@ -51,10 +52,12 @@
def gold_longest():
+ """Returns the length of t... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/piano_genie/gold.py |
Add docstrings to meet PEP guidelines | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,20 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+r"""Beam job for creating tfrecord files from datasets.
+
+Expects a CSV with the following fields: audio_filename, midi_filename, split
+
+Usage:
+onsets_frames_transcription_create_tfr... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/onsets_frames_transcription/onsets_frames_transcription_create_tfrecords.py |
Add minimal docstrings for each function | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Loads music data from TFRecords."""
from __future__ import absolute_import
from __future__ import division
@@ -34,11 +35,32 @@ randomize_chord_order=False,
... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/piano_genie/loader.py |
Turn comments into proper docstrings | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""RNN-NADE generation code as a SequenceGenerator interface."""
import functools
@@ -23,9 +24,22 @@
class PianorollRnnNadeSequenceGenerator(
sequence_generator.BaseSequenceGe... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/pianoroll_rnn_nade/pianoroll_rnn_nade_sequence_generator.py |
Can you add docstrings to this Python file? | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,11 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Interface to asynchronously capture continuous audio from PyAudio.
+
+This module provides one class, AudioRecorder, which buffers chunks of audio
+from PyAudio.
+"""
import import... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/onsets_frames_transcription/realtime/audio_recorder.py |
Generate consistent docstrings | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Sketch-RNN Model."""
import random
@@ -22,10 +23,12 @@
def copy_hparams(hparams):
+ """Return a copy of an HParams instance."""
return contrib_training.HParams(**hparams.v... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/sketch_rnn/model.py |
Add missing documentation to my Python functions | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Polyphonic RNN generation code as a SequenceGenerator interface."""
import copy
import functools
@@ -24,9 +25,22 @@
class PolyphonyRnnSequenceGenerator(sequence_generator.BaseS... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/polyphony_rnn/polyphony_sequence_generator.py |
Insert docstrings into my code | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Pipeline to create PolyphonyRNN dataset."""
from magenta.models.polyphony_rnn import polyphony_lib
from magenta.pipelines import dag_pipeline
@@ -23,6 +24,7 @@
class Polyphonic... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/polyphony_rnn/polyphony_rnn_pipeline.py |
Add docstrings that explain purpose and usage | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Utility functions for working with polyphonic sequences."""
from __future__ import division
@@ -33,6 +34,7 @@
class PolyphonicEvent(object):
+ """Class for storing events in ... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/polyphony_rnn/polyphony_lib.py |
Create docstrings for all classes and functions | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""SketchRNN data loading and image manipulation utilities."""
import random
@@ -19,6 +20,7 @@
def get_bounds(data, factor=10):
+ """Return bounds of data."""
min_x = 0
ma... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/sketch_rnn/utils.py |
Fill in missing docstrings in my code | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Tensor2Tensor encoders for music."""
from __future__ import absolute_import
from __future__ import division
@@ -30,9 +31,40 @@
class MidiPerformanceEncoder(object):
+ """Conve... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/score2perf/music_encoders.py |
Fully document this Python code with docstrings | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Classes for converting between polyphonic input and model input/output."""
from __future__ import division
@@ -34,6 +35,7 @@
class PolyphonyOneHotEncoding(encoder_decoder.OneH... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/polyphony_rnn/polyphony_encoder_decoder.py |
Write docstrings for data processing functions | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Hparams for symbolic music modeling tasks."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
@@ -21,6 +22,7 @@
def ... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/score2perf/score2perf_hparams.py |
Create Google-style docstrings for my code | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Modality transformations used by Magenta and not in core Tensor2Tensor."""
from __future__ import absolute_import
from __future__ import division
@@ -22,6 +23,7 @@
def _get_wei... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/score2perf/modalities.py |
Help me add docstrings to my project | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Pipeline for event sequences."""
from magenta.pipelines import pipeline
from magenta.pipelines import pipelines_common
@@ -19,8 +20,16 @@
class EncoderPipeline(pipeline.Pipelin... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/pipelines/event_sequence_pipeline.py |
Generate documentation strings for clarity | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Beam pipelines to generate examples for the GlyphAzzn dataset."""
from absl import app
from absl import flags
@@ -56,6 +57,7 @@
def _convert_to_path(g):
+ """Converts SplineSe... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/svg_vae/datagen_beam.py |
Generate consistent docstrings | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""NoteSequence processing pipelines."""
import copy
@@ -27,8 +28,14 @@
class NoteSequencePipeline(pipeline.Pipeline):
+ """Superclass for pipelines that input and output NoteSe... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/pipelines/note_sequence_pipelines.py |
Write Python docstrings for this snippet | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Defines the GlyphAzznProblem."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
@@ -46,9 +47,11 @@
@registry.register... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/svg_vae/glyphazzn.py |
Create docstrings for each class method | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,23 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Pipeline that runs arbitrary pipelines composed in a graph.
+
+Some terminology used in the code.
+
+dag: Directed acyclic graph.
+unit: A Pipeline which is run inside DAGPipeline.
+c... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/pipelines/dag_pipeline.py |
Insert docstrings into my code | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""For running data processing pipelines."""
from __future__ import absolute_import
from __future__ import division
@@ -27,14 +28,30 @@
class InvalidTypeSignatureError(Exception):... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/pipelines/pipeline.py |
Provide clean and structured docstrings | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Pipeline to create Performance dataset."""
from magenta.pipelines import dag_pipeline
from magenta.pipelines import note_sequence_pipelines
@@ -30,8 +31,16 @@
class EncoderPipe... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/pipelines/performance_pipeline.py |
Write docstrings for backend logic | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Defines statistics objects for pipelines."""
import abc
import bisect
@@ -25,22 +26,69 @@
class Statistic(object):
+ """Holds statistics about a Pipeline run.
+
+ Pipelines p... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/pipelines/statistics.py |
Add docstrings that explain logic | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Data processing pipelines for lead sheets."""
import copy
from magenta.pipelines import chord_pipelines
@@ -29,6 +30,7 @@
class LeadSheetExtractor(pipeline.Pipeline):
+ """Ext... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/pipelines/lead_sheet_pipelines.py |
Document this code for team use | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Code to evaluate how well an RL Tuner conforms to music theory rules."""
from magenta.models.rl_tuner import rl_tuner_ops
import numpy as np
@@ -23,6 +24,18 @@ ... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/rl_tuner/rl_tuner_eval_metrics.py |
Add inline docstrings for readability | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,10 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Generate pianoroll tracks from a trained RNN-NADE checkpoint.
+
+Uses flags to define operation.
+"""
import ast
import os
import time
@@ -92,6 +96,7 @@
def get_checkpoint():
+... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/pianoroll_rnn_nade/pianoroll_rnn_nade_generate.py |
Generate helpful docstrings for debugging | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Helper functions to support the RLTuner and NoteRNNLoader classes."""
from __future__ import absolute_import
from __future__ import division
@@ -76,6 +77,7 @@
def default_hpara... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/rl_tuner/rl_tuner_ops.py |
Help me write clear docstrings | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Train and evaluate an event sequence RNN model."""
import os
import tempfile
@@ -26,6 +27,28 @@ checkpoints_to_keep=10, keep_checkpoint_every_n_hours=1,
... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/shared/events_rnn_train.py |
Write docstrings for algorithm functions | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,12 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Variations of Transformer autoencoder for conditional music generation.
+
+The Transformer autoencoder consists of an encoder and a decoder. The models
+currently support conditioning... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/score2perf/transformer_autoencoder.py |
Create docstrings for each class method | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Utility functions for handling bundle files."""
from note_seq.protobuf import generator_pb2
import tensorflow.compat.v1 as tf
@@ -19,6 +20,7 @@
class GeneratorBundleParseError(... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/shared/sequence_generator_bundle.py |
Write docstrings describing each step | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Event sequence RNN model."""
import collections
import copy
@@ -38,14 +39,41 @@
def _extend_control_events_default(control_events, events, state):
+ """Default function for ex... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/shared/events_rnn_model.py |
Add docstrings that explain logic | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,10 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Abstract class for models.
+
+Provides a uniform interface for interacting with any model.
+"""
import abc
@@ -19,15 +23,32 @@
class BaseModel(object, metaclass=abc.ABCMeta):... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/shared/model.py |
Create docstrings for each class method | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,11 +12,13 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""SketchRNN RNN definition."""
import numpy as np
import tensorflow.compat.v1 as tf
def orthogonal(shape):
+ """Orthogonal initializer."""
flat_shape = (shape[0], np.prod(sh... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/sketch_rnn/rnn.py |
Add docstrings explaining edge cases | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,10 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Abstract class for sequence generators.
+
+Provides a uniform interface for interacting with generators for any model.
+"""
import abc
import os
@@ -22,20 +26,37 @@
class Sequ... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/shared/sequence_generator.py |
Add inline docstrings for readability | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,10 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Transform one or multiple video in a set of frames.
+
+Files are prefixed by a f followed by the frame number.
+"""
from __future__ import absolute_import
from __future__ import div... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/video/tools/extract_frames.py |
Add docstrings to incomplete code | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Provides function to build an event sequence RNN model's graph."""
import numbers
import magenta.common
@@ -29,6 +30,21 @@ attn_length=0,
base_... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/shared/events_rnn_graph.py |
Document classes and their methods | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Defines the Material Design Icons Problem."""
import io
import numpy as np
@@ -42,12 +43,14 @@
############################### GENERAL UTILS #################################
de... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/svg_vae/svg_utils.py |
Generate documentation strings for clarity | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Data processing pipelines for chord progressions."""
import copy
from magenta.pipelines import pipeline
@@ -27,6 +28,7 @@
class ChordsExtractor(pipeline.Pipeline):
+ """Extrac... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/pipelines/chord_pipelines.py |
Add detailed documentation for each class | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""SketchRNN training."""
import json
import os
@@ -53,6 +54,7 @@
def reset_graph():
+ """Closes the current default session and resets the graph."""
sess = tf.get_default_ses... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/models/sketch_rnn/sketch_rnn_train.py |
Add docstrings following best practices | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,10 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""This tools pick some frames randomly from a folder to an other.
+
+Only useful if used with the --limit flag unless it will copy the whole folder
+"""
from __future__ import print_fu... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/video/tools/random_pick.py |
Document all public functions with docstrings | # -*- coding:utf-8 -*-
import requests, hashlib, sys, click, re, base64, binascii, json, os
from Crypto.Cipher import AES
from http import cookiejar
"""
Website:http://cuijiahua.com
Author:Jack Cui
Refer:https://github.com/darknessomi/musicbox
"""
class Encrypyed():
def __init__(self):
self.modulus = '00e0b509f625... | --- +++ @@ -1,180 +1,236 @@-# -*- coding:utf-8 -*-
-import requests, hashlib, sys, click, re, base64, binascii, json, os
-from Crypto.Cipher import AES
-from http import cookiejar
-
-"""
-Website:http://cuijiahua.com
-Author:Jack Cui
-Refer:https://github.com/darknessomi/musicbox
-"""
-
-class Encrypyed():
- def __init... | https://raw.githubusercontent.com/Jack-Cherish/python-spider/HEAD/Netease/Netease.py |
Create docstrings for all classes and functions | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Data processing pipelines for melodies."""
from magenta.pipelines import pipeline
from magenta.pipelines import statistics
@@ -26,6 +27,7 @@
class MelodyExtractor(pipeline.Pipe... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/pipelines/melody_pipelines.py |
Include argument descriptions in docstrings | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Data processing pipelines for drum tracks."""
from magenta.pipelines import pipeline
from magenta.pipelines import statistics
@@ -31,6 +32,51 @@ gap_bars=1.... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/pipelines/drum_pipelines.py |
Write beginner-friendly docstrings | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Pipeline to create Pianoroll dataset."""
from magenta.pipelines import dag_pipeline
from magenta.pipelines import event_sequence_pipeline
@@ -25,6 +26,7 @@
class PianorollSeque... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/pipelines/pianoroll_pipeline.py |
Add missing documentation to my Python functions | # Copyright 2025 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | --- +++ @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
+"""Common data processing pipelines."""
import numbers
import random
@@ -23,6 +24,14 @@
class RandomPartition(pipeline.Pipeline):
+ """Outputs multiple datasets.
+
+ This Pipeli... | https://raw.githubusercontent.com/magenta/magenta/HEAD/magenta/pipelines/pipelines_common.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.