Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,10 +1,16 @@
|
|
| 1 |
-
import
|
| 2 |
-
|
| 3 |
-
import pipeline
|
| 4 |
|
| 5 |
-
|
| 6 |
-
|
|
|
|
|
|
|
| 7 |
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import torch
|
| 2 |
+
import transformers
|
|
|
|
| 3 |
|
| 4 |
+
# Load the checkpoint file into a PyTorch model
|
| 5 |
+
model = YourModelClass()
|
| 6 |
+
state_dict = torch.load('souleater-diffusion.ckpt')
|
| 7 |
+
model.load_state_dict(state_dict)
|
| 8 |
|
| 9 |
+
# Save the model architecture and weights to a file
|
| 10 |
+
torch.save(model.state_dict(), 'souleater-diffusion.pth')
|
| 11 |
+
|
| 12 |
+
# Register the model with Hugging Face
|
| 13 |
+
model_name = "DeadfoxX/souleater-diffusion"
|
| 14 |
+
model_id = transformers.Model.upload(model_name, "souleater-diffusion.pth")
|
| 15 |
+
|
| 16 |
+
print(f"Model uploaded with ID: {model_id}")
|