-
Notifications
You must be signed in to change notification settings - Fork 261
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
nik
committed
Aug 16, 2023
1 parent
6d67e97
commit 389b569
Showing
9 changed files
with
64 additions
and
26 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
19 changes: 19 additions & 0 deletions
19
label_studio_ml/examples/segment_anything_model/.dockerignore
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,19 @@ | ||
Dockerfile | ||
README.md | ||
*.pyc | ||
*.pyo | ||
*.pyd | ||
__pycache__ | ||
.pytest_cache | ||
.idea | ||
docker-compose.yml | ||
data | ||
logs | ||
*.db | ||
*.sqlite3 | ||
*.sqlite | ||
*.sql | ||
*.pt | ||
*.pth | ||
*.onnx | ||
models/* |
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
15 changes: 9 additions & 6 deletions
15
label_studio_ml/examples/segment_anything_model/download_models.sh
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 |
---|---|---|
@@ -1,10 +1,13 @@ | ||
#!/bin/bash | ||
|
||
# Make sure the models directory exists | ||
mkdir -p models | ||
|
||
# check if file `sam_vit_h_4b8939.pth` exists, otherwise download the model | ||
[ -f sam_vit_h_4b8939.pth ] || | ||
wget https://dl.fbaipublicfiles.com/segment_anything/sam_vit_h_4b8939.pth | ||
[ -f models/sam_vit_h_4b8939.pth ] || | ||
wget https://dl.fbaipublicfiles.com/segment_anything/sam_vit_h_4b8939.pth -P models/ | ||
|
||
# check if file `mobile_sam.pt` exists, otherwise download the model | ||
[ -f mobile_sam.pt ] || | ||
wget https://github.com/ChaoningZhang/MobileSAM/raw/master/weights/mobile_sam.pt | ||
[ -f models/mobile_sam.pt ] || | ||
wget https://github.com/ChaoningZhang/MobileSAM/raw/master/weights/mobile_sam.pt -P models/ | ||
|
||
# run ONNX conversion | ||
python onnxconverter.py |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
|
||
# Check if the file specified in the ONNX_CHECKPOINT environment variable exists | ||
if [ ! -f "$ONNX_CHECKPOINT" ]; then | ||
# Run the python onnxconverter.py script if the file is not found | ||
python onnxconverter.py | ||
else | ||
# Otherwise, print a message to the console | ||
echo "ONNX checkpoint found in $ONNX_CHECKPOINT, skipping conversion" | ||
fi | ||
|
||
# Execute the gunicorn command | ||
exec gunicorn --preload --bind :$PORT --workers 1 --threads 8 --timeout 0 _wsgi:app |