microsoft / microsoft/Biodiversity
Issue Saving MegaDetectorV6: Cannot Pickle '_thread.lock' Object
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.1k
- Forks
- 297
- PR merge metrics
- No merged PRs in 30d
Description
When saving the MegaDetectorV6 model using the following code:
import torch
from PytorchWildlife.models import detection as pw_detection
model = pw_detection.MegaDetectorV6(
device="cpu",
pretrained=True,
version="MDV6-yolov10-e"
)
torch.save(model, "MegaDetectorV6.pt")
I encountered the error:
TypeError: cannot pickle '_thread.lock' object
Could you please advise on:
A recommended method to export this model directly to Hugging Face Transformers?
How to save the model as a .pt file or convert it to ONNX given this serialization issue?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the torch.save failure with the MegaDetectorV6 example and inspect the model's serialization path. Investigate the requested Hugging Face and ONNX export routes, then define done as a supported export or save method with clear usage guidance and validation of the resulting artifact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, pytorch
- Domain
- computer-vision, machine-learning
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100