Spaces:
Build error
Build error
Create export_model.py
Browse files- export_model.py +7 -0
export_model.py
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import torch
|
2 |
+
|
3 |
+
# Load the model
|
4 |
+
model = VisionEncoderDecoderModel.from_pretrained("nlpconnect/vit-gpt2-image-captioning")
|
5 |
+
|
6 |
+
# Save the model state dictionary
|
7 |
+
torch.save(model.state_dict(), "model.pth")
|