MusicVAE
constructor.
Path to the checkpoint directory.
(Optional) MusicVAESpec
object. If undefined, will be
loaded from a config.json
file in the checkpoint directory.
Decodes the input latent vectors into NoteSequence
s.
The latent vectors to decode, sized [batchSize, zSize]
.
(Optional) The softmax temperature to use when sampling. The argmax is used if not provided.
(Optional) MusicVAEControlArgs object to use as conditioning.
The step resolution of the resulting
NoteSequence
.
The tempo of the resulting NoteSequence
s.
The decoded NoteSequence
s.
Decodes the input latent vectors into tensors.
The latent vectors to decode, sized [batchSize, zSize]
.
(Optional) The softmax temperature to use when sampling. The argmax is used if not provided.
(Optional) MusicVAEControlArgs object to use as conditioning.
The decoded tensors.
Disposes of any untracked Tensors
to avoid GPU memory leaks.
Encodes the input NoteSequence
s into latent vectors.
An array of NoteSequence
s to encode.
(Optional) MusicVAEControlArgs object to use as conditioning.
A Tensor
containing the batch of latent vectors, sized
[inputSequences.length, zSize]
.
Encodes the input Tensor
s into latent vectors.
A 3D Tensor
of sequences to encode.
(Optional) MusicVAEControlArgs object to use as conditioning.
A Tensor
containing the batch of latent vectors, sized
[inputTensors.shape[0], zSize]
.
Loads variables from the checkpoint and instantiates the Encoder
and
Decoder
.
Interpolates between the input NoteSequence
s in latent space.
If 2 sequences are given, a single linear interpolation is computed,
with the first output sequence being a reconstruction of sequence A and
the final output being a reconstruction of sequence B, with
numInterps
total sequences.
If 4 sequences are given, bilinear interpolation is used. The results
are returned in row-major order for a matrix with the following layout:
| A . . C |
| . . . . |
| . . . . |
| B . . D |
where the letters represent the reconstructions of the four inputs, in
alphabetical order, with the number of output columns and rows specified
by numInterps
.
An array of 2 or 4 NoteSequence
s to interpolate
between.
The number of pairwise interpolation sequences to
return, including the reconstructions. If 4 inputs are given, this can be
either a single number specifying the side length of a square, or a
[columnCount, rowCount]
array to specify a rectangle.
(Optional) The softmax temperature to use when sampling from the logits. Argmax is used if not provided.
(Optional) MusicVAEControlArgs object to use as conditioning.
An array of interpolation NoteSequence
objects, as described
above.
Interpolates between the input Tensor
s in latent space.
If 2 sequences are given, a single linear interpolation is computed,
with the first output sequence being a reconstruction of sequence A and
the final output being a reconstruction of sequence B, with
numInterps
total sequences.
If 4 sequences are given, bilinear interpolation is used. The results
are returned in row-major order for a matrix with the following layout:
| A . . C |
| . . . . |
| . . . . |
| B . . D |
where the letters represent the reconstructions of the four inputs, in
alphabetical order, with the number of output columns and rows specified
by numInterps
.
A 3D Tensor
containing 2 or 4 sequences to
interpolate between.
The number of pairwise interpolation sequences to
return, including the reconstructions. If 4 inputs are given, this can be
either a single number specifying the side length of a square, or a
[columnCount, rowCount]
array to specify a rectangle.
(Optional) The softmax temperature to use when sampling from the logits. Argmax is used if not provided.
(Optional) MusicVAEControlArgs object to use as conditioning.
A 3D Tensor
of interpolations.
Returns true iff model is intialized.
Samples sequences from the model prior.
The number of samples to return.
The softmax temperature to use when sampling.
(Optional) MusicVAEControlArgs object to use as conditioning.
The step resolution of the resulting
NoteSequence
s.
The tempo of the resulting NoteSequence
s.
An array of sampled NoteSequence
objects.
Samples tensors from the model prior.
The number of samples to return.
The softmax temperature to use when sampling.
(Optional) MusicVAEControlArgs object to use as conditioning.
A Tensor3D
of samples.
Generates similar NoteSequence
s to an input NoteSequence
.
This is done by sampling new Zs from a unit Gaussian and interpolating
between the encoded input NoteSequence
and the sampled Zs.
The input NoteSequence
.
The number of samples to return.
The degree of similarity between the generated sequences and the input sequence. Must be between 0 and 1, where 1 is most similar and 0 is least similar.
The softmax temperature to use when sampling.
(Optional) MusicVAEControlArgs object to use as conditioning.
An array of generated NoteSequence
objects.
Generates similar tensors to an input tensor.
This is done by sampling new Zs from a unit Gaussian and interpolating between the encoded input tensor and the sampled Zs.
The input tensor, a Tensor2D
.
The number of samples to return.
The degree of similarity between the generated tensors and the input tensor. Must be between 0 and 1, where 1 is most similar and 0 is least similar.
The softmax temperature to use when sampling.
(Optional) MusicVAEControlArgs object to use as conditioning.
A Tensor3D
of samples.
Generated using TypeDoc
Main MusicVAE model class.
A MusicVAE is a variational autoencoder made up of an
Encoder
andDecoder
, along with aDataConverter
for converting betweenTensor
andNoteSequence
objects for input and output.Exposes methods for interpolation and sampling of musical sequences.