Files
wehub-resource-sync 925e56bb5f
Unit tests / build (t4_gpu) (push) Has been cancelled
Unit tests / build (ubuntu-latest) (push) Has been cancelled
Unit tests / build (windows-latest) (push) Has been cancelled
Test CLI scripts / build (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:24:56 +08:00

11 lines
655 B
Python

import os
# The rf-detr fast detector's DINOv2 pos-embed interpolation uses an antialiased-bicubic
# op that has no MPS kernel. PyTorch reads PYTORCH_ENABLE_MPS_FALLBACK at `import torch`,
# so set it here — before torch is imported — to let that one op fall back to CPU while
# the rest of the model runs on MPS. This is only effective when surya is imported before
# torch; when torch is already loaded, `_pick_device` (surya.common.rfdetr_torch) probes
# the op at runtime and falls back to CPU device selection instead. setdefault so we never
# clobber a value the user set deliberately.
os.environ.setdefault("PYTORCH_ENABLE_MPS_FALLBACK", "1")