Name | HRM-pytorch JSON |
Version |
0.1.1
JSON |
| download |
home_page | None |
Summary | The proposal from a Singaporean AGI company |
upload_time | 2025-07-30 18:40:46 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.9 |
license | MIT License
Copyright (c) 2025 Phil Wang
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 |
adaptive computation time
artificial intelligence
deep learning
fast slow thinking
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
<img src="./fig4.png" width="250px"></img>
## Hierarchical Reasoning Model (wip)
Explorations into the proposed recurrent [hierarchical reasoning model](https://arxiv.org/abs/2506.21734) by Wang et al. from [Sapient Intelligence](https://www.sapient.inc/). Official repository is [here](https://github.com/sapientinc/HRM)
### Install
```bash
$ pip install HRM-pytorch
```
### Usage
```python
import torch
from HRM import HRM
hrm = HRM(
networks = [
dict(
dim = 32,
depth = 2,
attn_dim_head = 8,
heads = 1,
use_rmsnorm = True,
rotary_pos_emb = True,
pre_norm = False
),
dict(
dim = 32,
depth = 4,
attn_dim_head = 8,
heads = 1,
use_rmsnorm = True,
rotary_pos_emb = True,
pre_norm = False
)
],
num_tokens = 256,
dim = 32,
reasoning_steps = 10
)
seq = torch.randint(0, 256, (3, 1024))
labels = torch.randint(0, 256, (3, 1024))
loss, hiddens, _ = hrm(seq, labels = labels)
loss.backward()
loss, hiddens, _ = hrm(seq, hiddens = hiddens, labels = labels)
loss.backward()
# after much training
pred = hrm(seq, reasoning_steps = 5)
```
## Citations
```bibtex
@misc{wang2025hierarchicalreasoningmodel,
title = {Hierarchical Reasoning Model},
author = {Guan Wang and Jin Li and Yuhao Sun and Xing Chen and Changling Liu and Yue Wu and Meng Lu and Sen Song and Yasin Abbasi Yadkori},
year = {2025},
eprint = {2506.21734},
archivePrefix = {arXiv},
primaryClass = {cs.AI},
url = {https://arxiv.org/abs/2506.21734},
}
```
Raw data
{
"_id": null,
"home_page": null,
"name": "HRM-pytorch",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "adaptive computation time, artificial intelligence, deep learning, fast slow thinking",
"author": null,
"author_email": "Phil Wang <lucidrains@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/21/63/0bf713b2f3b5d3ce723d475dfee62374ef32aea72d2b4722c37a890e266d/hrm_pytorch-0.1.1.tar.gz",
"platform": null,
"description": "<img src=\"./fig4.png\" width=\"250px\"></img>\n\n## Hierarchical Reasoning Model (wip)\n\nExplorations into the proposed recurrent [hierarchical reasoning model](https://arxiv.org/abs/2506.21734) by Wang et al. from [Sapient Intelligence](https://www.sapient.inc/). Official repository is [here](https://github.com/sapientinc/HRM)\n\n### Install\n\n```bash\n$ pip install HRM-pytorch\n```\n\n### Usage\n\n```python\nimport torch\nfrom HRM import HRM\n\nhrm = HRM(\n networks = [\n dict(\n dim = 32,\n depth = 2,\n attn_dim_head = 8,\n heads = 1,\n use_rmsnorm = True,\n rotary_pos_emb = True,\n pre_norm = False\n ),\n dict(\n dim = 32,\n depth = 4,\n attn_dim_head = 8,\n heads = 1,\n use_rmsnorm = True,\n rotary_pos_emb = True,\n pre_norm = False\n )\n ],\n num_tokens = 256,\n dim = 32,\n reasoning_steps = 10\n)\n\nseq = torch.randint(0, 256, (3, 1024))\nlabels = torch.randint(0, 256, (3, 1024))\n\nloss, hiddens, _ = hrm(seq, labels = labels)\nloss.backward()\n\nloss, hiddens, _ = hrm(seq, hiddens = hiddens, labels = labels)\nloss.backward()\n\n# after much training\n\npred = hrm(seq, reasoning_steps = 5)\n```\n\n## Citations\n\n```bibtex\n@misc{wang2025hierarchicalreasoningmodel,\n title = {Hierarchical Reasoning Model},\n author = {Guan Wang and Jin Li and Yuhao Sun and Xing Chen and Changling Liu and Yue Wu and Meng Lu and Sen Song and Yasin Abbasi Yadkori},\n year = {2025},\n eprint = {2506.21734},\n archivePrefix = {arXiv},\n primaryClass = {cs.AI},\n url = {https://arxiv.org/abs/2506.21734},\n}\n```\n",
"bugtrack_url": null,
"license": "MIT License\n \n Copyright (c) 2025 Phil Wang\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": "The proposal from a Singaporean AGI company",
"version": "0.1.1",
"project_urls": {
"Homepage": "https://pypi.org/project/HRM-pytorch/",
"Repository": "https://github.com/lucidrains/hrm"
},
"split_keywords": [
"adaptive computation time",
" artificial intelligence",
" deep learning",
" fast slow thinking"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "efe0acdd7b2f38fce263ac4bafde7b1eef95c8bb7e5e6443dc02611564d311e8",
"md5": "a2d040c3462f8f6f79f65dc96d2ef733",
"sha256": "6784ef64c79d772eb5a97e600617421d3c59204bd74042223cf9c196131d037e"
},
"downloads": -1,
"filename": "hrm_pytorch-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a2d040c3462f8f6f79f65dc96d2ef733",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 9667,
"upload_time": "2025-07-30T18:40:45",
"upload_time_iso_8601": "2025-07-30T18:40:45.025212Z",
"url": "https://files.pythonhosted.org/packages/ef/e0/acdd7b2f38fce263ac4bafde7b1eef95c8bb7e5e6443dc02611564d311e8/hrm_pytorch-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "21630bf713b2f3b5d3ce723d475dfee62374ef32aea72d2b4722c37a890e266d",
"md5": "0ce9099c9ee39c5efd7612de0a3966e2",
"sha256": "2a4ca53fd631871662bb23051c603dd7ac2850b0138af39ed641e7a07604718e"
},
"downloads": -1,
"filename": "hrm_pytorch-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "0ce9099c9ee39c5efd7612de0a3966e2",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 194377,
"upload_time": "2025-07-30T18:40:46",
"upload_time_iso_8601": "2025-07-30T18:40:46.563034Z",
"url": "https://files.pythonhosted.org/packages/21/63/0bf713b2f3b5d3ce723d475dfee62374ef32aea72d2b4722c37a890e266d/hrm_pytorch-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-30 18:40:46",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "lucidrains",
"github_project": "hrm",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "hrm-pytorch"
}