juancopi81's picture
Add t5x and mt3 models
b100e1c
# Defaults for eval.py.
#
# You must also include a binding for MODEL.
#
# Required to be set:
#
# - TASK_PREFIX
# - TASK_FEATURE_LENGTHS
# - CHECKPOINT_PATH
# - EVAL_OUTPUT_DIR
#
# Commonly overridden options:
#
# - DatasetConfig.split
# - DatasetConfig.batch_size
# - DatasetConfig.use_cached
# - RestoreCheckpointConfig.mode
# - PjitPartitioner.num_partitions
from __gin__ import dynamic_registration
import __main__ as eval_script
from mt3 import preprocessors
from mt3 import tasks
from mt3 import vocabularies
from t5x import partitioning
from t5x import utils
# Must be overridden
TASK_PREFIX = %gin.REQUIRED
TASK_FEATURE_LENGTHS = %gin.REQUIRED
CHECKPOINT_PATH = %gin.REQUIRED
EVAL_OUTPUT_DIR = %gin.REQUIRED
# Number of velocity bins: set to 1 (no velocity) or 127
NUM_VELOCITY_BINS = %gin.REQUIRED
VOCAB_CONFIG = @vocabularies.VocabularyConfig()
vocabularies.VocabularyConfig.num_velocity_bins = %NUM_VELOCITY_BINS
# Program granularity: set to 'flat', 'midi_class', or 'full'
PROGRAM_GRANULARITY = %gin.REQUIRED
preprocessors.map_midi_programs.granularity_type = %PROGRAM_GRANULARITY
TASK_SUFFIX = 'test'
tasks.construct_task_name:
task_prefix = %TASK_PREFIX
vocab_config = %VOCAB_CONFIG
task_suffix = %TASK_SUFFIX
eval_script.evaluate:
model = %MODEL # imported from separate gin file
dataset_cfg = @utils.DatasetConfig()
partitioner = @partitioning.PjitPartitioner()
restore_checkpoint_cfg = @utils.RestoreCheckpointConfig()
output_dir = %EVAL_OUTPUT_DIR
utils.DatasetConfig:
mixture_or_task_name = @tasks.construct_task_name()
task_feature_lengths = %TASK_FEATURE_LENGTHS
split = 'eval'
batch_size = 32
shuffle = False
seed = 42
use_cached = True
pack = False
use_custom_packing_ops = False
partitioning.PjitPartitioner.num_partitions = 1
utils.RestoreCheckpointConfig:
path = %CHECKPOINT_PATH
mode = 'specific'