All Projects → dorukkarinca → keras-buoy

dorukkarinca / keras-buoy

Licence: MIT License
Keras wrapper that autosaves what ModelCheckpoint cannot.

Programming Languages

python
139335 projects - #7 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to keras-buoy

TFLite-ModelMaker-EfficientDet-Colab-Hands-On
TensorFlow Lite Model Makerで物体検出を行うハンズオン用資料です(Hands-on for object detection with TensorFlow Lite Model Maker)
Stars: ✭ 15 (-31.82%)
Mutual labels:  colab, colaboratory, colab-notebook
Torrent-To-Google-Drive-Downloader
Simple notebook to stream torrent files to Google Drive using Google Colab and python3.
Stars: ✭ 256 (+1063.64%)
Mutual labels:  colab, colaboratory, colab-notebook
steam-stylegan2
Train a StyleGAN2 model on Colaboratory to generate Steam banners.
Stars: ✭ 30 (+36.36%)
Mutual labels:  colab, colaboratory, colab-notebook
Tensorflow2-ObjectDetectionAPI-Colab-Hands-On
Tensorflow2 Object Detection APIのハンズオン用資料です(Hands-on documentation for the Tensorflow2 Object Detection API)
Stars: ✭ 33 (+50%)
Mutual labels:  colab, colaboratory, colab-notebook
video coloriser
Pytorch Convolutional Neural Net and GAN based video coloriser that converts black and white video to colorised video.
Stars: ✭ 29 (+31.82%)
Mutual labels:  colab, colab-notebook
ALPS 2021
XAI Tutorial for the Explainable AI track in the ALPS winter school 2021
Stars: ✭ 55 (+150%)
Mutual labels:  colab, colab-notebook
MineColab
Run Minecraft Server on Google Colab.
Stars: ✭ 135 (+513.64%)
Mutual labels:  colab, colab-notebook
MiXLab
MiXLab is a mix of multiple amazing Colab Notebooks found on the internet such as rcloneLab, RLabClone, Torrent to Google Drive Downloader and some more.
Stars: ✭ 143 (+550%)
Mutual labels:  colab
Handy
Convert videos with HandBrake online in Google Colab. Mount Cloud drives with rclone in colab. Burn/Hardcode subtitles. Extract/mute audio from video. Get email notification when tasks finish running.
Stars: ✭ 35 (+59.09%)
Mutual labels:  colab
colabs
This repository holds the Google Colabs for the EdX TinyML Specialization
Stars: ✭ 73 (+231.82%)
Mutual labels:  colab-notebook
picatrix
Picatrix is a library designed to help security analysts in a notebook environment, such as colab or jupyter.
Stars: ✭ 35 (+59.09%)
Mutual labels:  colab
swift-colab
Swift kernel for Google Colaboratory
Stars: ✭ 50 (+127.27%)
Mutual labels:  colab
GPim
Gaussian processes and Bayesian optimization for images and hyperspectral data
Stars: ✭ 29 (+31.82%)
Mutual labels:  colab-notebook
MIPT-Opt
A course on Optimization Methods
Stars: ✭ 128 (+481.82%)
Mutual labels:  colab
vue-auto-storage
🍻 An automatic storage plugin for Vue2, persist the data with localStorage.
Stars: ✭ 84 (+281.82%)
Mutual labels:  autosave
data-science-learning
📊 All of courses, assignments, exercises, mini-projects and books that I've done so far in the process of learning by myself Machine Learning and Data Science.
Stars: ✭ 32 (+45.45%)
Mutual labels:  colab
fastai-visual-guide
Notebooks for Fastai Viusal Guide
Stars: ✭ 25 (+13.64%)
Mutual labels:  colab
colab-badge-action
GitHub Action that generates "Open In Colab" Badges for you
Stars: ✭ 15 (-31.82%)
Mutual labels:  colab
clip playground
An ever-growing playground of notebooks showcasing CLIP's impressive zero-shot capabilities
Stars: ✭ 80 (+263.64%)
Mutual labels:  colab-notebook
ForecastGA
A Python tool to forecast Google Analytics data using several popular time series models.
Stars: ✭ 32 (+45.45%)
Mutual labels:  colab

keras-buoy

https://travis-ci.com/dorukkarinca/keras-buoy.svg?branch=master

Keras wrapper that autosaves and auto-recovers not just the model weights but also the last epoch number and training history metrics.

See it in action in this Colab notebook!

pip install keras-buoy

Description

When training is interrupted and you rerun the whole code, it recovers the model weights and the epoch counter to the last saved values. Then it resumes training as if nothing happened. At the end, the Keras History.history dictionaries are combined so that the training history looks like one single training run.

Example

>>> from tensorflow import keras
>>> from keras_buoy.models import ResumableModel

>>> model = keras.Sequential()
...
>>> resumable_model = ResumableModel(model,
                                     save_every_epochs=4,
                                     custom_objects=None,
                                     to_path='/path/to/save/model_weights.h5')
>>> history = resumable_model.fit(x=x_train,
                                  y=y_train,
                                  validation_split=0.1,
                                  batch_size=256,
                                  verbose=2,
                                  epochs=15)

Recovered model from kerascheckpoint.h5 at epoch 8.

Epoch 9/15
1125/1125 - 5s - loss: 0.4790 - top_k_categorical_accuracy: 0.9698 - val_loss: 1.1075 - val_top_k_categorical_accuracy: 0.9206
Epoch 10/15
1125/1125 - 5s - loss: 0.4758 - top_k_categorical_accuracy: 0.9701 - val_loss: 1.1119 - val_top_k_categorical_accuracy: 0.9214
Epoch 11/15
1125/1125 - 5s - loss: 0.4753 - top_k_categorical_accuracy: 0.9702 - val_loss: 1.1000 - val_top_k_categorical_accuracy: 0.9215
Epoch 12/15

Try it out yourself in this Colab notebook.

Docs

keras_buoy.models.ResumableModel

Creates a resumable model.

Parameters:

Parameter name Description
model (tf.keras.Model) The instance of tf.keras.Model which you want to make resumable.
save_every_epochs (int) Specifies how often to save the model, history, and epoch counter. In case of a crash, recovery will happen from the last saved epoch multiple.
custom_objects (dict) At recovery time, this is passed into tf.keras.models.load_model(...) exactly as shown in Tensorflow docs so you can load your model with a custom loss for example.
to_path (str) Specifies the path where the model weights will be saved. If it ends with .h5, then it saves in the Keras H5 format instead of the default TensorFlow SavedModel format.

If to_path is mymodel.h5, then there will be mymodel_epoch_num.pkl and mymodel_history.pkl in the same directory as mymodel.h5, which hold backups for the epoch counter and the history dict, respectively.

Returns:

A ResumableModel instance. You can call .fit(...) on it.




keras.buoy.models.ResumableModel.fit

Fits a resumable model.

Parameters:

The accepted parameters are the same as tf.Keras.model.fit(...) except you cannot specify initial_epoch.

Returns:

history (dict): The history dict of the Keras History object. Note that it does not return the Keras.History object itself, just the dict.

Note

This project has been set up using PyScaffold 3.2.3. For details and usage information on PyScaffold see https://pyscaffold.org/.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].