Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file removed models/denoise-nafnet/.skip
Empty file.
5 changes: 4 additions & 1 deletion models/denoise-nafnet/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ def load_nafnet_model(config_path, checkpoint_path):
dec_blk_nums=network_g.get('dec_blk_nums', [2, 2, 2, 2])
)

checkpoint = torch.load(checkpoint_path, map_location='cpu')
# weights_only=False: PyTorch 2.6 flipped this default to True, which
# rejects the NAFNet checkpoint (it pickles non-tensor objects). The
# checkpoint is a trusted file we ship, so full unpickling is safe.
checkpoint = torch.load(checkpoint_path, map_location='cpu', weights_only=False)
if 'params' in checkpoint:
state_dict = checkpoint['params']
elif 'params_ema' in checkpoint:
Expand Down
5 changes: 4 additions & 1 deletion models/mask-object-segnext-b2hq/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,10 @@ def to_numpy(tensor):

def load_segnext_model(checkpoint_path):
"""Load SegNext model from checkpoint."""
state_dict = torch.load(checkpoint_path, map_location="cpu")
# weights_only=False: checkpoint stores a non-tensor "config" object
# alongside the weights, which PyTorch 2.6's weights_only=True default
# rejects. Trusted file we ship, so full unpickling is safe.
state_dict = torch.load(checkpoint_path, map_location="cpu", weights_only=False)
model = load_model(state_dict["config"])
model.load_state_dict(state_dict["state_dict"], strict=True)
for param in model.parameters():
Expand Down
5 changes: 4 additions & 1 deletion models/upscale-bsrgan/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,10 @@ def convert(checkpoint, output, scale, height=256, width=256,

print(f"Loading BSRGAN model (scale={scale})...")
model = RRDBNet(in_nc=3, out_nc=3, nf=64, nb=23, gc=32, sf=scale)
state_dict = torch.load(checkpoint, map_location='cpu')
# weights_only=False for consistency with the other converters; this
# is a trusted checkpoint we ship. PyTorch 2.6 made weights_only=True
# the default, which can reject checkpoints carrying non-tensor data.
state_dict = torch.load(checkpoint, map_location='cpu', weights_only=False)
model.load_state_dict(state_dict, strict=True)
model.eval()

Expand Down
16 changes: 15 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ core = [
"onnx>=1.10.0",
"onnxruntime",
"onnxsim",
"opencv-python",
# headless, not opencv-python: albumentations/albucore pull
# opencv-python-headless, and both variants install into the same
# cv2/ namespace. Two of them race over cv2/__init__.py and CI ends
# up with a half-written package (cv2.imread missing). We use no GUI
# calls, so headless is the single consistent variant.
"opencv-python-headless",
]
nafnet = [
{include-group = "core"},
Expand Down Expand Up @@ -87,6 +92,15 @@ eval = [
"scipy",
]

[tool.uv]
# mmcv/mmengine require opencv-python while albumentations/albucore
# require opencv-python-headless; both install into the same cv2/
# namespace and race over cv2/__init__.py, leaving a half-written
# package on CI (cv2.imread missing). Force the headless variant
# everywhere — mmcv imports cv2 too and we use no GUI calls — so the
# shared venv only ever has one opencv.
override-dependencies = ["opencv-python; sys_platform == 'never'"]

[tool.uv.extra-build-dependencies]
mmcv = ["setuptools<71"]

Expand Down
53 changes: 24 additions & 29 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.