Spaces:
Runtime error
Runtime error
Download weights/convert_safetensor_to_pt.py from microsoft/OmniParser: direct link, hf CLI and curl.
- Browser
- Download file 319 Bytes
-
https://huggingface.co/spaces/microsoft/OmniParser/resolve/main/weights/convert_safetensor_to_pt.py
- Command line
-
hf download hf://spaces/microsoft/OmniParser/weights/convert_safetensor_to_pt.py
-
curl -L -o convert_safetensor_to_pt.py https://huggingface.co/spaces/microsoft/OmniParser/resolve/main/weights/convert_safetensor_to_pt.py
319 Bytes
| import torch | |
| from ultralytics.nn.tasks import DetectionModel | |
| from safetensors.torch import load_file | |
| tensor_dict = load_file("weights/icon_detect/model.safetensors") | |
| model = DetectionModel('weights/icon_detect/model.yaml') | |
| model.load_state_dict(tensor_dict) | |
| torch.save({'model':model}, 'weights/icon_detect/best.pt') | |