scalable-softmax


Namescalable-softmax JSON
Version 0.1.1 PyPI version JSON
download
home_pageNone
SummaryPyTorch implementation of Scalable-Softmax for attention mechanisms
upload_time2025-02-08 22:49:20
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseMIT License Copyright (c) 2025 Greg DeVosNouri 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 pytorch deep-learning attention transformer
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # ScalableSoftmax

An unofficial PyTorch implementation of Scalable-Softmax (Ssmax) from the paper "Scalable-Softmax Is Superior for Attention" (Nakanishi, 2025).

## Overview

ScalableSoftmax is a drop-in replacement for standard Softmax that helps prevent attention fading in transformers by incorporating input size scaling. This helps maintain focused attention distributions even with large input sizes.

## Installation

```bash
pip install scalable-softmax
```

## Usage

```python
import torch
from scalable_softmax import ScalableSoftmax

# Initialize with default parameters
ssmax = ScalableSoftmax()

# Or customize parameters
ssmax = ScalableSoftmax(
    s=0.43,  # scaling parameter
    learn_scaling=True,  # make scaling parameter learnable
    bias=False  # whether to use bias term
)

# Apply to input tensor
x = torch.randn(batch_size, sequence_length)
output = ssmax(x)
```

## Features

- Drop-in replacement for standard softmax
- Learnable scaling parameter
- Optional bias term
- Maintains focused attention with large inputs

## Citation

```bibtex
@article{nakanishi2025scalable,
  title={Scalable-Softmax Is Superior for Attention},
  author={Nakanishi, Ken M.},
  journal={arXiv preprint arXiv:2501.19399},
  year={2025}
}
```

## License

MIT License

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "scalable-softmax",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "pytorch, deep-learning, attention, transformer",
    "author": null,
    "author_email": "Greg DeVosNouri <gdevos010@gamil.com>",
    "download_url": "https://files.pythonhosted.org/packages/2e/40/0936958cf4a4e2b6a643e7b0f3b7f72e7037e3fb37f8e85483a6fbfa588f/scalable_softmax-0.1.1.tar.gz",
    "platform": null,
    "description": "# ScalableSoftmax\n\nAn unofficial PyTorch implementation of Scalable-Softmax (Ssmax) from the paper \"Scalable-Softmax Is Superior for Attention\" (Nakanishi, 2025).\n\n## Overview\n\nScalableSoftmax is a drop-in replacement for standard Softmax that helps prevent attention fading in transformers by incorporating input size scaling. This helps maintain focused attention distributions even with large input sizes.\n\n## Installation\n\n```bash\npip install scalable-softmax\n```\n\n## Usage\n\n```python\nimport torch\nfrom scalable_softmax import ScalableSoftmax\n\n# Initialize with default parameters\nssmax = ScalableSoftmax()\n\n# Or customize parameters\nssmax = ScalableSoftmax(\n    s=0.43,  # scaling parameter\n    learn_scaling=True,  # make scaling parameter learnable\n    bias=False  # whether to use bias term\n)\n\n# Apply to input tensor\nx = torch.randn(batch_size, sequence_length)\noutput = ssmax(x)\n```\n\n## Features\n\n- Drop-in replacement for standard softmax\n- Learnable scaling parameter\n- Optional bias term\n- Maintains focused attention with large inputs\n\n## Citation\n\n```bibtex\n@article{nakanishi2025scalable,\n  title={Scalable-Softmax Is Superior for Attention},\n  author={Nakanishi, Ken M.},\n  journal={arXiv preprint arXiv:2501.19399},\n  year={2025}\n}\n```\n\n## License\n\nMIT License\n",
    "bugtrack_url": null,
    "license": "MIT License\n        \n        Copyright (c) 2025 Greg DeVosNouri\n        \n        Permission is hereby granted, free of charge, to any person obtaining a copy\n        of this software and associated documentation files (the \"Software\"), to deal\n        in the Software without restriction, including without limitation the rights\n        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n        copies of the Software, and to permit persons to whom the Software is\n        furnished to do so, subject to the following conditions:\n        \n        The above copyright notice and this permission notice shall be included in all\n        copies or substantial portions of the Software.\n        \n        THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n        SOFTWARE.",
    "summary": "PyTorch implementation of Scalable-Softmax for attention mechanisms",
    "version": "0.1.1",
    "project_urls": {
        "Homepage": "https://pypi.org/project/scalable-softmax/",
        "Repository": "https://github.com/gdevos010/Scalable-Softmax"
    },
    "split_keywords": [
        "pytorch",
        " deep-learning",
        " attention",
        " transformer"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "856f075eed4abc3abb5f597e8d8fe090d28d07c53cd118e8dd0c7fd69300fac8",
                "md5": "5a352fad9496dc8a1b0cfa6023c0e6ba",
                "sha256": "c257aa9e2634c924ab42dc1e204fd5f6ea66e64d5b1fbb35c4630878e3245b40"
            },
            "downloads": -1,
            "filename": "scalable_softmax-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5a352fad9496dc8a1b0cfa6023c0e6ba",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 4872,
            "upload_time": "2025-02-08T22:49:17",
            "upload_time_iso_8601": "2025-02-08T22:49:17.852636Z",
            "url": "https://files.pythonhosted.org/packages/85/6f/075eed4abc3abb5f597e8d8fe090d28d07c53cd118e8dd0c7fd69300fac8/scalable_softmax-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "2e400936958cf4a4e2b6a643e7b0f3b7f72e7037e3fb37f8e85483a6fbfa588f",
                "md5": "58d47e7648f0010526cef90b95f48358",
                "sha256": "0a8a0740ff5721cae8a45627f15ed54f41e8e9addb9de3b7ff2e5b31a00184e4"
            },
            "downloads": -1,
            "filename": "scalable_softmax-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "58d47e7648f0010526cef90b95f48358",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 3818,
            "upload_time": "2025-02-08T22:49:20",
            "upload_time_iso_8601": "2025-02-08T22:49:20.672129Z",
            "url": "https://files.pythonhosted.org/packages/2e/40/0936958cf4a4e2b6a643e7b0f3b7f72e7037e3fb37f8e85483a6fbfa588f/scalable_softmax-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-02-08 22:49:20",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "gdevos010",
    "github_project": "Scalable-Softmax",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "scalable-softmax"
}
        
Elapsed time: 0.41233s