text_plain_output_100.png text_plain_output_84.png text_plain_output_56.png text_plain_output_137.png text_plain_output_139.png text_plain_output_35.png text_plain_output_130.png text_plain_output_117.png text_plain_output_98.png text_plain_output_43.png text_plain_output_78.png text_plain_output_106.png text_plain_output_37.png text_plain_output_138.png text_plain_output_90.png text_plain_output_79.png text_plain_output_5.png text_plain_output_75.png text_plain_output_48.png text_plain_output_116.png text_plain_output_128.png text_plain_output_30.png text_plain_output_73.png text_plain_output_126.png text_plain_output_115.png text_plain_output_15.png text_plain_output_133.png text_plain_output_114.png text_plain_output_70.png text_plain_output_9.png text_plain_output_44.png text_plain_output_119.png text_plain_output_86.png text_plain_output_118.png text_plain_output_131.png text_plain_output_40.png text_plain_output_123.png text_plain_output_74.png text_plain_output_31.png text_plain_output_20.png text_plain_output_102.png text_plain_output_111.png text_plain_output_101.png text_plain_output_132.png text_plain_output_60.png text_plain_output_68.png text_plain_output_4.png text_plain_output_65.png text_plain_output_64.png text_plain_output_13.png text_plain_output_107.png text_plain_output_52.png text_plain_output_66.png text_plain_output_45.png text_plain_output_14.png text_plain_output_32.png text_plain_output_88.png text_plain_output_29.png text_plain_output_140.png text_plain_output_129.png text_plain_output_58.png text_plain_output_49.png text_plain_output_63.png text_plain_output_27.png text_plain_output_76.png text_plain_output_108.png text_plain_output_54.png text_plain_output_10.png text_plain_output_6.png text_plain_output_92.png text_plain_output_57.png text_plain_output_120.png text_plain_output_24.png text_plain_output_21.png text_plain_output_104.png text_plain_output_47.png text_plain_output_121.png text_plain_output_25.png text_plain_output_134.png text_plain_output_77.png text_plain_output_18.png text_plain_output_50.png text_plain_output_36.png text_plain_output_96.png text_plain_output_87.png text_plain_output_141.png text_plain_output_112.png application_vnd.jupyter.stderr_output_3.png text_plain_output_113.png text_plain_output_22.png text_plain_output_81.png text_plain_output_69.png text_plain_output_125.png text_plain_output_38.png text_plain_output_7.png text_plain_output_91.png text_plain_output_16.png text_plain_output_59.png text_plain_output_103.png text_plain_output_71.png text_plain_output_8.png text_plain_output_122.png text_plain_output_26.png text_plain_output_109.png text_plain_output_41.png text_plain_output_34.png text_plain_output_85.png text_plain_output_42.png text_plain_output_110.png text_plain_output_67.png text_plain_output_53.png text_plain_output_23.png text_plain_output_89.png text_plain_output_51.png text_plain_output_28.png text_plain_output_72.png text_plain_output_99.png text_plain_output_136.png text_plain_output_2.png text_plain_output_127.png text_plain_output_97.png text_plain_output_33.png application_vnd.jupyter.stderr_output_1.png text_plain_output_39.png text_plain_output_55.png text_plain_output_82.png text_plain_output_93.png text_plain_output_19.png text_plain_output_105.png text_plain_output_80.png text_plain_output_94.png text_plain_output_124.png text_plain_output_17.png text_plain_output_11.png text_plain_output_12.png text_plain_output_62.png text_plain_output_95.png text_plain_output_61.png text_plain_output_83.png text_plain_output_135.png text_plain_output_46.png
import numpy as np

import os

import tensorflow as tf

config = {'SEED': 42, 'DEBUG': False, 'test_size': 0.1, 'img_size': 128, 'batch_size': 32, 'num_labels': 0, 'epochs': 10, 'device': 'GPU'}
debug_config = {}

def set_seed(SEED):
    os.environ['PYTHONHASHSEED'] = str(SEED)
    np.random.seed(SEED)
    tf.random.set_seed(SEED)
set_seed(config['SEED'])

def get_device(device):
    if device == 'TPU':
        try:
            tpu = tf.distribute.cluster_resolver.TPUClusterResolver.connect()
            strategy = tf.distribute.TPUStrategy(tpu)
        except ValueError:
    if device == 'GPU':
        strategy = tf.distribute.MirroredStrategy()
    return strategy
strategy = get_device(config['device'])
config['batch_size'] = config['batch_size'] * strategy.num_replicas_in_sync

train_ds = tf.data.Dataset.from_tensor_slices((X_train.spec_path.values, X_train.genre_id.values))
valid_ds = tf.data.Dataset.from_tensor_slices((X_valid.spec_path.values, X_valid.genre_id.values))

for path, label in train_ds.take(5):
    print('Path: {}, Label: {}'.format(path, label))