[Feature Request]: Support converting safetensor file to OpenVINO IR format
Request Description
I'm trying to convert a safetensor file to openvino, but it just gave me an error where it said the file type is unknown.
sample code:
import openvino as ov
from safetensors.torch import load_file
print("Loading safetensor file...")
loaded = load_file("models/v1-5-pruned-emaonly.safetensors")
print("Converting to OpenVINO IR format...")
ov_model = ov.convert_model(loaded)
print("Saving model...")
ov.save_model(ov_model)
Feature Use Case
Directly convert safetensor file to openvino
Issue submission checklist
- [X] The feature request or improvement must be related to OpenVINO
@Mirakurun
safetensors.torch.load_file just loads tensors and returns Dict[str, torch.Tensor], while it does not provide information about model topology, e.g. what operations model has and connections between these operations.
You need to load original PyTorch model first which internally will load .safetensors file, then pass this model to openvino.convert_model
hmmm, is there a way to convert a .safetensors file back to its original model? I found some safetensors models on some third party sites, but usually they only have it in those formats.
hmmm, is there a way to convert a .safetensors file back to its original model?
No, as it contains only weights, but not the model structure.
Oh ok, thanks I appreciate it.
#150640
This issue will be closed in a week because of 9 months of no activity.
This issue was closed because it has been stalled for 9 months with no activity.