Registry / ai-ml / spandrel-extra-arches

spandrel-extra-arches

JSON →
library0.2.0pypypi✓ verified 83d ago

spandrel-extra-arches is a Python library that implements various PyTorch model architectures with restrictive licenses, designed to extend the capabilities of the core `spandrel` package. It enables `spandrel` to automatically detect and load models that might have non-commercial or other specific license requirements, segregating them from `spandrel`'s permissively licensed architectures. The current version is 0.2.0, released on September 15, 2024, and it is actively maintained and developed in conjunction with `spandrel`.

pip install spandrel-extra-arches
INSTALL
IMPORT
SIG · SPANDREL-EXTRA-ARC
S
spandrel-extra-arches
ai-mlpythonv0.2.0
Install
68.4s 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.2.0 · 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
✓ 78.88s
py 3.11
✕ build_error
✓ 72.08s
py 3.12
✕ build_error
✓ 64.25s
py 3.13
✕ build_error
✓ 58.58s
py 3.9
✕ build_error
✕ timeout
4890MB installed
● package 4890MB
Code
Verified usage

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

EXTRA_REGISTRY
from spandrel_extra_arches import EXTRA_REGISTRY
from spandrel_extra_arches.architectures.rcan.__arch.rcan import RCAN
architectures
from spandrel_extra_arches import architectures
install
from spandrel_extra_arches import install

This quickstart demonstrates how to use the `spandrel` library to load a model file, which would implicitly utilize the architectures provided by `spandrel-extra-arches` if one of its models is detected. The `spandrel` library handles the automatic detection and instantiation of the correct architecture.

import torch from spandrel import Spandrel # Ensure spandrel-extra-arches is installed (pip install spandrel-extra-arches) # spandrel will automatically discover architectures provided by spandrel-extra-arches # Example: Assuming you have a .pth model file for an architecture in spandrel-extra-arches # For demonstration, let's pretend 'my_extra_arch_model.pth' is an RCAN model. # In a real scenario, `spandrel.Spandrel()` would detect the architecture type. try: # This path would be to an actual model file model_path = 'my_extra_arch_model.pth' # Create a dummy model file for demonstration if it doesn't exist if not torch.exists(model_path): # This is a placeholder. A real model would be loaded from a file. # In practice, you'd download a .pth file for an extra arch model. print(f"[INFO] No model file found at {model_path}. Skipping model loading example.") print("[INFO] Please provide a valid .pth model file for an architecture supported by spandrel-extra-arches to run this part.") else: # Load the model using spandrel spandrel_model = Spandrel(model_path) print(f"Model loaded successfully: {spandrel_model.name} - {spandrel_model.arch_name}") # Example of getting the underlying PyTorch module pytorch_module = spandrel_model.model print(f"PyTorch module type: {type(pytorch_module)}") except Exception as e: print(f"An error occurred during model loading: {e}")
Debug
Known issues
gotchaMany architectures within `spandrel-extra-arches` are subject to restrictive licenses (e.g., non-commercial use only). Users engaging in commercial or closed-source projects MUST carefully review the individual licenses of each architecture they intend to use.
fix
Always check the license of specific architectures before use, especially for commercial or closed-source applications.
affects: All versions
breakingStarting with `spandrel` v0.4.0 (released alongside `spandrel-extra-arches` v0.2.0), all architectures now require keyword arguments for instantiation. Code that previously used positional arguments for initializing models might break.
fix
Update model instantiation calls to use keyword arguments exclusively, e.g., `MyArch(scale=2, channels=3)` instead of `MyArch(2, 3)`.
affects: spandrel-extra-arches >=0.2.0 (when used with spandrel >=0.4.0)
gotchaWhile `spandrel-extra-arches` itself specifies `requires_python: >=3.8`, the core `spandrel` library, which is a dependency and the primary interface, has recently dropped support for Python 3.8 and 3.9, now requiring Python >=3.10. Using `spandrel-extra-arches` with older Python versions (3.8, 3.9) might lead to incompatibility issues with `spandrel`.
fix
Ensure your Python environment is version 3.10 or newer when using `spandrel-extra-arches` with the latest `spandrel` package.
affects: spandrel-extra-arches <0.2.0 (if spandrel is updated), spandrel-extra-arches >=0.2.0 (if used with spandrel <0.4.0)
Upgrade
Version history
0.2.0latest on PyPI · released Sep 16, 2024
Audit
Dependencies
spandrelrequiredThis library extends spandrel with additional model architectures.
torchrequiredProvides PyTorch functionalities for the model architectures.
Agent activity
18 hits · last 30 days
node
14
Amazon
1
OpenAI (training)
1
Resources