// Copyright 2016 Google Inc.
//
// 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 writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////////

syntax = "proto3";

package tensorflow.magenta;

import "magenta/protobuf/music.proto";

// Details about a Generator.
message GeneratorDetails {
  // A unique ID for the generator on this server.
  string id = 1;
  // A short, human-readable description of the generator.
  string description = 2;
}

// Options for generating a sequence.
message GeneratorOptions {
  message GenerateSection {
    // Start time for the model to fill, inclusive.
    double start_time_seconds = 1;
    // End time for the model to fill, inclusive.
    double end_time_seconds = 2;
  }

  repeated GenerateSection generate_sections = 1;
}

// Request to generate a sequence.
message GenerateSequenceRequest {
  // An input sequence to base the generation on.
  NoteSequence input_sequence = 1;

  GeneratorOptions generator_options = 2;
}

// Response after generating a sequence.
message GenerateSequenceResponse {
  // The generated sequence.
  //
  // This should always include the entire NoteSequence, including any notes
  // that occurred before and after the generated portion of the sequence. It
  // should reflect the model's understanding of the NoteSequence. For example,
  // if the model quantizes the input, the model should return a NoteSequence
  // with the input quantized.
  //
  // If an interface wants to use only the generated portion of the sequence, it
  // should keep track of the GenerateSection parameters it sent in the request.
  NoteSequence generated_sequence = 1;
}

// Bundle for wrapping a generator id, checkpoint file, and metagraph.
// Intended to make sharing pre-trained models easier.
// Next ID: 5
message GeneratorBundle {
  // Details about the generator that created this bundle.
  GeneratorDetails generator_details = 1;

  // Details about this specific bundle.
  message BundleDetails {
    // A short, human-readable text description of the bundle (e.g., training
    // data, hyper parameters, etc.).
    string description = 1;
  }
  BundleDetails bundle_details = 4;

  // The contents of the checkpoint file generated by the Saver.
  // This is a repeated field so we can eventually support sharded checkpoints.
  // But for now, we support only 1 file.
  repeated bytes checkpoint_file = 2;

  // The contents of the metagraph file generated by the Saver.
  bytes metagraph_file = 3;
}
