-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'pytorch:main' into add_coat_optimizer
- Loading branch information
Showing
89 changed files
with
4,841 additions
and
1,479 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,4 +20,5 @@ include = [ | |
"test/prototype/low_bit_optim/**.py", | ||
] | ||
|
||
lint.select = ["F", "I"] | ||
lint.ignore = ["E731"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#!/bin/bash | ||
|
||
# Copyright (c) Meta Platforms, Inc. and affiliates. | ||
# All rights reserved. | ||
|
||
# This source code is licensed under the license found in the | ||
# LICENSE file in the root directory of this source tree. | ||
|
||
# Use either wget or curl to download the checkpoints | ||
if command -v wget &> /dev/null; then | ||
CMD="wget -P" | ||
elif command -v curl &> /dev/null; then | ||
CMD="curl -L -O" | ||
else | ||
echo "Please install wget or curl to download the checkpoints." | ||
exit 1 | ||
fi | ||
|
||
# Define the URLs for SAM 2 checkpoints | ||
# SAM2_BASE_URL="https://dl.fbaipublicfiles.com/segment_anything_2/072824" | ||
# sam2_hiera_t_url="${SAM2_BASE_URL}/sam2_hiera_tiny.pt" | ||
# sam2_hiera_s_url="${SAM2_BASE_URL}/sam2_hiera_small.pt" | ||
# sam2_hiera_b_plus_url="${SAM2_BASE_URL}/sam2_hiera_base_plus.pt" | ||
# sam2_hiera_l_url="${SAM2_BASE_URL}/sam2_hiera_large.pt" | ||
|
||
# Download each of the four checkpoints using wget | ||
# echo "Downloading sam2_hiera_tiny.pt checkpoint..." | ||
# $CMD $sam2_hiera_t_url || { echo "Failed to download checkpoint from $sam2_hiera_t_url"; exit 1; } | ||
|
||
# echo "Downloading sam2_hiera_small.pt checkpoint..." | ||
# $CMD $sam2_hiera_s_url || { echo "Failed to download checkpoint from $sam2_hiera_s_url"; exit 1; } | ||
|
||
# echo "Downloading sam2_hiera_base_plus.pt checkpoint..." | ||
# $CMD $sam2_hiera_b_plus_url || { echo "Failed to download checkpoint from $sam2_hiera_b_plus_url"; exit 1; } | ||
|
||
# echo "Downloading sam2_hiera_large.pt checkpoint..." | ||
# $CMD $sam2_hiera_l_url || { echo "Failed to download checkpoint from $sam2_hiera_l_url"; exit 1; } | ||
|
||
# Define the URLs for SAM 2.1 checkpoints | ||
SAM2p1_BASE_URL="https://dl.fbaipublicfiles.com/segment_anything_2/092824" | ||
sam2p1_hiera_t_url="${SAM2p1_BASE_URL}/sam2.1_hiera_tiny.pt" | ||
sam2p1_hiera_s_url="${SAM2p1_BASE_URL}/sam2.1_hiera_small.pt" | ||
sam2p1_hiera_b_plus_url="${SAM2p1_BASE_URL}/sam2.1_hiera_base_plus.pt" | ||
sam2p1_hiera_l_url="${SAM2p1_BASE_URL}/sam2.1_hiera_large.pt" | ||
|
||
# $1 is the directory to store the checkpoint | ||
DEFAULT_DIR=test | ||
if [ -z "$1" ]; then | ||
DIR_NAME=$DEFAULT_DIR | ||
else | ||
# Use provided directory name | ||
DIR_NAME=$1 | ||
fi | ||
|
||
# SAM 2.1 checkpoints | ||
echo "Downloading sam2.1_hiera_tiny.pt checkpoint..." | ||
$CMD $DIR_NAME $sam2p1_hiera_t_url || { echo "Failed to download checkpoint from $sam2p1_hiera_t_url"; exit 1; } | ||
|
||
echo "Downloading sam2.1_hiera_small.pt checkpoint..." | ||
$CMD $DIR_NAME $sam2p1_hiera_s_url || { echo "Failed to download checkpoint from $sam2p1_hiera_s_url"; exit 1; } | ||
|
||
echo "Downloading sam2.1_hiera_base_plus.pt checkpoint..." | ||
$CMD $DIR_NAME $sam2p1_hiera_b_plus_url || { echo "Failed to download checkpoint from $sam2p1_hiera_b_plus_url"; exit 1; } | ||
|
||
echo "Downloading sam2.1_hiera_large.pt checkpoint..." | ||
$CMD $DIR_NAME $sam2p1_hiera_l_url || { echo "Failed to download checkpoint from $sam2p1_hiera_l_url"; exit 1; } | ||
|
||
echo "All checkpoints are downloaded successfully." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
ruff check . --fix | ||
# --isolated is used to skip the allowlist at all so this applies to all files | ||
# please be careful when using this large changes means everyone needs to rebase | ||
ruff check --isolated --select F821,F823,W191 --fix | ||
ruff check --select F,I --fix | ||
ruff format . |
Oops, something went wrong.