The state_dict contains all parameters and buffers and neither the model definition not any model code, so you can’t directly export it and would need to create a model instance first.
Assuming “contains the model” means a scripted model, you would again need to create the model object first and export it to ONNX as described here.