Skip to content

Instantly share code, notes, and snippets.

@pythonlessons
Created September 4, 2023 15:04
Show Gist options
  • Save pythonlessons/46d80473990e390782b73248d195ebb5 to your computer and use it in GitHub Desktop.
Save pythonlessons/46d80473990e390782b73248d195ebb5 to your computer and use it in GitHub Desktop.
transformers_training
import numpy as np
import tensorflow as tf
try: [tf.config.experimental.set_memory_growth(gpu, True) for gpu in tf.config.experimental.list_physical_devices("GPU")]
except: pass
from keras.callbacks import EarlyStopping, ModelCheckpoint, ReduceLROnPlateau, TensorBoard
from mltu.tensorflow.callbacks import Model2onnx, WarmupCosineDecay
from mltu.tensorflow.dataProvider import DataProvider
from mltu.tokenizers import CustomTokenizer
from mltu.tensorflow.transformer.utils import MaskedAccuracy, MaskedLoss
from mltu.tensorflow.transformer.callbacks import EncDecSplitCallback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment