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.
Timing the ONNX model, retrain CMS-GNNLSH-TF (jpata#229)
* timing code, retrain CMS-GNNLSH-TF, new multi-particle gun dataset, small hit-based datasets
- Loading branch information
Showing
23 changed files
with
727 additions
and
181 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
from pathlib import Path | ||
|
||
import tensorflow as tf | ||
from utils_edm import ( | ||
X_FEATURES_CH, | ||
X_FEATURES_TRK, | ||
Y_FEATURES, | ||
generate_examples, | ||
split_sample, | ||
) | ||
|
||
import tensorflow_datasets as tfds | ||
|
||
from qq import _DESCRIPTION, _CITATION | ||
|
||
|
||
class ClicEdmQqHitsPf10k(tfds.core.GeneratorBasedBuilder): | ||
VERSION = tfds.core.Version("1.5.0") | ||
RELEASE_NOTES = { | ||
"1.5.0": "Regenerate with ARRAY_RECORD", | ||
} | ||
MANUAL_DOWNLOAD_INSTRUCTIONS = """ | ||
For the raw input files in ROOT EDM4HEP format, please see the citation above. | ||
The processed tensorflow_dataset can also be downloaded from: | ||
FIXME | ||
""" | ||
|
||
def __init__(self, *args, **kwargs): | ||
kwargs["file_format"] = tfds.core.FileFormat.ARRAY_RECORD | ||
super(ClicEdmQqHitsPf10k, self).__init__(*args, **kwargs) | ||
|
||
def _info(self) -> tfds.core.DatasetInfo: | ||
"""Returns the dataset metadata.""" | ||
return tfds.core.DatasetInfo( | ||
builder=self, | ||
description=_DESCRIPTION, | ||
features=tfds.features.FeaturesDict( | ||
{ | ||
"X": tfds.features.Tensor( | ||
shape=( | ||
None, | ||
max(len(X_FEATURES_TRK), len(X_FEATURES_CH)), | ||
), | ||
dtype=tf.float32, | ||
), | ||
"ygen": tfds.features.Tensor(shape=(None, len(Y_FEATURES)), dtype=tf.float32), | ||
"ycand": tfds.features.Tensor(shape=(None, len(Y_FEATURES)), dtype=tf.float32), | ||
} | ||
), | ||
supervised_keys=None, | ||
homepage="", | ||
citation=_CITATION, | ||
metadata=tfds.core.MetadataDict( | ||
x_features_track=X_FEATURES_TRK, | ||
x_features_calohit=X_FEATURES_CH, | ||
y_features=Y_FEATURES, | ||
), | ||
) | ||
|
||
def _split_generators(self, dl_manager: tfds.download.DownloadManager): | ||
path = dl_manager.manual_dir | ||
return split_sample(Path(path / "p8_ee_qq_ecm380/"), max_files=100) | ||
|
||
def _generate_examples(self, files): | ||
return generate_examples(files) |
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,66 @@ | ||
from pathlib import Path | ||
|
||
import tensorflow as tf | ||
from utils_edm import ( | ||
X_FEATURES_CH, | ||
X_FEATURES_TRK, | ||
Y_FEATURES, | ||
generate_examples, | ||
split_sample, | ||
) | ||
|
||
import tensorflow_datasets as tfds | ||
|
||
from ttbar import _DESCRIPTION, _CITATION | ||
|
||
|
||
class ClicEdmTtbarHitsPf10k(tfds.core.GeneratorBasedBuilder): | ||
VERSION = tfds.core.Version("1.5.0") | ||
RELEASE_NOTES = { | ||
"1.5.0": "Regenerate with ARRAY_RECORD", | ||
} | ||
MANUAL_DOWNLOAD_INSTRUCTIONS = """ | ||
For the raw input files in ROOT EDM4HEP format, please see the citation above. | ||
The processed tensorflow_dataset can also be downloaded from: | ||
FIXME | ||
""" | ||
|
||
def __init__(self, *args, **kwargs): | ||
kwargs["file_format"] = tfds.core.FileFormat.ARRAY_RECORD | ||
super(ClicEdmTtbarHitsPf10k, self).__init__(*args, **kwargs) | ||
|
||
def _info(self) -> tfds.core.DatasetInfo: | ||
"""Returns the dataset metadata.""" | ||
return tfds.core.DatasetInfo( | ||
builder=self, | ||
description=_DESCRIPTION, | ||
features=tfds.features.FeaturesDict( | ||
{ | ||
"X": tfds.features.Tensor( | ||
shape=( | ||
None, | ||
max(len(X_FEATURES_TRK), len(X_FEATURES_CH)), | ||
), | ||
dtype=tf.float32, | ||
), | ||
"ygen": tfds.features.Tensor(shape=(None, len(Y_FEATURES)), dtype=tf.float32), | ||
"ycand": tfds.features.Tensor(shape=(None, len(Y_FEATURES)), dtype=tf.float32), | ||
} | ||
), | ||
supervised_keys=None, | ||
homepage="", | ||
citation=_CITATION, | ||
metadata=tfds.core.MetadataDict( | ||
x_features_track=X_FEATURES_TRK, | ||
x_features_calohit=X_FEATURES_CH, | ||
y_features=Y_FEATURES, | ||
), | ||
) | ||
|
||
def _split_generators(self, dl_manager: tfds.download.DownloadManager): | ||
path = dl_manager.manual_dir | ||
return split_sample(Path(path / "p8_ee_tt_ecm380/"), max_files=100) | ||
|
||
def _generate_examples(self, files): | ||
return generate_examples(files) |
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,62 @@ | ||
"""CMS PF SinglePi dataset.""" | ||
import cms_utils | ||
import tensorflow as tf | ||
|
||
import tensorflow_datasets as tfds | ||
|
||
X_FEATURES = cms_utils.X_FEATURES | ||
Y_FEATURES = cms_utils.Y_FEATURES | ||
|
||
_DESCRIPTION = """ | ||
Dataset generated with CMSSW and full detector sim. | ||
Multi-particle gun events. | ||
""" | ||
|
||
# TODO(cms_pf): BibTeX citation | ||
_CITATION = """ | ||
""" | ||
|
||
|
||
class CmsPfMultiParticleGun(tfds.core.GeneratorBasedBuilder): | ||
"""DatasetBuilder for cms_pf_multi_particle_gun dataset.""" | ||
|
||
VERSION = tfds.core.Version("1.6.0") | ||
RELEASE_NOTES = { | ||
"1.6.0": "Initial release", | ||
} | ||
MANUAL_DOWNLOAD_INSTRUCTIONS = """ | ||
rsync -r --progress lxplus.cern.ch:/eos/user/j/jpata/mlpf/cms/MultiParticlePFGun_cfi data/ | ||
""" | ||
|
||
def __init__(self, *args, **kwargs): | ||
kwargs["file_format"] = tfds.core.FileFormat.ARRAY_RECORD | ||
super(CmsPfMultiParticleGun, self).__init__(*args, **kwargs) | ||
|
||
def _info(self) -> tfds.core.DatasetInfo: | ||
"""Returns the dataset metadata.""" | ||
# TODO(cms_pf): Specifies the tfds.core.DatasetInfo object | ||
return tfds.core.DatasetInfo( | ||
builder=self, | ||
description=_DESCRIPTION, | ||
features=tfds.features.FeaturesDict( | ||
{ | ||
"X": tfds.features.Tensor(shape=(None, len(X_FEATURES)), dtype=tf.float32), | ||
"ygen": tfds.features.Tensor(shape=(None, len(Y_FEATURES)), dtype=tf.float32), | ||
"ycand": tfds.features.Tensor(shape=(None, len(Y_FEATURES)), dtype=tf.float32), | ||
} | ||
), | ||
supervised_keys=("X", "ycand"), | ||
homepage="", | ||
citation=_CITATION, | ||
metadata=tfds.core.MetadataDict(x_features=X_FEATURES, y_features=Y_FEATURES), | ||
) | ||
|
||
def _split_generators(self, dl_manager: tfds.download.DownloadManager): | ||
"""Returns SplitGenerators.""" | ||
path = dl_manager.manual_dir | ||
sample_dir = "MultiParticlePFGun50_cfi" | ||
return cms_utils.split_sample(path / sample_dir / "raw") | ||
|
||
def _generate_examples(self, files): | ||
return cms_utils.generate_examples(files) |
This file was deleted.
Oops, something went wrong.
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.