{ "info": { "author": "Timur Sokhin", "author_email": "qwinpin@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# NotifyKer\n\n*Notifier and manager bot for ML libraries: Keras and Chainer* \n\n### Features:\n\n\n\n- Get status of your training: epoch, metrics\n- Temporarily suspend training and then continue (for example, to free up the C(G)PU for another task (not the memory))\n- Interrupt training immediately\n- Get updates per epoch/batch with metrics\n- Set verbose level:\n - 0 - only completion message;\n - 1 - execution status per epoch\n - 2 - execution status per epoch with on-line metrics (like Keras default output) \n- Easy to build your own notifier and callback\n\n------\n\n### How to use\n\nSet TOKEN and PROXY while creating the instance of NotifierTelegramMenu or NotifierTelegram\n\n#### Chainer\n\n```python\nfrom notifyker import NotifierTelegramMenu\nfrom notifyker.chainer import ExtensionNotifierReport\n\nTOKEN = 'xxxx:yyy'\nPROXY = {\n 'proxy_url': 'socks5h://ip:port', \n 'urllib3_proxy_kwargs': {'username': 'username', 'password': 'password'}}\n\n# use NotifierTelegram in order to work without keyboard menu\nnfk = NotifierTelegramMenu(TOKEN=TOKEN, PROXY=PROXY)\nchainer_not = ExtensionNotifierReport(notifier=nfk)\n\n...\ntrainer.extend(chainer_not)\ntrainer.run()\n```\n\n\n\n#### Keras\n\n```python\nfrom notifyker import NotifierTelegramMenu\nfrom notifyker.keras import CallbackSimple\n\nTOKEN = 'xxxx:yyy'\nPROXY = {\n 'proxy_url': 'socks5h://ip:port', \n 'urllib3_proxy_kwargs': {'username': 'username', 'password': 'password'}}\n\n# use NotifierTelegram in order to work without keyboard menu\nnfk = NotifierTelegramMenu(TOKEN=TOKEN, PROXY=PROXY)\ncallback = CallbackSimple(notifier=nfk)\n\nmodel.fit(...\n\tcallbacks=[callback])\n```\n\nSet PROXY = None if not required\n\n### **Start**\n\nEnter */start* command to your telegram bot. Now it started and you receive update messages.\n\n\n\n### Menu\n\nEnter */menu* to open keyboard menu with following options:\n\n- Status - get the status of the last completed epoch\n\n\n\n------\n\n\n\n\n- Verbose - change verbose level or leave unchanged\n\n\n\nLevel 0:\n\n\n\nLevel 2:\n\n\n\n------\n\n\n\n- Pause - suspend training process (with option block on_batch_end callback method)\n\n\n\n------\n\n\n\n- Continue - continue suspended training process\n\n\n\n------\n\n\n\n- Interrupt - stop training and stop bot updates\n\n\n\n\n\n------\n\n\n\n### Commands\n\nAlso, you can use these commands directly by typing:\n\n- /status\n- /verbose - only get the current level of verbose (TODO: opportunity to change)\n- /pause\n- /continue\n- /interrupt\n- /help - get the description of commands|options\n\n\n\n### Your own notifier\n\nimport base class (NotifierBase or NotifierTelegram)\n\n```python\nfrom notifyker import NotifierTelegram\n```\n\nThen create your own class with inheritance and implement/reimplement methods. Note: if you add some new command - add it to handler\n\n```python\nfrom telegram.ext import CommandHandler # if required\n\n\nclass MyOwnNotifyker(NotifierTelegram):\n\tdef my_own_hello(self, bot, update):\n\t\t\"\"\"\n\t\tSend hello in reply\n\t\t\"\"\"\n\t\tself.updater.reply_text('Hello!')\n\n def handlers(self):\n super().handlers()\n self.updater.dispatcher.add_handler(CommandHandler('hello', self.my_own_hello))\n```\n\nThat's it!\n\n### Your own callback\n\nAlso, you can use your own callback in the same way. Let's say you want only to know when the training ends.\n\n```python\nimport time\n\nfrom notifyker import CallbackBase\n\n\nclass MyOwnCallback(CallbackBase):\n def on_training_end(self):\n end_time = time.ctime(int(time.time()))\n\n self.notifier.message('Training completed {} in {}'.format(tag, end_time))\n\n```\n\n### Register your own telegram bot\n\nIn order to create your own telegram bot - talk to t.me/botfather - this is official bot to... create bots.\n\n\n\nAlso, you'll get a TOKEN of your bot, that will be used in the Notifier latter. Click on the name of your bot and the chat will open with your bot. \n\nAlso, BotFather allows to manage bot profile image, description, privacy options, etc.\n\nOfficial introduction is here: https://core.telegram.org/bots\n\n### Notifier for TF\n\nIt is possible to use this for tensorflow, but you should add necessary functions in your tf code. Just create:\n\n```python\nnfk = NotifierTelegramMenu(TOKEN=TOKEN, PROXY=PROXY)\n```\n\nFor example, in order to implement pause, after your epoch add:\n\n```python\nif 'p' in nfk.flags_batch:\n self.notifier.flags_batch.remove('p')\n while 'c' not in nfk.flags_batch and 's' not in nfk.flags_batch:\n time.sleep(10)\n```\n\nYou can look at callbackNK/callback_simple.py to find more information about implementation.\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/qwinpin/notifyker", "keywords": "notifyker chainer keras telegram bot notification callback extentions", "license": "", "maintainer": "", "maintainer_email": "", "name": "notifyker", "package_url": "https://pypi.org/project/notifyker/", "platform": "", "project_url": "https://pypi.org/project/notifyker/", "project_urls": { "Homepage": "https://github.com/qwinpin/notifyker" }, "release_url": "https://pypi.org/project/notifyker/2.0.3/", "requires_dist": null, "requires_python": "", "summary": "Notifications for ML libraries (Keras, Chainer) using telegram bot", "version": "2.0.3" }, "last_serial": 4791427, "releases": { "2.0.2": [ { "comment_text": "", "digests": { "md5": "47ff555f09a6b6af69fcbf5549581557", "sha256": "2ce28d881579fcdcd6e8fb9ac909e1326c40f466e1ddb6b6e950982945673b1c" }, "downloads": -1, "filename": "notifyker-2.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "47ff555f09a6b6af69fcbf5549581557", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 12491, "upload_time": "2019-02-07T14:35:20", "url": "https://files.pythonhosted.org/packages/3e/26/3f615bb39ea1a1ab8bf650d2f26361118717691267e9b6f7447c247e93cf/notifyker-2.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6e30ae1c68233e8f6cffbb391a851a07", "sha256": "8660fb9a7560143396c02b2f4075c204961d1fcb121aa4779126bdcea52920a9" }, "downloads": -1, "filename": "notifyker-2.0.2.tar.gz", "has_sig": false, "md5_digest": "6e30ae1c68233e8f6cffbb391a851a07", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9694, "upload_time": "2019-02-07T14:35:22", "url": "https://files.pythonhosted.org/packages/1e/11/d9558521a0ecf473e5892ba72369df849fa122924e91ddf2f8529c99f350/notifyker-2.0.2.tar.gz" } ], "2.0.3": [ { "comment_text": "", "digests": { "md5": "147d6447c28650850001cc460d82960a", "sha256": "845dbe31bd2c6354b4d8ba007df363b5af909c0051d0206cbd117356ebbbcb1e" }, "downloads": -1, "filename": "notifyker-2.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "147d6447c28650850001cc460d82960a", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 12495, "upload_time": "2019-02-07T15:06:20", "url": "https://files.pythonhosted.org/packages/aa/af/750a3f9cc3c2413625c7d5918de4c9fb471cd2a13b47056dabe22089f84a/notifyker-2.0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7537a71fd7244b022360b0b4eaa4ba3d", "sha256": "c2d4e5fe25694b88d179d933aedd9bbfa0b82b5f45efa077cb14bc1a75609f58" }, "downloads": -1, "filename": "notifyker-2.0.3.tar.gz", "has_sig": false, "md5_digest": "7537a71fd7244b022360b0b4eaa4ba3d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9696, "upload_time": "2019-02-07T15:06:22", "url": "https://files.pythonhosted.org/packages/90/3f/7b4f9c15559959cde826a01ac8a8c4cadb088e16f2621f11e8d22a3c2167/notifyker-2.0.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "147d6447c28650850001cc460d82960a", "sha256": "845dbe31bd2c6354b4d8ba007df363b5af909c0051d0206cbd117356ebbbcb1e" }, "downloads": -1, "filename": "notifyker-2.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "147d6447c28650850001cc460d82960a", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 12495, "upload_time": "2019-02-07T15:06:20", "url": "https://files.pythonhosted.org/packages/aa/af/750a3f9cc3c2413625c7d5918de4c9fb471cd2a13b47056dabe22089f84a/notifyker-2.0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7537a71fd7244b022360b0b4eaa4ba3d", "sha256": "c2d4e5fe25694b88d179d933aedd9bbfa0b82b5f45efa077cb14bc1a75609f58" }, "downloads": -1, "filename": "notifyker-2.0.3.tar.gz", "has_sig": false, "md5_digest": "7537a71fd7244b022360b0b4eaa4ba3d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9696, "upload_time": "2019-02-07T15:06:22", "url": "https://files.pythonhosted.org/packages/90/3f/7b4f9c15559959cde826a01ac8a8c4cadb088e16f2621f11e8d22a3c2167/notifyker-2.0.3.tar.gz" } ] }