Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use weights_only for load #127

Merged
merged 1 commit into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion experiments/eval_combo.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ def run(
weights_path = Path(f"static_quant_scalars/{sam_model_type}_{batch_size}_static_quant_weights.ptk")
if weights_path.exists() and weights_path.is_file():
print("Loading static quantization weights")
weights = torch.load(f"static_quant_scalars/{sam_model_type}_{batch_size}_static_quant_weights.ptk")
weights = torch.load(f"static_quant_scalars/{sam_model_type}_{batch_size}_static_quant_weights.ptk", weights_only=True)
from static_quant import set_x_absmax
set_x_absmax(predictor.model.image_encoder, weights)
elif compress == "sparse":
Expand Down
2 changes: 1 addition & 1 deletion segment_anything_fast/build_sam.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,6 @@ def _build_sam(
sam.eval()
if checkpoint is not None:
with open(checkpoint, "rb") as f:
state_dict = torch.load(f)
state_dict = torch.load(f, weights_only=True)
sam.load_state_dict(state_dict)
return sam
Loading