You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from anomalib.data import MVTec
from anomalib.models import WinClip
from anomalib.engine import Engine
from anomalib.deploy import ExportType
datamodule = MVTec()
model = WinClip()
engine = Engine()
engine.fit(datamodule=datamodule, model=model)
engine.export(model, export_type=ExportType.TORCH)
OS information
OS information:
OS: [e.g. Ubuntu 22.04]
Python version: [e.g. 3.10.13]
Anomalib version: [e.g. main branch]
PyTorch version: [e.g. 2.3.1]
CUDA/cuDNN version: [e.g. 12.1]
GPU models and configuration: [e.g. 2x GeForce RTX 3060]
Expected behavior
export pytorch model and inference correctly
Screenshots
No response
Pip/GitHub
pip
What version/branch did you use?
main
Configuration YAML
none
Logs
File "/media/xxx/test_winclip/test.py", line 44, in<module>
engine.export(model, export_type=ExportType.TORCH)
File "/home/xxx/anomalib/src/anomalib/engine/engine.py", line 944, inexport
exported_model_path = model.to_torch(
File "/home/xxx/anomalib/src/anomalib/models/components/base/export_mixin.py", line 89, in to_torch
torch.save(
File "/home/xxx/winclip_env/lib/python3.10/site-packages/torch/serialization.py", line 628, in save
_save(obj, opened_zipfile, pickle_module, pickle_protocol, _disable_byteorder_record)
File "/home/xxx/winclip_env/lib/python3.10/site-packages/torch/serialization.py", line 840, in _save
pickler.dump(obj)
AttributeError: Can't pickle local object 'WinClipModel.encode_image.<locals>.get_feature_map.<locals>.hook'
### Code of Conduct
- [X] I agree to follow this project's Code of Conduct
The text was updated successfully, but these errors were encountered:
Describe the bug
WinCLIP cannot export pytorch model
Dataset
MVTec
Model
Other (please specify in the field below)
Steps to reproduce the behavior
OS information
OS information:
Expected behavior
export pytorch model and inference correctly
Screenshots
No response
Pip/GitHub
pip
What version/branch did you use?
main
Configuration YAML
none
Logs
The text was updated successfully, but these errors were encountered: