Skip to content

Commit 4f6999a

Browse files
committed
Fixup
1 parent 9470676 commit 4f6999a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

scripts/models-conversions/upernet-hf-to-smp.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def group_qkv_layers(state_dict: dict) -> dict:
161161

162162
def convert_model(model_name: str, push_to_hub: bool = False):
163163
params = PRETRAINED_CHECKPOINTS[model_name]
164-
164+
165165
print(f"Converting model: {model_name}")
166166
print(f"Downloading weights from: {params['repo_id']}")
167167

@@ -202,15 +202,15 @@ def convert_model(model_name: str, push_to_hub: bool = False):
202202

203203
print("Loading weights into SMP model...")
204204
smp_model.load_state_dict(smp_state_dict, strict=True)
205-
205+
206206
# Check we can run the model
207207
print("Verifying model with test inference...")
208208
smp_model.eval()
209209
sample = torch.ones(1, 3, 512, 512)
210210
with torch.no_grad():
211211
output = smp_model(sample)
212212
print(f"Test inference successful. Output shape: {output.shape}")
213-
213+
214214
# Save model with preprocessing
215215
smp_repo_id = f"smp-hub/upernet-{model_name}"
216216
print(f"Saving model to: {smp_repo_id}")
@@ -238,7 +238,7 @@ def convert_model(model_name: str, push_to_hub: bool = False):
238238
folder_path=smp_repo_id,
239239
repo_type="model",
240240
)
241-
241+
242242
print(f"Conversion of {model_name} completed successfully!")
243243

244244

0 commit comments

Comments
 (0)