forked from jpata/particleflow
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* WIP: validate every val_freq training steps * update count parameters function * feat: implement intermediate validation every val_freq training steps * fix: black formatting * make ffn_dist_num_layers configurable in pytorch training * Update pyg-clic-hits.yaml * Update pyg-clic.yaml * Update pyg-cms.yaml * Update pyg-delphes.yaml * update pt search space * add script to count model parameters given a config file
- Loading branch information
Showing
10 changed files
with
201 additions
and
45 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import sys | ||
import yaml | ||
|
||
sys.path.append("../mlpf") | ||
|
||
from pyg.mlpf import MLPF | ||
from pyg.utils import ( | ||
CLASS_LABELS, | ||
X_FEATURES, | ||
count_parameters, | ||
) | ||
|
||
|
||
with open(sys.argv[1], "r") as stream: # load config (includes: which physics samples, model params) | ||
config = yaml.safe_load(stream) | ||
|
||
model_kwargs = { | ||
"input_dim": len(X_FEATURES[config["dataset"]]), | ||
"num_classes": len(CLASS_LABELS[config["dataset"]]), | ||
"pt_mode": config["model"]["pt_mode"], | ||
"eta_mode": config["model"]["eta_mode"], | ||
"sin_phi_mode": config["model"]["sin_phi_mode"], | ||
"cos_phi_mode": config["model"]["cos_phi_mode"], | ||
"energy_mode": config["model"]["energy_mode"], | ||
"attention_type": config["model"]["attention"]["attention_type"], | ||
**config["model"][config["conv_type"]], | ||
} | ||
model = MLPF(**model_kwargs) | ||
|
||
trainable_params, nontrainable_params, table = count_parameters(model) | ||
|
||
print(table) | ||
|
||
print("Model conv type:", model.conv_type) | ||
print("conv_type HPs", config["model"][config["conv_type"]]) | ||
print("Trainable parameters:", trainable_params) | ||
print("Non-trainable parameters:", nontrainable_params) | ||
print("Total parameters:", trainable_params + nontrainable_params) |
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
Oops, something went wrong.