neurosis


Nameneurosis JSON
Version 0.1.3 PyPI version JSON
download
home_pageNone
SummaryA neural network trainer (for weebs)
upload_time2024-07-13 06:22:45
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseThe extensive modifications made to the original code are released/relicensed under: GNU General Public License v3 Copyright (c) 2023, Andi Powers-Holmes This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. --- In addition to the above, Andi-Powers Holmes grants the following additional permissions: Stability AI and its affiliates are granted a non-exclusive, worldwide, royalty-free, non-transferable, non-sublicensable, non-revocable license to use, reproduce, modify, and distribute the Software, and to permit persons to whom the Software is furnished to do so, subject to the conditions of the MIT License the original code was released under (see below). As a further note, should the GPLv3 license be found to be incompatible with the MIT License, the MIT License shall take precedence, and the GPLv3 license shall be considered null and void. Any person or entity who wishes to use this software in a manner not permitted by the above license(s) can contact Andi Powers-Holmes at the email address listed above (or open a GitHub issue) to negotiate a separate license agreement. Aside: In general I'm happy to hand out MIT licenses, but I'd like to keep track of who's using this so it doesn't get wrapped up in some proprietary for-profit software package without credit and without giving back to the community. --- Based upon code from Stability AI's [generative-models/sgm](https://github.com/Stability-AI/generative-models) repository, originally released under the following license: MIT License Copyright (c) 2023 Stability AI Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords deep-learning diffusers machine-learning neural-networks pytorch-lightning pytorch stable-diffusion transformers
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # neurosis

a neural network trainer for ~~weebs~~ diffusion models.

## OwO what's this?

