torchsr is a Python library providing a collection of Super Resolution (SR) network architectures implemented in PyTorch. It includes popular models like EDSR, RCAN, and NinaSR variants, often with pretrained weights, to easily integrate SR capabilities into deep learning projects. The current version is 1.0.4, with releases focusing on model improvements, new architectures, and compatibility.
pip install torchsrVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to load a pretrained Super Resolution model (EDSR in this case) from `torchsr.models`, move it to the appropriate device, and perform inference on a dummy input tensor. The output shape confirms the upscale factor applied by the model.
If encountering errors with pretrained weights, try updating your PyTorch version or explicitly instantiating the model without `pretrained=True` to rule out compatibility issues with weights.
Consult the `torchsr` documentation or repository for available models and their supported scales/pretrained weights. Alternatively, set `pretrained=False` to use an untrained model.
Ensure both your model and your input tensors are explicitly moved to the same device using `.to(device)` (e.g., `model.to('cuda')`, `input_tensor.to('cuda')`).Move both the model and your input tensor to the same device using `.to(device)`. For example: `device = 'cuda' if torch.cuda.is_available() else 'cpu'; model = model.to(device); input_tensor = input_tensor.to(device)`.
Double-check the exact model name from the `torchsr` documentation or by inspecting the available models (e.g., `print(dir(torchsr.models))`). Ensure the name matches precisely.
Verify that pretrained weights exist for your chosen model and scale combination by checking the `torchsr` documentation. If not available, you can instantiate the model without pretrained weights by setting `pretrained=False`, or choose a different model/scale combination.