Skip to content

Commit

Permalink
formatting + name convention
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinBakerMath committed Oct 29, 2024
1 parent 0640baf commit 73afe22
Show file tree
Hide file tree
Showing 52 changed files with 395 additions and 179 deletions.
6 changes: 5 additions & 1 deletion examples/LennardJones/LennardJones.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,11 @@
os.environ["HYDRAGNN_AGGR_BACKEND"] = "mpi"
os.environ["HYDRAGNN_USE_ddstore"] = "1"

(train_loader, val_loader, test_loader,) = hydragnn.preprocess.create_dataloaders(
(
train_loader,
val_loader,
test_loader,
) = hydragnn.preprocess.create_dataloaders(
trainset, valset, testset, config["NeuralNetwork"]["Training"]["batch_size"]
)

Expand Down
6 changes: 5 additions & 1 deletion examples/alexandria/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,11 @@ def get(self, idx):
os.environ["HYDRAGNN_AGGR_BACKEND"] = "mpi"
os.environ["HYDRAGNN_USE_ddstore"] = "1"

(train_loader, val_loader, test_loader,) = hydragnn.preprocess.create_dataloaders(
(
train_loader,
val_loader,
test_loader,
) = hydragnn.preprocess.create_dataloaders(
trainset, valset, testset, config["NeuralNetwork"]["Training"]["batch_size"]
)

Expand Down
6 changes: 5 additions & 1 deletion examples/ani1_x/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,11 @@ def get(self, idx):
os.environ["HYDRAGNN_AGGR_BACKEND"] = "mpi"
os.environ["HYDRAGNN_USE_ddstore"] = "1"

(train_loader, val_loader, test_loader,) = hydragnn.preprocess.create_dataloaders(
(
train_loader,
val_loader,
test_loader,
) = hydragnn.preprocess.create_dataloaders(
trainset, valset, testset, config["NeuralNetwork"]["Training"]["batch_size"]
)

Expand Down
6 changes: 5 additions & 1 deletion examples/csce/train_gap.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,11 @@ def __getitem__(self, idx):
os.environ["HYDRAGNN_AGGR_BACKEND"] = "mpi"
os.environ["HYDRAGNN_USE_ddstore"] = "1"

(train_loader, val_loader, test_loader,) = hydragnn.preprocess.create_dataloaders(
(
train_loader,
val_loader,
test_loader,
) = hydragnn.preprocess.create_dataloaders(
trainset, valset, testset, config["NeuralNetwork"]["Training"]["batch_size"]
)
comm.Barrier()
Expand Down
6 changes: 5 additions & 1 deletion examples/dftb_uv_spectrum/train_discrete_uv_spectrum.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,11 @@ def get(self, idx):
os.environ["HYDRAGNN_AGGR_BACKEND"] = "mpi"
os.environ["HYDRAGNN_USE_ddstore"] = "1"

(train_loader, val_loader, test_loader,) = hydragnn.preprocess.create_dataloaders(
(
train_loader,
val_loader,
test_loader,
) = hydragnn.preprocess.create_dataloaders(
trainset, valset, testset, config["NeuralNetwork"]["Training"]["batch_size"]
)

Expand Down
6 changes: 5 additions & 1 deletion examples/dftb_uv_spectrum/train_smooth_uv_spectrum.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,11 @@ def get(self, idx):
os.environ["HYDRAGNN_AGGR_BACKEND"] = "mpi"
os.environ["HYDRAGNN_USE_ddstore"] = "1"

(train_loader, val_loader, test_loader,) = hydragnn.preprocess.create_dataloaders(
(
train_loader,
val_loader,
test_loader,
) = hydragnn.preprocess.create_dataloaders(
trainset, valset, testset, config["NeuralNetwork"]["Training"]["batch_size"]
)

Expand Down
6 changes: 5 additions & 1 deletion examples/eam/eam.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,11 @@ def info(*args, logtype="info", sep=" "):
% (len(trainset), len(valset), len(testset))
)

(train_loader, val_loader, test_loader,) = hydragnn.preprocess.create_dataloaders(
(
train_loader,
val_loader,
test_loader,
) = hydragnn.preprocess.create_dataloaders(
trainset, valset, testset, config["NeuralNetwork"]["Training"]["batch_size"]
)
timer.stop()
Expand Down
8 changes: 4 additions & 4 deletions examples/ising_model/create_configurations.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def E_dimensionless(config, L, spin_function, scale_spin):
spin[x, y, z] = spin_function(config[x, y, z])

count_pos = 0
number_nodes = L ** 3
number_nodes = L**3
positions = np.zeros((number_nodes, 3))
atomic_features = np.zeros((number_nodes, 5))
for x in range(L):
Expand Down Expand Up @@ -79,15 +79,15 @@ def create_dataset(

count_config = 0

for num_downs in tqdm(range(0, L ** 3)):
for num_downs in tqdm(range(0, L**3)):

primal_configuration = np.ones((L ** 3,))
primal_configuration = np.ones((L**3,))
for down in range(0, num_downs):
primal_configuration[down] = -1.0

# If the current composition has a total number of possible configurations above
# the hard cutoff threshold, a random configurational subset is picked
if scipy.special.binom(L ** 3, num_downs) > histogram_cutoff:
if scipy.special.binom(L**3, num_downs) > histogram_cutoff:
for num_config in range(0, histogram_cutoff):
config = np.random.permutation(primal_configuration)
config = np.reshape(config, (L, L, L))
Expand Down
12 changes: 8 additions & 4 deletions examples/ising_model/train_ising.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def create_dataset_mpi(
np.random.seed(seed)

count_config = 0
rx = list(nsplit(range(0, L ** 3), comm_size))[rank]
rx = list(nsplit(range(0, L**3), comm_size))[rank]
info("rx", rx.start, rx.stop)
for num_downs in range(rx.start, rx.stop):
subdir = os.path.join(dir, str(num_downs))
Expand All @@ -98,13 +98,13 @@ def create_dataset_mpi(
prefix = "output_%d_" % num_downs
subdir = os.path.join(dir, str(num_downs))

primal_configuration = np.ones((L ** 3,))
primal_configuration = np.ones((L**3,))
for down in range(0, num_downs):
primal_configuration[down] = -1.0

# If the current composition has a total number of possible configurations above
# the hard cutoff threshold, a random configurational subset is picked
if scipy.special.binom(L ** 3, num_downs) > histogram_cutoff:
if scipy.special.binom(L**3, num_downs) > histogram_cutoff:
for num_config in range(0, histogram_cutoff):
config = np.random.permutation(primal_configuration)
config = np.reshape(config, (L, L, L))
Expand Down Expand Up @@ -355,7 +355,11 @@ def info(*args, logtype="info", sep=" "):
os.environ["HYDRAGNN_AGGR_BACKEND"] = "mpi"
os.environ["HYDRAGNN_USE_ddstore"] = "1"

(train_loader, val_loader, test_loader,) = hydragnn.preprocess.create_dataloaders(
(
train_loader,
val_loader,
test_loader,
) = hydragnn.preprocess.create_dataloaders(
trainset, valset, testset, config["NeuralNetwork"]["Training"]["batch_size"]
)
timer.stop()
Expand Down
6 changes: 5 additions & 1 deletion examples/lsms/lsms.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,11 @@ def info(*args, logtype="info", sep=" "):
% (len(trainset), len(valset), len(testset))
)

(train_loader, val_loader, test_loader,) = hydragnn.preprocess.create_dataloaders(
(
train_loader,
val_loader,
test_loader,
) = hydragnn.preprocess.create_dataloaders(
trainset, valset, testset, config["NeuralNetwork"]["Training"]["batch_size"]
)
timer.stop()
Expand Down
7 changes: 6 additions & 1 deletion examples/md17/md17.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import hydragnn


# Update each sample prior to loading.
def md17_pre_transform(data):
# Set descriptor as element type.
Expand Down Expand Up @@ -72,7 +73,11 @@ def md17_pre_filter(data):
train, val, test = hydragnn.preprocess.split_dataset(
dataset, config["NeuralNetwork"]["Training"]["perc_train"], False
)
(train_loader, val_loader, test_loader,) = hydragnn.preprocess.create_dataloaders(
(
train_loader,
val_loader,
test_loader,
) = hydragnn.preprocess.create_dataloaders(
train, val, test, config["NeuralNetwork"]["Training"]["batch_size"]
)

Expand Down
6 changes: 5 additions & 1 deletion examples/mptrj/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,11 @@ def get(self, idx):
os.environ["HYDRAGNN_AGGR_BACKEND"] = "mpi"
os.environ["HYDRAGNN_USE_ddstore"] = "1"

(train_loader, val_loader, test_loader,) = hydragnn.preprocess.create_dataloaders(
(
train_loader,
val_loader,
test_loader,
) = hydragnn.preprocess.create_dataloaders(
trainset, valset, testset, config["NeuralNetwork"]["Training"]["batch_size"]
)

Expand Down
6 changes: 5 additions & 1 deletion examples/multidataset/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,11 @@ def info(*args, logtype="info", sep=" "):
os.environ["HYDRAGNN_AGGR_BACKEND"] = "mpi"
os.environ["HYDRAGNN_USE_ddstore"] = "1"

(train_loader, val_loader, test_loader,) = hydragnn.preprocess.create_dataloaders(
(
train_loader,
val_loader,
test_loader,
) = hydragnn.preprocess.create_dataloaders(
trainset,
valset,
testset,
Expand Down
6 changes: 5 additions & 1 deletion examples/multidataset_hpo/gfm.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,11 @@ def main():
os.environ["HYDRAGNN_AGGR_BACKEND"] = "mpi"
os.environ["HYDRAGNN_USE_ddstore"] = "1"

(train_loader, val_loader, test_loader,) = hydragnn.preprocess.create_dataloaders(
(
train_loader,
val_loader,
test_loader,
) = hydragnn.preprocess.create_dataloaders(
trainset, valset, testset, config["NeuralNetwork"]["Training"]["batch_size"]
)

Expand Down
6 changes: 5 additions & 1 deletion examples/ogb/train_gap.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,11 @@ def __getitem__(self, idx):
% (len(trainset), len(valset), len(testset))
)

(train_loader, val_loader, test_loader,) = hydragnn.preprocess.create_dataloaders(
(
train_loader,
val_loader,
test_loader,
) = hydragnn.preprocess.create_dataloaders(
trainset, valset, testset, config["NeuralNetwork"]["Training"]["batch_size"]
)

Expand Down
6 changes: 5 additions & 1 deletion examples/open_catalyst_2020/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,11 @@ def get(self, idx):
os.environ["HYDRAGNN_AGGR_BACKEND"] = "mpi"
os.environ["HYDRAGNN_USE_ddstore"] = "1"

(train_loader, val_loader, test_loader,) = hydragnn.preprocess.create_dataloaders(
(
train_loader,
val_loader,
test_loader,
) = hydragnn.preprocess.create_dataloaders(
trainset, valset, testset, config["NeuralNetwork"]["Training"]["batch_size"]
)

Expand Down
6 changes: 5 additions & 1 deletion examples/open_catalyst_2022/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,11 @@ def get(self, idx):
os.environ["HYDRAGNN_AGGR_BACKEND"] = "mpi"
os.environ["HYDRAGNN_USE_ddstore"] = "1"

(train_loader, val_loader, test_loader,) = hydragnn.preprocess.create_dataloaders(
(
train_loader,
val_loader,
test_loader,
) = hydragnn.preprocess.create_dataloaders(
trainset, valset, testset, config["NeuralNetwork"]["Training"]["batch_size"]
)

Expand Down
6 changes: 5 additions & 1 deletion examples/qm7x/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,11 @@ def get(self, idx):
os.environ["HYDRAGNN_AGGR_BACKEND"] = "mpi"
os.environ["HYDRAGNN_USE_ddstore"] = "1"

(train_loader, val_loader, test_loader,) = hydragnn.preprocess.create_dataloaders(
(
train_loader,
val_loader,
test_loader,
) = hydragnn.preprocess.create_dataloaders(
trainset, valset, testset, config["NeuralNetwork"]["Training"]["batch_size"]
)

Expand Down
1 change: 1 addition & 0 deletions examples/qm9/qm9.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"model_type": "MACE",
"radius": 7,
"basis_emb_size": 8,
"equivariance": false,
"envelope_exponent": 5,
"max_ell": 2,
"node_max_ell": 2,
Expand Down
7 changes: 6 additions & 1 deletion examples/qm9/qm9.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import hydragnn


# Update each sample prior to loading.
def qm9_pre_transform(data):
# Set descriptor as element type.
Expand Down Expand Up @@ -63,7 +64,11 @@ def qm9_pre_filter(data):
train, val, test = hydragnn.preprocess.split_dataset(
dataset, config["NeuralNetwork"]["Training"]["perc_train"], False
)
(train_loader, val_loader, test_loader,) = hydragnn.preprocess.create_dataloaders(
(
train_loader,
val_loader,
test_loader,
) = hydragnn.preprocess.create_dataloaders(
train, val, test, config["NeuralNetwork"]["Training"]["batch_size"]
)

Expand Down
7 changes: 6 additions & 1 deletion examples/qm9_hpo/qm9.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import hydragnn
import argparse


# Update each sample prior to loading.
def qm9_pre_transform(data):
# Set descriptor as element type.
Expand Down Expand Up @@ -85,7 +86,11 @@ def qm9_pre_filter(data):
train, val, test = hydragnn.preprocess.split_dataset(
dataset, config["NeuralNetwork"]["Training"]["perc_train"], False
)
(train_loader, val_loader, test_loader,) = hydragnn.preprocess.create_dataloaders(
(
train_loader,
val_loader,
test_loader,
) = hydragnn.preprocess.create_dataloaders(
train, val, test, config["NeuralNetwork"]["Training"]["batch_size"]
)

Expand Down
1 change: 1 addition & 0 deletions examples/qm9_hpo/qm9_deephyper_multi.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
DEEPHYPER_LOG_DIR = os.environ["DEEPHYPER_LOG_DIR"]
DEEPHYPER_DB_HOST = os.environ["DEEPHYPER_DB_HOST"]


# Update each sample prior to loading.
def qm9_pre_transform(data):
# Set descriptor as element type.
Expand Down
7 changes: 6 additions & 1 deletion examples/qm9_hpo/qm9_optuna.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import pandas as pd


# Update each sample prior to loading.
def qm9_pre_transform(data):
# Set descriptor as element type.
Expand Down Expand Up @@ -73,7 +74,11 @@ def objective(trial):
if model_type not in ["EGNN", "SchNet", "DimeNet"]:
config["NeuralNetwork"]["Architecture"]["equivariance"] = False

(train_loader, val_loader, test_loader,) = hydragnn.preprocess.create_dataloaders(
(
train_loader,
val_loader,
test_loader,
) = hydragnn.preprocess.create_dataloaders(
trainset, valset, testset, config["NeuralNetwork"]["Training"]["batch_size"]
)

Expand Down
2 changes: 1 addition & 1 deletion examples/qm9_hpo/test_deephyper.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def run(job):
if job.parameters["function"] == "linear":
y = x + b
elif job.parameters["function"] == "cubic":
y = x ** 3 + b
y = x**3 + b

# Maximization!
return y
Expand Down
Loading

0 comments on commit 73afe22

Please sign in to comment.