I got sick and tired of trying to trace execution through the arcane codepaths of existing Stable Diffusion trainers, so I wrote my own.
This is based off the modeling/training code from [@Stability-AI/generative-models](https://github.com/Stability-AI/generative-models),
with *significant* modification for usability and readability.

## Features

Major changes from `generative-models` include:

- Architectural changes:
  - Migration to full PyTorch Lightning
  - LightningCLI trainer interface and configuration management (config file format is largely the same as `generative-models`, but with some minor differences in keywords)
  - Refactoring of some of the configuration code and model subclassing
  - "oops, all wandb" approach to logging (with some TensorBoard support as well)
- Trainer changes:
  - Use of PyTorch Lightning's `Trainer` class for training
  - Support for multiple GPUs (and multiple nodes, if you're into that)
  - Support for individual learning rates for the UNet and for each TE module
  - VAE training support! (kinda! discriminators are iffy but it works mostly)
- Module changes:
  - Rework of the `ImageLogger` to... sorta kinda work?
  - Adding support for `Adafactor` scheduler as well as the usual BitsAndBytes etc. ones
  - hey look tag frequency based loss scaling wonder where we got that one from :eyes:
  - Cleanup and refactoring of most modules to make them more readable and easier to trace execution
  - Probably more duplicated code than there really should be but here we are in this hell timeline
  - A huge pile of small changes too numerous to mention
- Dataset handling:
  - Support for Huggingface datasets (kinda! you're on your own but it should work if the keys match)
  - Shiny new ImageFolder datasets in "square", "square with captions", and "aspect-bucketed with captions" flavors
  - Support for custom datasets (see `neurosis/dataset/` for examples)
  - Funny hybrid mongo+s3 dataset we're using for large-scale training (stop judging me, it works)
  - Support for custom data transform functions injected into the dataset pipeline[^1]

[^1]: completely untested and not entirely pushed to public yet sry

## Installation

OK so first of all:

1. **Do Not.**

if you REALLY must, here:

```bash
git clone https://github.com/neggles/neurosis.git neurosis
cd neurosis
python3.10 -m venv .venv
source .venv/bin/activate
python -m pip install -U pip setuptools wheel setuptools-scm
python -m pip install -e '.[all]'
```

There is a docker container in GitHub packages, if you're feeling masochistic today.

Will also be throwing up Kubeflow manifest examples at some point (needs more testing)

## Usage

I am once again asking,

1. Please, *please just **Do Not***

but if the idea of arguing with my code and trying to figure shit out from incomplete outdated configuration templates
sounds attractive to you, by all means:

```bash
python -m neurosis.trainer.cli --help
```

If you need more assistance than that, this code is probably not ready for you to use yet.

### If you open an issue without providing liberal amounts of detail, logs, exactly what you tried, and exactly how it broke, you're going to get WONTFIX'd for the time being.

This will change as/if/when the code gets a bit more stable and usable.

## License

My own code is GPLv3, see [LICENSE.md](LICENSE.md)

A significant amount of code is copied from from [@Stability-AI/generative-models](https://github.com/Stability-AI/generative-models),which is MIT licensed and has been relicensed here under GPLv3 due to the extensive modifications.

Some code carries its own licenses (most notably LPIPS and Adafactor),
see the appropriate SPDX identifiers and LICENSE files in the relevant files' directories.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "neurosis",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "deep-learning, diffusers, machine-learning, neural-networks, pytorch-lightning, pytorch, stable-diffusion, transformers",
    "author": null,
    "author_email": "Andi Powers-Holmes <aholmes@omnom.net>",
    "download_url": "https://files.pythonhosted.org/packages/19/6d/3861d11cf71952a1d83e7ed9ac37408e06017c20e9bfc262b43880192099/neurosis-0.1.3.tar.gz",
    "platform": null,
    "description": "# neurosis\n\na neural network trainer for ~~weebs~~ diffusion models.\n\n## OwO what's this?\n\nI got sick and tired of trying to trace execution through the arcane codepaths of existing Stable Diffusion trainers, so I wrote my own.\nThis is based off the modeling/training code from [@Stability-AI/generative-models](https://github.com/Stability-AI/generative-models),\nwith *significant* modification for usability and readability.\n\n## Features\n\nMajor changes from `generative-models` include:\n\n- Architectural changes:\n  - Migration to full PyTorch Lightning\n  - LightningCLI trainer interface and configuration management (config file format is largely the same as `generative-models`, but with some minor differences in keywords)\n  - Refactoring of some of the configuration code and model subclassing\n  - \"oops, all wandb\" approach to logging (with some TensorBoard support as well)\n- Trainer changes:\n  - Use of PyTorch Lightning's `Trainer` class for training\n  - Support for multiple GPUs (and multiple nodes, if you're into that)\n  - Support for individual learning rates for the UNet and for each TE module\n  - VAE training support! (kinda! discriminators are iffy but it works mostly)\n- Module changes:\n  - Rework of the `ImageLogger` to... sorta kinda work?\n  - Adding support for `Adafactor` scheduler as well as the usual BitsAndBytes etc. ones\n  - hey look tag frequency based loss scaling wonder where we got that one from :eyes:\n  - Cleanup and refactoring of most modules to make them more readable and easier to trace execution\n  - Probably more duplicated code than there really should be but here we are in this hell timeline\n  - A huge pile of small changes too numerous to mention\n- Dataset handling:\n  - Support for Huggingface datasets (kinda! you're on your own but it should work if the keys match)\n  - Shiny new ImageFolder datasets in \"square\", \"square with captions\", and \"aspect-bucketed with captions\" flavors\n  - Support for custom datasets (see `neurosis/dataset/` for examples)\n  - Funny hybrid mongo+s3 dataset we're using for large-scale training (stop judging me, it works)\n  - Support for custom data transform functions injected into the dataset pipeline[^1]\n\n[^1]: completely untested and not entirely pushed to public yet sry\n\n## Installation\n\nOK so first of all:\n\n1. **Do Not.**\n\nif you REALLY must, here:\n\n```bash\ngit clone https://github.com/neggles/neurosis.git neurosis\ncd neurosis\npython3.10 -m venv .venv\nsource .venv/bin/activate\npython -m pip install -U pip setuptools wheel setuptools-scm\npython -m pip install -e '.[all]'\n```\n\nThere is a docker container in GitHub packages, if you're feeling masochistic today.\n\nWill also be throwing up Kubeflow manifest examples at some point (needs more testing)\n\n## Usage\n\nI am once again asking,\n\n1. Please, *please just **Do Not***\n\nbut if the idea of arguing with my code and trying to figure shit out from incomplete outdated configuration templates\nsounds attractive to you, by all means:\n\n```bash\npython -m neurosis.trainer.cli --help\n```\n\nIf you need more assistance than that, this code is probably not ready for you to use yet.\n\n### If you open an issue without providing liberal amounts of detail, logs, exactly what you tried, and exactly how it broke, you're going to get WONTFIX'd for the time being.\n\nThis will change as/if/when the code gets a bit more stable and usable.\n\n## License\n\nMy own code is GPLv3, see [LICENSE.md](LICENSE.md)\n\nA significant amount of code is copied from from [@Stability-AI/generative-models](https://github.com/Stability-AI/generative-models),which is MIT licensed and has been relicensed here under GPLv3 due to the extensive modifications.\n\nSome code carries its own licenses (most notably LPIPS and Adafactor),\nsee the appropriate SPDX identifiers and LICENSE files in the relevant files' directories.\n",
    "bugtrack_url": null,
    "license": "The extensive modifications made to the original code are released/relicensed under:  GNU General Public License v3  Copyright (c) 2023, Andi Powers-Holmes  This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.  This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.  You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.  ---  In addition to the above, Andi-Powers Holmes grants the following additional permissions:  Stability AI and its affiliates are granted a non-exclusive, worldwide, royalty-free, non-transferable, non-sublicensable, non-revocable license to use, reproduce, modify, and distribute the Software, and to permit persons to whom the Software is furnished to do so, subject to the conditions of the MIT License the original code was released under (see below).  As a further note, should the GPLv3 license be found to be incompatible with the MIT License, the MIT License shall take precedence, and the GPLv3 license shall be considered null and void.  Any person or entity who wishes to use this software in a manner not permitted by the above license(s) can contact Andi Powers-Holmes at the email address listed above (or open a GitHub issue) to negotiate a separate license agreement.  Aside: In general I'm happy to hand out MIT licenses, but I'd like to keep track of who's using this so it doesn't get wrapped up in some proprietary for-profit software package without credit and without giving back to the community.  ---  Based upon code from Stability AI's [generative-models/sgm](https://github.com/Stability-AI/generative-models) repository, originally released under the following license:  MIT License  Copyright (c) 2023 Stability AI  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "A neural network trainer (for weebs)",
    "version": "0.1.3",
    "project_urls": null,
    "split_keywords": [
        "deep-learning",
        " diffusers",
        " machine-learning",
        " neural-networks",
        " pytorch-lightning",
        " pytorch",
        " stable-diffusion",
        " transformers"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0ccb7b26f36fdf996d30d4266019d74c668afa1cf1ee057b3fb4e939ee6c4bea",
                "md5": "172b0a14179f0b857dfa2b9cde547999",
                "sha256": "ee100f3afee731eb49374f09cceb4b2e48c50b500474d860440a94b025cc8113"
            },
            "downloads": -1,
            "filename": "neurosis-0.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "172b0a14179f0b857dfa2b9cde547999",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 253125,
            "upload_time": "2024-07-13T06:22:44",
            "upload_time_iso_8601": "2024-07-13T06:22:44.161100Z",
            "url": "https://files.pythonhosted.org/packages/0c/cb/7b26f36fdf996d30d4266019d74c668afa1cf1ee057b3fb4e939ee6c4bea/neurosis-0.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "196d3861d11cf71952a1d83e7ed9ac37408e06017c20e9bfc262b43880192099",
                "md5": "c7c247a6ac64c79e87794ea5d75b1d10",
                "sha256": "15e2bae0c78e0bda63d1fd3bb5ddd2c6331ef8bb8d6e8fe76eba1be045d585d9"
            },
            "downloads": -1,
            "filename": "neurosis-0.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "c7c247a6ac64c79e87794ea5d75b1d10",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 209182,
            "upload_time": "2024-07-13T06:22:45",
            "upload_time_iso_8601": "2024-07-13T06:22:45.906540Z",
            "url": "https://files.pythonhosted.org/packages/19/6d/3861d11cf71952a1d83e7ed9ac37408e06017c20e9bfc262b43880192099/neurosis-0.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-13 06:22:45",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "neurosis"
}
        
Elapsed time: 0.31367s