Skip to main content

tf-keras, make the average of model weight in same models

Project description

modelaverage

`modelaverage` is a pip package which make the average weight of model weight in `same models`, inspired by [Average weights in keras models](https://stackoverflow.com/questions/48212110/average-weights-in-keras-models). I created this pip package to use distributed computing environment like `kubernetes`.

Usage

  1. pip install modelaverage or git clone https://github.com/graykode/modelaverage && python setup.py install
  2. using function average(modellist)
    • modellist : list of model file names.
    • return : averaged weight model

Example

Please see example

import tensorflow as tf
from modelaverage import average

modellist = ['models/mnist1.h5', 'models/mnist2.h5', 'models/mnist3.h5', 'models/mnist4.h5', 'models/mnist5.h5',
             'models/mnist6.h5', 'models/mnist7.h5', 'models/mnist8.h5', 'models/mnist9.h5']

averaged_model = average(modellist)

for w in averaged_model.get_weights():
    print(w.shape)

Author

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for modelaverage, version 1.0.1
Filename, size File type Python version Upload date Hashes
Filename, size modelaverage-1.0.1-py3.6.egg (3.8 kB) File type Egg Python version 3.6 Upload date Hashes View
Filename, size modelaverage-1.0.1.tar.gz (2.1 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page