Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -68,19 +68,21 @@ print ("torch.backends.mps.is_available: ", torch.backends.mps.is_available())
|
|
| 68 |
pipe = pipe.to(device)
|
| 69 |
|
| 70 |
model = CLIPDensePredT(version='ViT-B/16', reduce_dim=64, complex_trans_conv=True)
|
|
|
|
|
|
|
| 71 |
model.eval() #.half()
|
| 72 |
|
| 73 |
|
| 74 |
weightsPATH = './clipseg/weights/rd64-uni.pth'
|
| 75 |
|
| 76 |
-
model1 = torch.load(weightsPATH)
|
| 77 |
-
print ("Torch load : ", model1)
|
| 78 |
-
|
| 79 |
state = {'model': model.state_dict()}
|
| 80 |
torch.save(state, weightsPATH)
|
| 81 |
|
| 82 |
model.load_state_dict(torch.load(weightsPATH['model'], map_location=torch.device(device)), strict=False) #False
|
| 83 |
#model.load_state_dict(torch.load(weightsPATH)['model'])
|
|
|
|
|
|
|
|
|
|
| 84 |
# print weights
|
| 85 |
for k, v in model.named_parameters():
|
| 86 |
print(k, v)
|
|
|
|
| 68 |
pipe = pipe.to(device)
|
| 69 |
|
| 70 |
model = CLIPDensePredT(version='ViT-B/16', reduce_dim=64, complex_trans_conv=True)
|
| 71 |
+
|
| 72 |
+
model = model.to(torch.device(device))
|
| 73 |
model.eval() #.half()
|
| 74 |
|
| 75 |
|
| 76 |
weightsPATH = './clipseg/weights/rd64-uni.pth'
|
| 77 |
|
|
|
|
|
|
|
|
|
|
| 78 |
state = {'model': model.state_dict()}
|
| 79 |
torch.save(state, weightsPATH)
|
| 80 |
|
| 81 |
model.load_state_dict(torch.load(weightsPATH['model'], map_location=torch.device(device)), strict=False) #False
|
| 82 |
#model.load_state_dict(torch.load(weightsPATH)['model'])
|
| 83 |
+
|
| 84 |
+
print ("Torch load(model) : ", model)
|
| 85 |
+
print ("Weights : ")
|
| 86 |
# print weights
|
| 87 |
for k, v in model.named_parameters():
|
| 88 |
print(k, v)
|