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.

Source Distribution

modelaverage-1.0.1.tar.gz (2.1 kB view details)

Uploaded Source

Built Distribution

modelaverage-1.0.1-py3.6.egg (3.8 kB view details)

Uploaded Source

File details

Details for the file modelaverage-1.0.1.tar.gz.

File metadata

  • Download URL: modelaverage-1.0.1.tar.gz
  • Upload date:
  • Size: 2.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7

File hashes

Hashes for modelaverage-1.0.1.tar.gz
Algorithm Hash digest
SHA256 5b54e0cc921ca015ae8139a2e8a71e5c9a9e7125859e13bdb89a9377d349ba7c
MD5 bf74212c07b1a77b248f83395c67c6c9
BLAKE2b-256 0707eb72d03b512eaa2a5179b004a833808ee9dde03d7ce616ff10901c81655f

See more details on using hashes here.

File details

Details for the file modelaverage-1.0.1-py3.6.egg.

File metadata

  • Download URL: modelaverage-1.0.1-py3.6.egg
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7

File hashes

Hashes for modelaverage-1.0.1-py3.6.egg
Algorithm Hash digest
SHA256 15c08790e040473874e1aa4c4585ffbccd879841318b4b43dd1bcc02b1b92ca7
MD5 2e3e7bee0a170342a756e34488cb592d
BLAKE2b-256 f2f13f984c0bcd6a865038df6bbcc6358e089bd5b2a13433070316e78b118405

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page