Skip to content

Instantly share code, notes, and snippets.

@JesperDramsch
Created March 27, 2018 07:40
Show Gist options
  • Save JesperDramsch/606f7df42c41cac8d3435439cecae6e8 to your computer and use it in GitHub Desktop.
Save JesperDramsch/606f7df42c41cac8d3435439cecae6e8 to your computer and use it in GitHub Desktop.
Small script to add keras push notifications to Telegram.
import telegram_send
telegram_send.configure('~/.telegram/.conf')
class TelegramCallback(keras.callbacks.Callback):
def on_train_begin(self, logs={}):
telegram_send.send(["Starting Training"])
def on_train_end(self, logs={}):
telegram_send.send(["Training Finished"])
def on_batch_end(self, batch, logs={}):
telegram_send.send(["Loss: {:.8f} | Metrics: {:.5f}".format(logs.get('loss'),logs.get('acc'))])
model.fit(x_train,y_train,epochs=epochs, verbose=0, callbacks=[TelegramCallback()])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment