Skip to content

fix: serialize TorchScript load/script behind a global lock#2373

Merged
grzegorz-roboflow merged 14 commits into
mainfrom
fix/torchscript-concurrent-load
May 27, 2026
Merged

fix: serialize TorchScript load/script behind a global lock#2373
grzegorz-roboflow merged 14 commits into
mainfrom
fix/torchscript-concurrent-load

Conversation

@grzegorz-roboflow
Copy link
Copy Markdown
Collaborator

What does this PR do?

torch.jit.load/script share a process-global, non-thread-safe registry; concurrent model loads (PINNED_MODELS preload) corrupt it. Thread an optional torchscript_state_global_lock through the SAM3/CLIP/YOLO loaders, always supplied by ModelManager, plus a regression test.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)

Testing

test added

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code where necessary, particularly in hard-to-understand areas
  • My changes generate no new warnings or errors
  • I have updated the documentation accordingly (if applicable)

Additional Context

N/A

@grzegorz-roboflow grzegorz-roboflow merged commit b81e9c2 into main May 27, 2026
50 of 57 checks passed
@grzegorz-roboflow grzegorz-roboflow deleted the fix/torchscript-concurrent-load branch May 27, 2026 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants