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

[SD-126] Save model summary during benchmarking #53

Merged
merged 30 commits into from
Jan 24, 2025
Merged
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
2d1fdc3
WIP PR 126
OCarrollM Jan 20, 2025
6d9c089
SD-126 Console print out of JSON material asked in ticket. Needs JSON…
OCarrollM Jan 21, 2025
129f045
Update loop to use named_children
osw282 Jan 21, 2025
2623a30
SD-126: Code cleaned and contents saved to JSON file
OCarrollM Jan 21, 2025
3d26770
SD-126 Code cleaned, added load_model and get_layers to common module…
OCarrollM Jan 21, 2025
f7a836d
SD-126: Changed to old datacollection function, removed imports from …
OCarrollM Jan 22, 2025
0827c54
Updated script with dvc added
OCarrollM Jan 22, 2025
2596baf
Try fixing corrupted DVC cache
d-lowl Jan 22, 2025
62320fa
uv lock
d-lowl Jan 22, 2025
b1827ee
Fix imports
d-lowl Jan 23, 2025
e7b1d38
Add partial data to DVC
d-lowl Jan 23, 2025
cebcb44
Specify weights when loading
d-lowl Jan 23, 2025
0779eb1
Remove prebuilt models measurements from this branch
d-lowl Jan 23, 2025
60cb54a
Regenerate date with a different indentation, to avoid the corrupted …
d-lowl Jan 23, 2025
c75d7b0
Regenerate date with a different indentation, to avoid the corrupted …
d-lowl Jan 23, 2025
c69ba76
Test model loading
osw282 Jan 23, 2025
caae6e6
Test
osw282 Jan 23, 2025
668505b
Test torch hub endpoitns
osw282 Jan 23, 2025
65459ba
Test with version
osw282 Jan 23, 2025
313099d
Update working torch model repo version
osw282 Jan 23, 2025
e173da3
Add test file
d-lowl Jan 23, 2025
c79ea8b
Another test
osw282 Jan 23, 2025
b164482
Fix lenet input dimensions
osw282 Jan 23, 2025
a33d191
Add model summaries collected on the jetson
osw282 Jan 23, 2025
773e00b
Remove test files
d-lowl Jan 23, 2025
0a10fe6
Fixed data collected on jetson
osw282 Jan 23, 2025
3d47471
Revert some unnecessary changes
d-lowl Jan 23, 2025
67436b1
Address comments
d-lowl Jan 24, 2025
05554c2
Address comments
d-lowl Jan 24, 2025
ddfe693
Merge branch 'develop' into SD-126-JSON-Save
d-lowl Jan 24, 2025
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
Prev Previous commit
Next Next commit
SD-126: Changed to old datacollection function, removed imports from …
…pyproject and created bash script for model summaries
OCarrollM committed Jan 22, 2025
commit f7a836dee4c7270c6f4d9a57eda18cf15789c379
26 changes: 26 additions & 0 deletions jetson/power_logging/model/generate_model_summaries.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

# Directory to store results
RESULT_DIR = "raw_data/prebuilt_models"

# List of models to process
MODELS = ("alexnet" "vgg11" "vgg13" "vgg16" "vgg19" "mobilenet_v2" "mobilenet_v3_small" "mobilenet_v3_large" "resnet18" "resnet34" "resnet50" "resnet101" "resnet152" "lenet" "resnext50_32x4d" "resnext101_32x8d" "resnext101_64x4d" "convnext_tiny" "convnext_small" "convnext_base")

PYTHON_SCRIPT = "save_model_summary.py"

for MODEL in "${MODELS[@]}"
do
MODEL_OUTPUT_DIR="${RESULT_DIR}/${MODEL}"
OUTPUT_FILE = "${MODEL_OUTPUT_DIR}/model_summary.json"

mkdir -p "$MODEL_OUTPUT_DIR"

echo "Generating summary for model: $MODEL"
python "$PYTHON_SCRIPT" --model "$MODEL" --output-file "$OUTPUT_FILE"

if [ $? -eq 0]; then
echo "Summary saved to: $OUTPUT_FILE"
else
echo "Failed to generate summary for model: $MODEL"
fi
done
7 changes: 6 additions & 1 deletion jetson/power_logging/model/model_utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import torch
from typing import Any
from model.lenet import LeNet

def load_model(model_name: str, model_repo: str) -> Any:
"""Load model from Pytorch Hub.
@@ -14,8 +15,12 @@ def load_model(model_name: str, model_repo: str) -> Any:
Returns:
PyTorch model
"""
try:
if model_name == "lenet":
return LeNet()
if model_name == "fcn_resnet50":
return torch.hub.load(model_repo, model_name, pretrained=True)
try:
return torch.hub.load(model_repo, model_name)
except:
raise ValueError(
f"Model name: {model_name} is most likely incorrect. "
2 changes: 0 additions & 2 deletions jetson/power_logging/pyproject.toml
Original file line number Diff line number Diff line change
@@ -9,8 +9,6 @@ dependencies = [
"pandas>=2.2.3",
"pillow>=11.1.0",
"torch==2.2.2",
"torchinfo>=1.8.0",
"torchsummary>=1.5.1",
]

[dependency-groups]