Registry / ai-ml / pretrainedmodels

pretrainedmodels

JSON →
library0.7.4pypypiunverified

A library providing pretrained models for PyTorch, including architectures like ResNet, DenseNet, Inception, and more. Version 0.7.4 is the latest release, though the project is in maintenance mode with infrequent updates. It is commonly used for transfer learning and feature extraction, but users should prefer torchvision's model zoo for active support.

pip install pretrainedmodels
INSTALL
IMPORT
SIG · PRETRAINEDMODELS
P
pretrainedmodels
ai-mlpythonv0.7.4
Install
70.7s avg
Import
Disk
4890MB
Pass rate
4/ 10
Env Coverage4 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.7.4 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✕ build_error
✓ 82.9s
py 3.11
✕ build_error
✓ 76.7s
py 3.12
✕ build_error
✓ 63.4s
py 3.13
✕ build_error
✓ 59.9s
py 3.9
✕ build_error
✕ timeout
4890MB installed
● package 4890MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

pretrainedmodels
import pretrainedmodels
from pretrainedmodels import ...
Direct import is fine, but common mistake is to import submodules incorrectly; use pretrainedmodels.__dict__ to list models.
models
from pretrainedmodels import models
To access model constructors like models.resnet101()

Load a pretrained ResNet-101 model and run inference.

import torch import pretrainedmodels model = pretrainedmodels.__dict__['resnet101'](pretrained='imagenet') model.eval() print(model) # Example inference from pretrainedmodels import utils import torchvision.transforms as transforms tf = utils.TransformImage(model) input_tensor = torch.randn(1, 3, 224, 224) out = model(input_tensor) print(out.shape)
Debug
Known issues
deprecatedpretrainedmodels is in maintenance mode; many models are outdated and may not work with newer PyTorch versions. Prefer torchvision's model zoo or timm.
fix
Switch to torchvision.models or the timm library.
affects: >=0.7.0
gotchaThe pretrained='imagenet' argument may fail silently if checkpoint not found. Always verify the model downloads correctly.
fix
Check network connectivity or manually download pretrained weights from the official repository.
affects: all
gotchaModel input sizes vary; not all models accept 224x224 images. Use utils.TransformImage to get the correct preprocessing.
fix
Always use pretrainedmodels.utils.TransformImage(model) to get the right transforms.
affects: all
breakingPyTorch 1.9+ may cause compatibility issues with older model definitions. You may see AttributeError: module 'torch' has no attribute 'irfft'.
fix
Use torchvision or timm instead. Or pin PyTorch to 1.8.x.
affects: 0.7.4 with PyTorch >=1.9
Upgrade
Version history
0.7.4latest on PyPI · released Oct 29, 2018
Audit
Dependencies
torchrequiredCore dependency for all models and operations
torchvisionoptionalRequired for some model definitions and transforms (e.g., pretrainedmodels.utils)
Agent activity
4 hits · last 30 days
node
4
Resources
pretrainedmodels — pip install pretrainedmodels · libregistry