{ "info": { "author": "Yasha Bubnov", "author_email": "girokompass@gmail.com", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "License :: OSI Approved :: MIT License" ], "description": "# TensorCraft\n\n[![Build Status][BuildStatus]](https://travis-ci.org/netrack/tensorcraft)\n[![tensorcraft][SnapCraft]](https://snapcraft.io/tensorcraft)\n\nThe TensorCraft is a HTTP server that serves [Keras](https://github.com/keras-team/keras)\nmodels using TensorFlow runtime.\n\n_Currently TensorCraft is in beta, client and server API may change in the\nfuture versions_.\n\nThis server solves such problems as:\n\n* Versioning of models.\n* Warehousing of models.\n* Enabling CI/CD for machine-learning models.\n\n## Installation\n\n### Installation Using Snap\n\nThis is the recommended way to install `tensorcraft`. Simply run the following\ncommand:\n```bash\nsnap install tensorcraft --devmode --edge\nsnap start tensorcraft\n```\n\n### Installation Using Docker\n\nTensorCraft can be used as a Docker container. The major note on this approach is\nthat `tensorflow` library that is installed into the Docker image is not compiled\nwith support of AVX instructions or GPU.\n```bash\ndocker pull netrack/tensorcraft:latest\n```\n\nIn order to start the container, run the following command:\n```bash\ndocker run -it -p 5678:5678/tcp netrack/tensorcraft\n```\n\nYou can optinally specify volume to persist models between restarts of conatiner:\n```bash\ndocker run -it -p 5678:5678/tcp -v tensorcraft:/var/run/tensorcraft netrack/tensorcraft\n```\n\n### Installation Using PyPi\n\nInstall latest version from pypi repository.\n```bash\npip install tensorcraft\n```\n\n## Using TensorCraft\n\n### Keras Requirements\n\nOne of the possible ways of using `tensorcraft` is publising model snapshots to\nthe server on each epoch end.\n```py\nfrom keras.models import Sequential\nfrom keras.layers import Dense, Activation\nfrom tensorcraft.callbacks import ModelCheckpoint\n\nmodel = keras.Sequential()\nmodel.add(Dense(32, input_dim=784))\nmodel.add(Activation('relu'))\n\nmodel.compile(optimizer='sgd', loss='binary_crossentropy')\nmodel.fit(x_train, y_train, callbacks=[ModelCheckpoint(verbose=1)], epochs=100)\n```\n\nCurrently, `tensorcraft` supports only models in the TensorFlow Saved Model, therefore\nin order to publish Keras model, it must be saved as Saved Model at first.\n\nConsidering the following Keras model:\n```py\nfrom tensorflow import keras\nfrom tensorflow.keras import layers\n\ninputs = keras.Input(shape=(8,), name='digits')\nx = layers.Dense(4, activation='relu', name='dense_1')(inputs)\nx = layers.Dense(4, activation='relu', name='dense_2')(x)\noutputs = layers.Dense(2, activation='softmax', name='predictions')(x)\n\nmodel = keras.Model(inputs=inputs, outputs=outputs, name='3_layer_mlp')\n```\n\nSave it using the `export_saved_model` function from the 2.0 TensorFlow API:\n```py\nkeras.experimental.export_saved_model(model, \"3_layer_mlp\")\n```\n\n### Starting Server\n\nTo start server run `server` command:\n```sh\nsudo tensorcraft server\n```\n\nBy default it starts listening _unsecured_ port on localhost at `http://localhost:5678`.\n\nDefault configuration saves models to `/var/lib/tensorcraft` directory. Apart of\nthat server requires access to `/var/run` directory in order to save pid file\nthere.\n\n### Pushing New Model\n\nNote, both client and server of `tensorcraft` application share the same code\nbase. This implies the need to install a lot of server dependencies for a\nclient. This will be improved in uncoming versions.\n\nOnce model saved in directory, pack it using `tar` utility. For instance, this\nis how it will look like for `3_layer_mlp` model from the previous example:\n```sh\ntar -cf 3_layer_mlp.tar 3_layer_mlp\n```\n\nNow the model packed into the archive can be pushed to the server under the\narbitrary tag:\n```sh\ntensorcraft push --name 3_layer_mlp --tag 0.0.1 3_layer_mlp.tar\n```\n\n### Listing Available Models\n\nYou can list all available models on the server using the following command:\n```sh\ntensorcraft list\n```\n\nAfter the execution of `list` command you'll see to available models:\n```sh\n3_layer_mlp:0.0.1\n3_layer_mlp:latest\n```\n\nThis is the features of `tensorcraft` server, each published model name results in\ncreation of _model group_. Each model group has it's `latest` tag, that references\nthe _latest pushed model_.\n\n### Removing Model\n\nRemove of the unused model can be performed in using `remove` command:\n```sh\ntensorcraft remove --name 3_layer_mlp --tag 0.0.1\n```\n\nExecution of `remove` commands results in the remove of the model itself, and\nthe model group, when is is the last model in the group.\n\n### Using Model\n\nIn order to use the pushed model, `tensorcraft` exposes REST API. An example query\nto the server looks like this:\n```sh\ncurl -X POST https://localhost:5678/models/3_layer_mlp/0.0.1/predict -d \\\n '{\"x\": [[1.0, 2.1, 1.43, 4.43, 12.1, 3.2, 1.44, 2.3]]}'\n```\n\n# License\n\nThe code and docs are released under the [Apache 2.0 license](LICENSE).\n\n[BuildStatus]: https://travis-ci.org/netrack/tensorcraft.svg?branch=master\n[SnapCraft]: https://snapcraft.io/tensorcraft/badge.svg\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/netrack/tensorcraft", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "tensorcraft", "package_url": "https://pypi.org/project/tensorcraft/", "platform": "", "project_url": "https://pypi.org/project/tensorcraft/", "project_urls": { "Homepage": "https://github.com/netrack/tensorcraft" }, "release_url": "https://pypi.org/project/tensorcraft/0.0.1b5/", "requires_dist": [ "aiojobs (>=0.2.2)", "aiofiles (>=0.4.0)", "aiorwlock (>=0.6.0)", "aiohttp (>=3.5.4)", "flagparse (>=0.0.2)", "humanize (>=0.5.1)", "numpy (>=1.16.3)", "pid (>=2.2.3)", "pyyaml (>=5.1.1)", "semver (>=2.8.1)", "tensorflow (>=2.0.0a0)", "tinydb (>=3.13.0)" ], "requires_python": "", "summary": "TensorCraft is a server for Keras models", "version": "0.0.1b5" }, "last_serial": 6002657, "releases": { "0.0.1b1": [ { "comment_text": "", "digests": { "md5": "dba7fdf914b4974754d5ae26434318ff", "sha256": "28fb2ae031f3aa3ea61d2bea19885e3a9d8f22e94bea1d24ae3d71f0b8248a05" }, "downloads": -1, "filename": "tensorcraft-0.0.1b1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "dba7fdf914b4974754d5ae26434318ff", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 26110, "upload_time": "2019-07-11T11:42:03", "url": "https://files.pythonhosted.org/packages/27/f1/5d64cecbbd71f04765daa45cac9a2630df48789d93790edcbc35b37084f3/tensorcraft-0.0.1b1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6868c952697582775e2cd2d4ed630a6a", "sha256": "5379ab3c1845f513fa52b26342d7fcf03ee4f8e176cc1d87c743d238cc456805" }, "downloads": -1, "filename": "tensorcraft-0.0.1b1.tar.gz", "has_sig": false, "md5_digest": "6868c952697582775e2cd2d4ed630a6a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17677, "upload_time": "2019-07-11T11:42:06", "url": "https://files.pythonhosted.org/packages/12/45/a410150b6b401391628163fc5c9cece7def652ddb64a88a8e4f34eac7cd0/tensorcraft-0.0.1b1.tar.gz" } ], "0.0.1b2": [ { "comment_text": "", "digests": { "md5": "2cac3593e57d3d8d5f104c12c300b761", "sha256": "c4439755bf9c82ff5f6057f88b32b02f358800ab9c71da8b0dfb55026926b70e" }, "downloads": -1, "filename": "tensorcraft-0.0.1b2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "2cac3593e57d3d8d5f104c12c300b761", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 26565, "upload_time": "2019-07-13T17:46:55", "url": "https://files.pythonhosted.org/packages/63/ea/f2ffec90fdc593b174300de1ec8fcb074419c066210366ab144531df811a/tensorcraft-0.0.1b2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0b3fec3ff6b3d6697fc3e9af3acf122a", "sha256": "856c7de92e42aa10e8ed3c3400b21ab43099bad530a2c7ba4cde240bb6230855" }, "downloads": -1, "filename": "tensorcraft-0.0.1b2.tar.gz", "has_sig": false, "md5_digest": "0b3fec3ff6b3d6697fc3e9af3acf122a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18345, "upload_time": "2019-07-13T17:46:57", "url": "https://files.pythonhosted.org/packages/94/e5/9865605e45e22e283f7ff1efe025a41a2be1fc5a797e31b73aa1403d7609/tensorcraft-0.0.1b2.tar.gz" } ], "0.0.1b3": [ { "comment_text": "", "digests": { "md5": "3e42b70b98bedef73e2614dc20ac8736", "sha256": "8877863bce43cb5807ee5e5d3c3cbb99160d93abb3c4fa49e191be4b122b4daf" }, "downloads": -1, "filename": "tensorcraft-0.0.1b3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "3e42b70b98bedef73e2614dc20ac8736", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 26563, "upload_time": "2019-07-13T18:05:52", "url": "https://files.pythonhosted.org/packages/08/58/0511ac9b6f79b8cf7bd1d1097a0603a74f88634654ce45bf61afc50c8494/tensorcraft-0.0.1b3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5e4ffeb92ce539a216db1e3d0e9b2e3c", "sha256": "aa3de885f00861f0d125ff01e260d89c7f358bcefd876d2ce2192bf59e7eab9d" }, "downloads": -1, "filename": "tensorcraft-0.0.1b3.tar.gz", "has_sig": false, "md5_digest": "5e4ffeb92ce539a216db1e3d0e9b2e3c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18333, "upload_time": "2019-07-13T18:05:54", "url": "https://files.pythonhosted.org/packages/3a/18/98ad89a134283ba77d530affed18b6cc6e700e8e525325024ae0373837ca/tensorcraft-0.0.1b3.tar.gz" } ], "0.0.1b4": [ { "comment_text": "", "digests": { "md5": "ff52aa8b25afa749331b2a80ba9a8819", "sha256": "e2a6e7c7d35b71478b4078a670d7621e5ea5a5010ebced9852d58b4550718e80" }, "downloads": -1, "filename": "tensorcraft-0.0.1b4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "ff52aa8b25afa749331b2a80ba9a8819", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 25702, "upload_time": "2019-10-17T06:37:23", "url": "https://files.pythonhosted.org/packages/ba/24/c00076da9bbe9ccb1f454b0e66e4c7b214da23f8d956fd43b89d804735e2/tensorcraft-0.0.1b4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c8fd9d82b5a41586ce297c350af4db70", "sha256": "da885ad6bb732ffd524b4dd7218b386b36ca68fb94c5e4028f9934a05568c034" }, "downloads": -1, "filename": "tensorcraft-0.0.1b4.tar.gz", "has_sig": false, "md5_digest": "c8fd9d82b5a41586ce297c350af4db70", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17885, "upload_time": "2019-10-17T06:37:24", "url": "https://files.pythonhosted.org/packages/59/0c/b70078a2c905a30d10b04d21cc7b30f12756b4b29f20fb7102db0b4ead9f/tensorcraft-0.0.1b4.tar.gz" } ], "0.0.1b5": [ { "comment_text": "", "digests": { "md5": "4c6200724dee8eb4e54529fbb9d59b1c", "sha256": "b84bdc820ae03b18667ae439f168139011ac996a3e92ce571b6f6f471899028f" }, "downloads": -1, "filename": "tensorcraft-0.0.1b5-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "4c6200724dee8eb4e54529fbb9d59b1c", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 27419, "upload_time": "2019-10-20T11:17:17", "url": "https://files.pythonhosted.org/packages/34/57/2b0079f2b6a92555d4b15d3906983ed72d12aee7b3977c133c8d6a5d70b6/tensorcraft-0.0.1b5-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "feb6be52ab8641a4461bf126547bf179", "sha256": "686c6512aec9b7c97ef46bbf895f86f51223de1a4a666aeb72ca0caa3271359e" }, "downloads": -1, "filename": "tensorcraft-0.0.1b5.tar.gz", "has_sig": false, "md5_digest": "feb6be52ab8641a4461bf126547bf179", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19031, "upload_time": "2019-10-20T11:17:18", "url": "https://files.pythonhosted.org/packages/89/25/2f2b4e98059946233652f6178ddf2b92b8c9fd3fb3e77c5c68895c33f26d/tensorcraft-0.0.1b5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "4c6200724dee8eb4e54529fbb9d59b1c", "sha256": "b84bdc820ae03b18667ae439f168139011ac996a3e92ce571b6f6f471899028f" }, "downloads": -1, "filename": "tensorcraft-0.0.1b5-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "4c6200724dee8eb4e54529fbb9d59b1c", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 27419, "upload_time": "2019-10-20T11:17:17", "url": "https://files.pythonhosted.org/packages/34/57/2b0079f2b6a92555d4b15d3906983ed72d12aee7b3977c133c8d6a5d70b6/tensorcraft-0.0.1b5-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "feb6be52ab8641a4461bf126547bf179", "sha256": "686c6512aec9b7c97ef46bbf895f86f51223de1a4a666aeb72ca0caa3271359e" }, "downloads": -1, "filename": "tensorcraft-0.0.1b5.tar.gz", "has_sig": false, "md5_digest": "feb6be52ab8641a4461bf126547bf179", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19031, "upload_time": "2019-10-20T11:17:18", "url": "https://files.pythonhosted.org/packages/89/25/2f2b4e98059946233652f6178ddf2b92b8c9fd3fb3e77c5c68895c33f26d/tensorcraft-0.0.1b5.tar.gz" } ] }