hf-torrents


Namehf-torrents JSON
Version 0.0.1.post2311281817 PyPI version JSON
download
home_pagehttps://github.com/Lyken17/
SummaryA simple placeholder
upload_time2023-11-28 10:17:30
maintainer
docs_urlNone
authorLigeng Zhu
requires_python
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # THOP: PyTorch-OpCounter

## How to install 
    
`pip install thop` (now continously intergrated on [Github actions](https://github.com/features/actions))

OR

`pip install --upgrade git+https://github.com/Lyken17/pytorch-OpCounter.git`
    
## How to use 
* Basic usage 
    ```python
    from torchvision.models import resnet50
    from thop import profile
    model = resnet50()
    input = torch.randn(1, 3, 224, 224)
    macs, params = profile(model, inputs=(input, ))
    ```    

* Define the rule for 3rd party module.
    ```python
    class YourModule(nn.Module):
        # your definition
    def count_your_model(model, x, y):
        # your rule here
    
    input = torch.randn(1, 3, 224, 224)
    macs, params = profile(model, inputs=(input, ), 
                            custom_ops={YourModule: count_your_model})
    ```
    
* Improve the output readability

    Call `thop.clever_format` to give a better format of the output.
    ```python
    from thop import clever_format
    macs, params = clever_format([macs, params], "%.3f")
    ```    
    
## Results of Recent Models

The implementation are adapted from `torchvision`. Following results can be obtained using [benchmark/evaluate_famous_models.py](benchmark/evaluate_famous_models.py).

<p align="center">
<table>
<tr>
<td>

Model | Params(M) | MACs(G)
---|---|---
alexnet | 61.10 | 0.77
vgg11 | 132.86 | 7.74
vgg11_bn | 132.87 | 7.77
vgg13 | 133.05 | 11.44
vgg13_bn | 133.05 | 11.49
vgg16 | 138.36 | 15.61
vgg16_bn | 138.37 | 15.66
vgg19 | 143.67 | 19.77
vgg19_bn | 143.68 | 19.83
resnet18 | 11.69 | 1.82
resnet34 | 21.80 | 3.68
resnet50 | 25.56 | 4.14
resnet101 | 44.55 | 7.87
resnet152 | 60.19 | 11.61
wide_resnet101_2 | 126.89 | 22.84
wide_resnet50_2 | 68.88 | 11.46

</td>
<td>

Model | Params(M) | MACs(G)
---|---|---
resnext50_32x4d | 25.03 | 4.29
resnext101_32x8d | 88.79 | 16.54
densenet121 | 7.98 | 2.90
densenet161 | 28.68 | 7.85
densenet169 | 14.15 | 3.44
densenet201 | 20.01 | 4.39
squeezenet1_0 | 1.25 | 0.82
squeezenet1_1 | 1.24 | 0.35
mnasnet0_5 | 2.22 | 0.14
mnasnet0_75 | 3.17 | 0.24
mnasnet1_0 | 4.38 | 0.34
mnasnet1_3 | 6.28 | 0.53
mobilenet_v2 | 3.50 | 0.33
shufflenet_v2_x0_5 | 1.37 | 0.05
shufflenet_v2_x1_0 | 2.28 | 0.15
shufflenet_v2_x1_5 | 3.50 | 0.31
shufflenet_v2_x2_0 | 7.39 | 0.60
inception_v3 | 27.16 | 5.75

</td>
</tr>
</p>



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Lyken17/",
    "name": "hf-torrents",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Ligeng Zhu",
    "author_email": "ligeng.zhu+github@gmail.com",
    "download_url": "",
    "platform": null,
    "description": "# THOP: PyTorch-OpCounter\n\n## How to install \n    \n`pip install thop` (now continously intergrated on [Github actions](https://github.com/features/actions))\n\nOR\n\n`pip install --upgrade git+https://github.com/Lyken17/pytorch-OpCounter.git`\n    \n## How to use \n* Basic usage \n    ```python\n    from torchvision.models import resnet50\n    from thop import profile\n    model = resnet50()\n    input = torch.randn(1, 3, 224, 224)\n    macs, params = profile(model, inputs=(input, ))\n    ```    \n\n* Define the rule for 3rd party module.\n    ```python\n    class YourModule(nn.Module):\n        # your definition\n    def count_your_model(model, x, y):\n        # your rule here\n    \n    input = torch.randn(1, 3, 224, 224)\n    macs, params = profile(model, inputs=(input, ), \n                            custom_ops={YourModule: count_your_model})\n    ```\n    \n* Improve the output readability\n\n    Call `thop.clever_format` to give a better format of the output.\n    ```python\n    from thop import clever_format\n    macs, params = clever_format([macs, params], \"%.3f\")\n    ```    \n    \n## Results of Recent Models\n\nThe implementation are adapted from `torchvision`. Following results can be obtained using [benchmark/evaluate_famous_models.py](benchmark/evaluate_famous_models.py).\n\n<p align=\"center\">\n<table>\n<tr>\n<td>\n\nModel | Params(M) | MACs(G)\n---|---|---\nalexnet | 61.10 | 0.77\nvgg11 | 132.86 | 7.74\nvgg11_bn | 132.87 | 7.77\nvgg13 | 133.05 | 11.44\nvgg13_bn | 133.05 | 11.49\nvgg16 | 138.36 | 15.61\nvgg16_bn | 138.37 | 15.66\nvgg19 | 143.67 | 19.77\nvgg19_bn | 143.68 | 19.83\nresnet18 | 11.69 | 1.82\nresnet34 | 21.80 | 3.68\nresnet50 | 25.56 | 4.14\nresnet101 | 44.55 | 7.87\nresnet152 | 60.19 | 11.61\nwide_resnet101_2 | 126.89 | 22.84\nwide_resnet50_2 | 68.88 | 11.46\n\n</td>\n<td>\n\nModel | Params(M) | MACs(G)\n---|---|---\nresnext50_32x4d | 25.03 | 4.29\nresnext101_32x8d | 88.79 | 16.54\ndensenet121 | 7.98 | 2.90\ndensenet161 | 28.68 | 7.85\ndensenet169 | 14.15 | 3.44\ndensenet201 | 20.01 | 4.39\nsqueezenet1_0 | 1.25 | 0.82\nsqueezenet1_1 | 1.24 | 0.35\nmnasnet0_5 | 2.22 | 0.14\nmnasnet0_75 | 3.17 | 0.24\nmnasnet1_0 | 4.38 | 0.34\nmnasnet1_3 | 6.28 | 0.53\nmobilenet_v2 | 3.50 | 0.33\nshufflenet_v2_x0_5 | 1.37 | 0.05\nshufflenet_v2_x1_0 | 2.28 | 0.15\nshufflenet_v2_x1_5 | 3.50 | 0.31\nshufflenet_v2_x2_0 | 7.39 | 0.60\ninception_v3 | 27.16 | 5.75\n\n</td>\n</tr>\n</p>\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A simple placeholder",
    "version": "0.0.1.post2311281817",
    "project_urls": {
        "Homepage": "https://github.com/Lyken17/"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a1bd14d07623ce3d30b628744f0b08eaf3f9b8dd7b20db66d55534c8b3c99071",
                "md5": "2acfe76ebf4cca94aad3980b06725114",
                "sha256": "fff313c7d29595688dcb1b23bb30ac6713fde0e89673dfa0bdc8aaa89b86a5c4"
            },
            "downloads": -1,
            "filename": "hf_torrents-0.0.1.post2311281817-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2acfe76ebf4cca94aad3980b06725114",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 15551,
            "upload_time": "2023-11-28T10:17:30",
            "upload_time_iso_8601": "2023-11-28T10:17:30.908800Z",
            "url": "https://files.pythonhosted.org/packages/a1/bd/14d07623ce3d30b628744f0b08eaf3f9b8dd7b20db66d55534c8b3c99071/hf_torrents-0.0.1.post2311281817-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-28 10:17:30",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "hf-torrents"
}
        
Elapsed time: 0.34948s