Skip to content

Instantly share code, notes, and snippets.

@saas-coder
Last active April 19, 2021 11:12
Show Gist options
  • Select an option

  • Save saas-coder/82b64a3c975fc772cd556c8012ec49d5 to your computer and use it in GitHub Desktop.

Select an option

Save saas-coder/82b64a3c975fc772cd556c8012ec49d5 to your computer and use it in GitHub Desktop.
# installation
!pip install knockknock #For sending message to telegram
# Importation
from knockknock import telegram_sender
from kaggle_secrets import UserSecretsClient
user_secrets = UserSecretsClient()
token = user_secrets.get_secret("token")
chat_id = user_secrets.get_secret("chat_id")
# Utilisation
@telegram_sender(token=token, chat_id=int(chat_id))
def train():
history = model.fit(
train_dataset,
epochs=EPOCHS,
callbacks=[lr_schedule],
steps_per_epoch=STEPS_PER_EPOCH,
validation_data=valid_dataset)
string = 'Train acc:{:.4f} Train loss:{:.4f},Val acc:{:.4f} Val loss:{:.4f}'.format( \
model.history.history['categorical_accuracy'][-1],model.history.history['loss'][-1],\
model.history.history['val_categorical_accuracy'][-1],model.history.history['val_loss'][-1])
return string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment