{"id":13716783,"url":"https://github.com/szagoruyko/functional-zoo","last_synced_at":"2025-04-05T10:09:33.077Z","repository":{"id":80410297,"uuid":"78841620","full_name":"szagoruyko/functional-zoo","owner":"szagoruyko","description":"PyTorch and Tensorflow functional model definitions","archived":false,"fork":false,"pushed_at":"2018-02-01T13:16:17.000Z","size":1039,"stargazers_count":585,"open_issues_count":4,"forks_count":92,"subscribers_count":25,"default_branch":"master","last_synced_at":"2025-03-29T09:12:02.513Z","etag":null,"topics":["pretrained-models","pytorch","tensorflow"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/szagoruyko.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-01-13T10:57:07.000Z","updated_at":"2025-03-03T12:39:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"15ade7f7-ab60-465a-af32-ad59d745df2d","html_url":"https://github.com/szagoruyko/functional-zoo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/szagoruyko%2Ffunctional-zoo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/szagoruyko%2Ffunctional-zoo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/szagoruyko%2Ffunctional-zoo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/szagoruyko%2Ffunctional-zoo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/szagoruyko","download_url":"https://codeload.github.com/szagoruyko/functional-zoo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247318745,"owners_count":20919484,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["pretrained-models","pytorch","tensorflow"],"created_at":"2024-08-03T00:01:14.316Z","updated_at":"2025-04-05T10:09:33.057Z","avatar_url":"https://github.com/szagoruyko.png","language":"Jupyter Notebook","funding_links":[],"categories":["Pytorch \u0026 related libraries｜Pytorch \u0026 相关库","Pytorch \u0026 related libraries","Jupyter Notebook"],"sub_categories":["Other libraries｜其他库:","Other libraries:"],"readme":"functional-zoo\n==============\n\nModel definitions and pretrained weights for PyTorch and Tensorflow\n\nPyTorch, unlike lua torch, has autograd in it's core, so using modular\nstructure of `torch.nn` modules is not necessary, one can easily allocate\nneeded Variables and write a function that utilizes them, which is sometimes\nmore convenient. This repo contains model definitions in this functional way,\nwith pretrained weights for some models.\n\nWeights are serialized as a dict of arrays in `hdf5`, so should be easily\nloadable in other frameworks. Thanks to @edgarriba we have [cpp_parser](cpp_parser) for\nloading weights in C++.\n\nMore models coming! We also plan to add definitions for other frameworks\nin future, probably `tiny-dnn` first. Contributions are welcome.\n\nSee also imagenet classification with PyTorch [demo.ipynb](demo.ipynb)\n\n\n## Models\n\nAll models were validated to produce reported accuracy using\n[imagenet-validation.py](imagenet-validation.py) script (depends on\nOpenCV python bindings).\n\nTo load weights in Python first do `pip install hickle`, then:\n\n```python\nimport hickle as hkl\nweights = hkl.load('resnet-18-export.hkl')\n```\n\nUnfortunately, hickle py3 support is not yet ready, so the models will be resaved in torch pickle format with `torch.utils.model_zoo.load_url` support, e.g.:\n\n```python\nweights = model_zoo.load_url('https://s3.amazonaws.com/modelzoo-networks/wide-resnet-50-2-export-5ae25d50.pth')\n```\n\nAlso, `make_dot` was moved to a separate package: [PyTorchViz](https://github.com/szagoruyko/pytorchviz)\n\n### Folded\n\nModels below have batch_norm parameters and statistics folded into convolutional\nlayers for speed. It is not recommended to use them for finetuning.\n\n#### ImageNet\n\n| model | notebook | val error | download | size |\n|:------|:--------:|:--------:|:--------:|:----:|\n| VGG-16 | [vgg-16.ipynb](vgg-16.ipynb) | 30.09, 10.69 | url coming | 528 MB |\n| NIN | [nin-export.ipynb](nin-export.ipynb) | 32.96, 12.29 | [url](https://s3.amazonaws.com/pytorch/h5models/nin-export.hkl) | 33 MB |\n| ResNet-18 (fb) | [resnet-18-export.ipynb](resnet-18-export.ipynb) | 30.43, 10.76 | [url](https://s3.amazonaws.com/pytorch/h5models/resnet-18-export.hkl) | 42 MB |\n| ResNet-18-AT | [resnet-18-at-export.ipynb](resnet-18-at-export.ipynb) | 29.44, 10.12 | [url](https://www.dropbox.com/s/z092wmrgyqn4ys5/resnet-18-at-export.hkl?dl=0) | 44.1 MB |\n| ResNet-34 (fb) | [resnet-34-export.ipynb](resnet-34-export.ipynb) | 26.72, 8.74 | [url](https://s3.amazonaws.com/pytorch/h5models/resnet-34-export.hkl) | 78.3 MB |\n| WRN-50-2 | [wide-resnet-50-2-export.ipynb](wide-resnet-50-2-export.ipynb) | 22.0, 6.05 | [url](https://s3.amazonaws.com/pytorch/h5models/wide-resnet-50-2-export.hkl) | 246 MB |\n\n\n#### Fast Neural Style\n\nNotebook: [fast-neural-style.ipynb](fast-neural-style.ipynb)\n\nModels:\n\n| model | download | size |\n|:------|:--------:|:----:|\n| candy.hkl | [url](https://s3.amazonaws.com/pytorch/h5models/fast-neural-style/candy.hkl) | 7.1 MB |\n| feathers.hkl | [url](https://s3.amazonaws.com/pytorch/h5models/fast-neural-style/feathers.hkl) | 7.1 MB |\n| wave.hkl | [url](https://s3.amazonaws.com/pytorch/h5models/fast-neural-style/wave.hkl) | 7.1 MB |\n\n\n### Models with batch normalization\n\nComing\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fszagoruyko%2Ffunctional-zoo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fszagoruyko%2Ffunctional-zoo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fszagoruyko%2Ffunctional-zoo/lists"}