Skip to main content

APIs and tools to work with abstract "models" - files with numpy arrays and metadata. It is possible to publish models, list them. There is a built-in cache. Storage has backends.

Project description

# Modelforge [![Build Status](https://travis-ci.org/src-d/modelforge.svg)](https://travis-ci.org/src-d/modelforge) [![codecov](https://codecov.io/github/src-d/modelforge/coverage.svg)](https://codecov.io/gh/src-d/modelforge) [![PyPI](https://img.shields.io/pypi/v/modelforge.svg)](https://pypi.python.org/pypi/modelforge)

This project is the foundation for sharing machine learning models. It implements a git based index to maintain the registry, the remote storage where all model files are stored in a structured, cataloged way. It defines modelforge.Model, the base class for all the models which is capable of automatic fetching from the registry. It provides the abstraction over managing models on disk as well.

Each model receives a UUID and carries other metadata. The underlying file format is [ASDF](https://github.com/spacetelescope/asdf).

Currently, only one registry storage backend is supported: Google Cloud Storage. Our index is stored at [src-d/models](https://github.com/src-d/models).

[src-d/ml](https://github.com/src-d/ml) uses modelforge to make ML on source code accessible for everybody.

## Install

` pip3 install modelforge `

## Usage

The project exposes two interfaces: [API](doc/api.md) and [command line](doc/cmd.md).

#### Configuration

When using Modelforge, it is possible to store default values, whether you are using the package as an API or with the command line. To do so, simply create a modelforgecfg.py anywhere in your project tree or directly in the package, and modify the following values to suit your needs:

` VENDOR = "user" # name of the issuing vendor for models BACKEND = "gcs" # type of backend to use BACKEND_ARGS = "bucket='user_bucket.models',credentials='key.json'" # all backend arguments INDEX_REPO = "https://github.com/user/models" # git repo for the index CACHE_DIR = "~/.cache/modelforge" # default cache to use for the index ALWAYS_SIGNOFF = True # whether to add a DCO line on each commit message `

#### Docker image

` docker build -t srcd/modelforge . docker run -it --rm srcd/modelforge --help `

## Contributions [![PEP8](https://img.shields.io/badge/code%20style-pep8-orange.svg)](https://www.python.org/dev/peps/pep-0008/)

We use [PEP8](https://www.python.org/dev/peps/pep-0008/) with line length 99 and “. All the tests must pass:

` python3 -m unittest discover /path/to/modelforge `

If you wish to make your model available in [src-d/models](https://github.com/src-d/models), please clone the repository and use the publish command to upload your model on your fork, then, simply open a PR. If you are using your own backend, don’t forget to add read access to everybody. If you wish to publish the model our GCS bucket, feel free to open an issue to contact us.

## License

[Apache v2.0](LICENSE).

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

modelforge-0.9.2.tar.gz (24.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

modelforge-0.9.2-py3-none-any.whl (29.5 kB view details)

Uploaded Python 3

File details

Details for the file modelforge-0.9.2.tar.gz.

File metadata

  • Download URL: modelforge-0.9.2.tar.gz
  • Upload date:
  • Size: 24.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/3.7

File hashes

Hashes for modelforge-0.9.2.tar.gz
Algorithm Hash digest
SHA256 d7107924fce6a528c7f8267d77dca70bc0ea3a4d56f68721dd580b7490941664
MD5 1548f8242f883d8209614b8fefa7b4eb
BLAKE2b-256 d03464d5f49bc923cf930bea30d4f0ededabcb1262a0ca3aee0070fdcc3e3eb7

See more details on using hashes here.

File details

Details for the file modelforge-0.9.2-py3-none-any.whl.

File metadata

  • Download URL: modelforge-0.9.2-py3-none-any.whl
  • Upload date:
  • Size: 29.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.5.6

File hashes

Hashes for modelforge-0.9.2-py3-none-any.whl
Algorithm Hash digest
SHA256 fe6a63a319d48585c232c1f193c319e143e6697dcafe46837ed12faf577a5739
MD5 5d184cd2cf227856726a71ba7c3e203e
BLAKE2b-256 d9ea38ae702cd257b869514255ccc315f91cc0bf183b3db59f9bc25899050bcf

See more details on using hashes here.

Supported by

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