repo
stringlengths
1
99
file
stringlengths
13
215
code
stringlengths
12
59.2M
file_length
int64
12
59.2M
avg_line_length
float64
3.82
1.48M
max_line_length
int64
12
2.51M
extension_type
stringclasses
1 value
structured-nets
structured-nets-master/tensorflow/model_params.py
from utils import * import pickle as pkl import datetime, os class ModelParams: def __init__(self, dataset_name, transform, test, log_path, input_size, layer_size, out_size, num_layers, loss, r, steps, batch_size, lr, mom, init_type, class_type, learn_corner, n_diag_learned, ini...
5,989
40.597222
260
py
structured-nets
structured-nets-master/tensorflow/compare_parallel.py
""" Compare methods in parallel, spawning separate thread for each. """ import sys, os, datetime import pickle as pkl sys.path.insert(0, '../../') # from optimize import optimize from utils import * from model_params import ModelParams from dataset import Dataset import argparse import thread def create_command(args,...
2,795
43.380952
291
py
MALUNet
MALUNet-main/engine.py
import numpy as np from tqdm import tqdm import torch from torch.cuda.amp import autocast as autocast from sklearn.metrics import confusion_matrix from utils import save_imgs def train_one_epoch(train_loader, model, criterion, optimizer, ...
5,851
36.037975
139
py
MALUNet
MALUNet-main/utils.py
import torch import torch.nn as nn import torch.nn.functional as F import torch.backends.cudnn as cudnn import torchvision.transforms.functional as TF import numpy as np import os import math import random import logging import logging.handlers from matplotlib import pyplot as plt def set_seed(seed): # for hash ...
11,464
29.819892
136
py
MALUNet
MALUNet-main/train.py
import torch from torch import nn from torch.cuda.amp import autocast, GradScaler from torch.utils.data import DataLoader from models.malunet import MALUNet from dataset.npy_datasets import NPY_datasets from engine import * import os import sys os.environ["CUDA_VISIBLE_DEVICES"] = "0" # "0, 1, 2, 3" from utils import...
5,357
28.43956
153
py
MALUNet
MALUNet-main/dataset/npy_datasets.py
from torch.utils.data import Dataset import numpy as np import os from PIL import Image class NPY_datasets(Dataset): def __init__(self, path_Data, config, train=True): super(NPY_datasets, self) if train: images_list = os.listdir(path_Data+'train/images/') masks_list = os.li...
1,505
37.615385
87
py
MALUNet
MALUNet-main/models/malunet.py
import torch from torch import nn import torch.nn.functional as F from timm.models.layers import trunc_normal_ import math class DepthWiseConv2d(nn.Module): def __init__(self, dim_in, dim_out, kernel_size=3, padding=1, stride=1, dilation=1): super().__init__() self.conv1 = nn.Conv2d(dim_...
12,695
38.924528
143
py
MALUNet
MALUNet-main/configs/config_setting.py
from torchvision import transforms from utils import * from datetime import datetime class setting_config: """ the config of training setting. """ network = 'malunet' model_config = { 'num_classes': 1, 'input_channels': 3, 'c_list': [8, 16, 24, 32, 48, 64], 'split_...
8,211
52.324675
298
py
ms-pred
ms-pred-main/src/ms_pred/common/misc_utils.py
""" utils.py """ import sys import copy import logging from pathlib import Path import json from itertools import groupby, islice from typing import Tuple, List import pandas as pd import numpy as np import ms_pred.common.chem_utils as chem_utils from pytorch_lightning.loggers import LightningLoggerBase from pytorch_...
12,709
26.751092
86
py
ms-pred
ms-pred-main/src/ms_pred/common/chem_utils.py
"""chem_utils.py""" import re import numpy as np import pandas as pd from functools import reduce import torch from rdkit import Chem from rdkit.Chem import Atom from rdkit.Chem.rdMolDescriptors import CalcMolFormula from rdkit.Chem.Descriptors import ExactMolWt from rdkit.Chem.MolStandardize import rdMolStandardize ...
13,164
23.37963
88
py
ms-pred
ms-pred-main/src/ms_pred/scarf_pred/train_inten.py
"""train_inten.py Train model to predict emit intensities for each mol formla """ import logging import yaml import argparse from pathlib import Path import pandas as pd from datetime import datetime from torch.utils.data import DataLoader import pytorch_lightning as pl from pytorch_lightning import loggers as pl_l...
10,163
34.538462
92
py
ms-pred
ms-pred-main/src/ms_pred/scarf_pred/predict_smis.py
"""predict_smis.py Make both scarf prefix tree and intensity predictions jointly and revert to binned """ import logging import json from datetime import datetime import yaml import argparse import pickle from pathlib import Path import pandas as pd import numpy as np import torch import pytorch_lightning as pl im...
9,603
33.923636
86
py
ms-pred
ms-pred-main/src/ms_pred/scarf_pred/inten_hyperopt.py
"""inten_hyperopt.py Hyperopt parameters for scarf model """ import os import copy import logging import argparse from pathlib import Path import pandas as pd from typing import List, Dict from torch.utils.data import DataLoader import pytorch_lightning as pl from pytorch_lightning import loggers as pl_loggers from...
9,038
29.0299
83
py
ms-pred
ms-pred-main/src/ms_pred/scarf_pred/train_gen.py
"""train.py Train gnn to predict binned specs """ import logging import yaml import argparse from pathlib import Path from datetime import datetime import pandas as pd import numpy as np from torch.utils.data import DataLoader import pytorch_lightning as pl from pytorch_lightning import loggers as pl_loggers from p...
10,446
33.823333
92
py
ms-pred
ms-pred-main/src/ms_pred/scarf_pred/predict_gen.py
"""predict.py Make predictions with trained model """ import logging from datetime import datetime import yaml import argparse import pickle from pathlib import Path import json import numpy as np import pandas as pd from tqdm import tqdm import torch from torch.utils.data import DataLoader import pytorch_lightning...
6,807
32.372549
84
py
ms-pred
ms-pred-main/src/ms_pred/scarf_pred/scarf_data.py
import logging from pathlib import Path from typing import List from functools import partial import json import numpy as np import pandas as pd from tqdm import tqdm from rdkit import Chem import torch from torch.utils.data.dataset import Dataset import dgl import ms_pred.common as common import ms_pred.massformer_...
26,118
33.367105
87
py
ms-pred
ms-pred-main/src/ms_pred/scarf_pred/scarf_model.py
import math import ipdb import torch import pytorch_lightning as pl import torch.nn as nn import torch.nn.functional as F import torch_scatter as ts import dgl.nn as dgl_nn import numpy as np import einops from rdkit import Chem import dgl import ms_pred.common as common import ms_pred.nn_utils as nn_utils import ...
50,839
35.549245
122
py
ms-pred
ms-pred-main/src/ms_pred/scarf_pred/gen_hyperopt.py
"""gen_hyperopt.py Hyperopt parameters for scarf model """ import os import copy import logging import argparse from pathlib import Path import pandas as pd from typing import List, Dict from torch.utils.data import DataLoader import pytorch_lightning as pl from pytorch_lightning import loggers as pl_loggers from p...
7,593
29.620968
83
py
ms-pred
ms-pred-main/src/ms_pred/scarf_pred/predict_inten.py
"""predict_inten.py Make intensity predictions with trained model """ import logging from datetime import datetime import yaml import argparse import pickle import json from pathlib import Path import pandas as pd import numpy as np from tqdm import tqdm import torch from torch.utils.data import DataLoader import p...
7,922
33.447826
88
py
ms-pred
ms-pred-main/src/ms_pred/ffn_pred/ffn_hyperopt.py
"""ffn_hyperopt.py Hyperopt parameters for FFN model """ import os import copy import logging import argparse from pathlib import Path import pandas as pd from typing import List, Dict from torch.utils.data import DataLoader import pytorch_lightning as pl from pytorch_lightning import loggers as pl_loggers from pyt...
6,046
27.795238
79
py
ms-pred
ms-pred-main/src/ms_pred/ffn_pred/ffn_model.py
""" ffn_model. """ import torch import pytorch_lightning as pl import torch.nn as nn import numpy as np import ms_pred.nn_utils as nn_utils import ms_pred.common as common class ForwardFFN(pl.LightningModule): def __init__( self, hidden_size: int, layers: int = 2, dropout: float =...
6,781
34.139896
86
py
ms-pred
ms-pred-main/src/ms_pred/ffn_pred/ffn_data.py
import logging import json import numpy as np import torch from torch.utils.data.dataset import Dataset import ms_pred.common as common class BinnedDataset(Dataset): """SmiDataset.""" def __init__( self, df, data_dir, num_bins, num_workers=0, upper_limit=1500...
6,802
30.35023
86
py
ms-pred
ms-pred-main/src/ms_pred/ffn_pred/predict.py
"""predict.py Make predictions with trained model """ import logging from collections import defaultdict from datetime import datetime import yaml import argparse import pickle from pathlib import Path import numpy as np import pandas as pd import torch from torch.utils.data import DataLoader import pytorch_lightn...
6,367
31.994819
84
py
ms-pred
ms-pred-main/src/ms_pred/ffn_pred/train.py
"""train.py Train ffn to predict binned specs """ import logging import yaml import argparse from pathlib import Path import pandas as pd from datetime import datetime from torch.utils.data import DataLoader import pytorch_lightning as pl from pytorch_lightning import loggers as pl_loggers from pytorch_lightning.ca...
7,709
32.521739
99
py
ms-pred
ms-pred-main/src/ms_pred/molnetms/molnetms_model.py
""" gnn_model. """ from typing import Tuple import pytorch_lightning as pl import numpy as np import torch import torch.nn.functional as F import torch.nn as nn import ms_pred.nn_utils as nn_utils import ms_pred.common as common import ms_pred.molnetms.molnetms_data as molnetms_data class FCResBlock(nn.Module): ...
18,504
36.611789
123
py
ms-pred
ms-pred-main/src/ms_pred/molnetms/molnetms_hyperopt.py
"""gnn_hyperopt.py Hyperopt parameters for FFN model """ import os import copy import logging import argparse from pathlib import Path import pandas as pd from typing import List, Dict from torch.utils.data import DataLoader import pytorch_lightning as pl from pytorch_lightning import loggers as pl_loggers from pyt...
6,481
28.330317
79
py
ms-pred
ms-pred-main/src/ms_pred/molnetms/molnetms_data.py
import logging import json import numpy as np import torch from rdkit import Chem from torch.utils.data.dataset import Dataset import dgl import ms_pred.common as common class MolMSFeaturizer(): """ Create a 3D mol featurizer""" # Hardcoded char_to_vec = {i: j.tolist() for i,j in common.element_to_posi...
12,980
32.114796
138
py
ms-pred
ms-pred-main/src/ms_pred/molnetms/predict.py
"""predict.py Make predictions with trained model """ import logging from datetime import datetime import yaml import argparse import pickle from pathlib import Path import numpy as np import pandas as pd from tqdm import tqdm import torch from torch.utils.data import DataLoader import pytorch_lightning as pl imp...
5,741
31.811429
86
py
ms-pred
ms-pred-main/src/ms_pred/molnetms/train.py
"""train.py Train gnn to predict binned specs """ import logging import yaml import argparse from pathlib import Path import pandas as pd from datetime import datetime from torch.utils.data import DataLoader import pytorch_lightning as pl from pytorch_lightning import loggers as pl_loggers from pytorch_lightning.ca...
7,973
32.087137
92
py
ms-pred
ms-pred-main/src/ms_pred/graff_ms/graff_ms_hyperopt.py
"""graff_ms_hyperopt.py Hyperopt parameters for graff ms model """ import os import copy import logging import argparse from pathlib import Path import pandas as pd from typing import List, Dict from torch.utils.data import DataLoader import pytorch_lightning as pl from pytorch_lightning import loggers as pl_logger...
7,881
30.277778
79
py
ms-pred
ms-pred-main/src/ms_pred/graff_ms/graff_ms_data.py
from collections import defaultdict import logging import json import numpy as np from tqdm import tqdm import torch from rdkit import Chem from torch.utils.data.dataset import Dataset import dgl import ms_pred.common as common def array_to_string(array): """ Converts a 1D NumPy array into a string. ...
12,380
29.64604
87
py
ms-pred
ms-pred-main/src/ms_pred/graff_ms/predict.py
"""predict.py Make predictions with trained model """ import logging from datetime import datetime import yaml import argparse import pickle from pathlib import Path import numpy as np import pandas as pd from tqdm import tqdm import torch from torch.utils.data import DataLoader import pytorch_lightning as pl imp...
5,873
32
86
py
ms-pred
ms-pred-main/src/ms_pred/graff_ms/train.py
"""train.py Train graff ms to predict binned specs """ import logging import yaml import argparse from pathlib import Path import pandas as pd from datetime import datetime from torch.utils.data import DataLoader import pytorch_lightning as pl from pytorch_lightning import loggers as pl_loggers from pytorch_lightni...
9,219
33.792453
95
py
ms-pred
ms-pred-main/src/ms_pred/graff_ms/graff_ms_model.py
""" gnn_model. """ import torch import pytorch_lightning as pl import numpy as np import torch.nn as nn import dgl.nn as dgl_nn import torch_scatter as ts import ms_pred.nn_utils as nn_utils import ms_pred.common as common class GraffGNN(pl.LightningModule): def __init__( self, hidden_size: int,...
11,548
33.99697
98
py
ms-pred
ms-pred-main/src/ms_pred/dag_pred/train_inten.py
"""train_inten.py Train model to predict emit intensities for each fragment """ import logging import yaml import argparse from pathlib import Path import pandas as pd from datetime import datetime from torch.utils.data import DataLoader import pytorch_lightning as pl from pytorch_lightning import loggers as pl_log...
10,066
33.713793
92
py
ms-pred
ms-pred-main/src/ms_pred/dag_pred/predict_smis.py
"""predict_smis.py Make both dag and intensity predictions jointly and revert to binned """ import logging import json from collections import defaultdict from datetime import datetime import yaml import argparse import pickle from pathlib import Path import pandas as pd import numpy as np import torch import pytor...
8,442
33.321138
84
py
ms-pred
ms-pred-main/src/ms_pred/dag_pred/joint_model.py
""" joint_model. """ from collections import defaultdict import numpy as np import pytorch_lightning as pl import ms_pred.common as common import ms_pred.magma.fragmentation as fragmentation import ms_pred.dag_pred.gen_model as gen_model import ms_pred.dag_pred.inten_model as inten_model import ms_pred.dag_pred.dag_da...
5,385
32.042945
95
py
ms-pred
ms-pred-main/src/ms_pred/dag_pred/dag_data.py
""" dag_data.py Fragment dataset to build out model class """ import logging from pathlib import Path from typing import List import json import copy import numpy as np import pandas as pd from tqdm import tqdm import torch import dgl from torch.utils.data.dataset import Dataset import ms_pred.common as common imp...
22,426
30.498596
87
py
ms-pred
ms-pred-main/src/ms_pred/dag_pred/inten_model.py
"""frag_model.""" import numpy as np import copy import torch import pytorch_lightning as pl import torch.nn as nn import torch_scatter as ts import dgl.nn as dgl_nn import ms_pred.common as common import ms_pred.dag_pred.dag_data as dag_data import ms_pred.nn_utils as nn_utils import ms_pred.magma.fragmentation as f...
18,694
32.684685
88
py
ms-pred
ms-pred-main/src/ms_pred/dag_pred/inten_hyperopt.py
"""inten_hyperopt.py Hyperopt parameters for frag tree generation model """ import os import copy import logging import argparse from pathlib import Path import pandas as pd from typing import List, Dict from torch.utils.data import DataLoader import pytorch_lightning as pl from pytorch_lightning import loggers as ...
7,566
29.512097
83
py
ms-pred
ms-pred-main/src/ms_pred/dag_pred/train_gen.py
"""train.py Train model to predict tree breakages """ import logging import yaml import argparse from pathlib import Path from datetime import datetime import pandas as pd import numpy as np from torch.utils.data import DataLoader import pytorch_lightning as pl from pytorch_lightning import loggers as pl_loggers fr...
9,118
32.525735
92
py
ms-pred
ms-pred-main/src/ms_pred/dag_pred/gen_model.py
"""frag_model.""" import numpy as np import torch import pytorch_lightning as pl import torch.nn as nn import dgl import dgl.nn as dgl_nn import ms_pred.common as common import ms_pred.nn_utils as nn_utils import ms_pred.magma.fragmentation as fragmentation import ms_pred.magma.run_magma as magma import ms_pred.dag_p...
23,127
36.064103
89
py
ms-pred
ms-pred-main/src/ms_pred/dag_pred/predict_gen.py
"""predict.py Make predictions with trained model """ import logging from datetime import datetime import yaml import argparse import json from pathlib import Path import pandas as pd from tqdm import tqdm from rdkit import Chem from rdkit import RDLogger RDLogger.DisableLog("rdApp.*") import torch import pytorc...
4,918
30.132911
87
py
ms-pred
ms-pred-main/src/ms_pred/dag_pred/gen_hyperopt.py
"""frag_hyperopt.py Hyperopt parameters for frag tree generation model """ import os import copy import logging import argparse from pathlib import Path import pandas as pd from typing import List, Dict from torch.utils.data import DataLoader import pytorch_lightning as pl from pytorch_lightning import loggers as p...
7,051
28.630252
83
py
ms-pred
ms-pred-main/src/ms_pred/dag_pred/predict_inten.py
"""predict_inten.py Make intensity predictions with trained model """ import logging from datetime import datetime import yaml import argparse import pickle import copy import json from pathlib import Path import pandas as pd import numpy as np from tqdm import tqdm import torch from torch.utils.data import DataLoa...
8,571
34.131148
84
py
ms-pred
ms-pred-main/src/ms_pred/gnn_pred/gnn_data.py
import logging import json import numpy as np import torch from rdkit import Chem from torch.utils.data.dataset import Dataset import dgl import ms_pred.common as common class BinnedDataset(Dataset): """SmiDataset.""" def __init__( self, df, data_dir, num_bins, graph...
8,568
31.214286
86
py
ms-pred
ms-pred-main/src/ms_pred/gnn_pred/gnn_model.py
""" gnn_model. """ import torch import pytorch_lightning as pl import numpy as np import torch.nn as nn import dgl.nn as dgl_nn import ms_pred.nn_utils as nn_utils import ms_pred.common as common class ForwardGNN(pl.LightningModule): def __init__( self, hidden_size: int, layers: int = 2,...
8,638
33.418327
86
py
ms-pred
ms-pred-main/src/ms_pred/gnn_pred/gnn_hyperopt.py
"""gnn_hyperopt.py Hyperopt parameters for FFN model """ import os import copy import logging import argparse from pathlib import Path import pandas as pd from typing import List, Dict from torch.utils.data import DataLoader import pytorch_lightning as pl from pytorch_lightning import loggers as pl_loggers from pyt...
7,020
28.876596
79
py
ms-pred
ms-pred-main/src/ms_pred/gnn_pred/predict.py
"""predict.py Make predictions with trained model """ import logging from datetime import datetime import yaml import argparse import pickle from pathlib import Path import numpy as np import pandas as pd from tqdm import tqdm import torch from torch.utils.data import DataLoader import pytorch_lightning as pl imp...
5,820
31.519553
84
py
ms-pred
ms-pred-main/src/ms_pred/gnn_pred/train.py
"""train.py Train gnn to predict binned specs """ import logging import yaml import argparse from pathlib import Path import pandas as pd from datetime import datetime from torch.utils.data import DataLoader import pytorch_lightning as pl from pytorch_lightning import loggers as pl_loggers from pytorch_lightning.ca...
8,523
32.559055
92
py
ms-pred
ms-pred-main/src/ms_pred/nn_utils/base_hyperopt.py
""" base_hyperopt.py Abstract away common hyperopt functionality """ import logging import yaml from pathlib import Path from datetime import datetime from typing import Callable import pytorch_lightning as pl import ray from ray import tune from ray.air.config import RunConfig from ray.tune.search import Concurren...
4,204
28.405594
79
py
ms-pred
ms-pred-main/src/ms_pred/nn_utils/dgl_modules.py
""" dgl_modules. Directly copy dgl modules to patch them """ import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from torch.nn import init import dgl.function as fn from dgl.nn import expand_as_pair class GatedGraphConv(nn.Module): r"""Gated Graph Convolution layer from `Gat...
19,829
32.496622
98
py
ms-pred
ms-pred-main/src/ms_pred/nn_utils/tune_utils.py
import logging from typing import Dict, List, Optional, Union from pytorch_lightning import Trainer, LightningModule from ray.tune.integration.pytorch_lightning import TuneCallback from ray import tune logger = logging.getLogger(__name__) class TuneReportCallback(TuneCallback): """PyTorch Lightning to Ray Tune...
3,407
34.5
77
py
ms-pred
ms-pred-main/src/ms_pred/nn_utils/transformer_layer.py
"""transformer_layer.py Hold pairwise attention enabled transformers """ import math from typing import Optional, Union, Callable, Tuple import torch from torch import Tensor from torch.nn import functional as F from torch.nn import Module, LayerNorm, Linear, Dropout, Parameter from torch.nn.init import xavier_unifo...
28,178
42.960998
133
py
ms-pred
ms-pred-main/src/ms_pred/nn_utils/form_embedder.py
import torch import torch.nn as nn import numpy as np import ms_pred.common as common class IntFeaturizer(nn.Module): """ Base class for mapping integers to a vector representation (primarily to be used as a "richer" embedding for NNs processing integers). Subclasses should define `self.int_to_feat_...
10,244
36.254545
122
py
ms-pred
ms-pred-main/src/ms_pred/nn_utils/mol_graph.py
""" mol_graph.py. Classes to featurize molecules into a graph with onehot concat feats on atoms and bonds. Inspired by the dgllife library. """ from rdkit import Chem import numpy as np import torch import dgl import ms_pred.nn_utils.nn_utils as nn_utils atom_feat_registry = {} bond_feat_registry = {} def register...
10,157
23.359712
87
py
ms-pred
ms-pred-main/src/ms_pred/nn_utils/nn_utils.py
""" nn_utils.py Hold basic GNN Types: 1. GGNN 2. PNA These classes should accept graphs and return featurizations at each node The calling class should be responsible for pooling however is best """ import copy import math import numpy as np import scipy.sparse as sparse import torch import torch.nn as nn import t...
26,588
30.99639
92
py
ms-pred
ms-pred-main/src/ms_pred/massformer_pred/massformer_model.py
import torch import pytorch_lightning as pl import numpy as np import torch.nn as nn import ms_pred.nn_utils as nn_utils import ms_pred.common as common from .massformer_code import gf_model from .massformer_code import model_extract class MassFormer(pl.LightningModule): """ Implementation of Massformer. ...
8,014
32.395833
86
py
ms-pred
ms-pred-main/src/ms_pred/massformer_pred/massformer_hyperopt.py
"""gnn_hyperopt.py Hyperopt parameters for FFN model """ import os import copy import logging import argparse from pathlib import Path import pandas as pd from typing import List, Dict from torch.utils.data import DataLoader import pytorch_lightning as pl from pytorch_lightning import loggers as pl_loggers from pyt...
7,365
29.438017
79
py
ms-pred
ms-pred-main/src/ms_pred/massformer_pred/_massformer_graph_featurizer.py
from rdkit import Chem from .massformer_code import gf_data_utils class MassformerGraphFeaturizer: """ Thin wrapper over Massformer code to match the API we were using for graph featurizer. Note that Massformer makes use of Pytorch Geometric Graph datastructures. """ def __call__(self, input_mol...
978
38.16
107
py
ms-pred
ms-pred-main/src/ms_pred/massformer_pred/predict.py
"""predict.py Make predictions with trained model """ import logging from datetime import datetime import yaml import argparse import pickle from pathlib import Path import numpy as np import pandas as pd from tqdm import tqdm import torch from torch.utils.data import DataLoader import pytorch_lightning as pl imp...
5,630
31.738372
88
py
ms-pred
ms-pred-main/src/ms_pred/massformer_pred/massformer_data.py
import logging import json import numpy as np import torch from rdkit import Chem from torch.utils.data.dataset import Dataset import dgl import ms_pred.common as common from ._massformer_graph_featurizer import MassformerGraphFeaturizer class BinnedDataset(Dataset): """SmiDataset.""" def __init__( ...
8,450
31.255725
94
py
ms-pred
ms-pred-main/src/ms_pred/massformer_pred/train.py
"""train.py Train gnn to predict binned specs """ import logging import yaml import argparse from pathlib import Path import pandas as pd from datetime import datetime from torch.utils.data import DataLoader import pytorch_lightning as pl from pytorch_lightning import loggers as pl_loggers from pytorch_lightning.ca...
8,486
32.545455
92
py
ms-pred
ms-pred-main/src/ms_pred/massformer_pred/massformer_code/model_extract.py
import torch.nn as nn import torch.nn.functional as F class LinearBlock(nn.Module): def __init__(self, in_feats, out_feats, dropout=0.1): super(LinearBlock, self).__init__() self.linear = nn.Linear(in_feats, out_feats) self.bn = nn.BatchNorm1d(out_feats) self.dropout = nn.Dropout(...
1,362
30.697674
65
py
ms-pred
ms-pred-main/src/ms_pred/massformer_pred/massformer_code/gf_data_utils.py
import numpy as np import torch from torch_geometric.data import Data from rdkit import Chem from rdkit.Chem import rdchem from . import algos2 # allowable multiple choice node and edge features allowable_features = { 'possible_atomic_num_list': list(range(1, 119)) + ['misc'], 'possible_chirality_list': [ ...
13,299
31.758621
108
py
ms-pred
ms-pred-main/src/ms_pred/massformer_pred/massformer_code/gf_model.py
import logging import math from typing import * import torch import torch.nn as nn import torch.nn.functional as F from torch import Tensor from torch.hub import load_state_dict_from_url import torch.distributed as dist import argparse from . import gf_data_utils logger = logging.getLogger(__name__) PRETRAINED_MODEL...
45,810
35.386815
130
py
ASH
ASH-main/docs/conf.py
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If ex...
2,723
29.266667
79
py
CNTK
CNTK-master/bindings/python/cntk/tensor.py
# Copyright (c) Microsoft. All rights reserved. # Licensed under the MIT license. See LICENSE.md file in the project root # for full license information. # ============================================================================== """ Tensor operations. """ import warnings from scipy import sparse class TensorO...
9,698
35.462406
111
py
CNTK
CNTK-master/bindings/python/cntk/io/transforms.py
# Copyright (c) Microsoft. All rights reserved. # Licensed under the MIT license. See LICENSE.md file in the project root # for full license information. # ============================================================================== from .. import cntk_py from cntk.internal import sanitize_2d_number, sanitize_range...
8,295
53.578947
112
py
CNTK
CNTK-master/bindings/python/cntk/contrib/__init__.py
# Copyright (c) Microsoft. All rights reserved. # Licensed under the MIT license. See LICENSE.md file in the project root # for full license information. # ============================================================================== """ Extra utilities for CNTK, e.g. utilities that bridge to other deep learning tool...
470
26.705882
85
py
CNTK
CNTK-master/bindings/python/cntk/contrib/crosstalkcaffe/convert.py
# ============================================================================== # Copyright (c) Microsoft. All rights reserved. # Licensed under the MIT license. See LICENSE.md file in the project root # for full license information. # ============================================================================== imp...
1,642
33.229167
93
py
CNTK
CNTK-master/bindings/python/cntk/contrib/crosstalkcaffe/examples/run_convert.py
# ============================================================================== # Copyright (c) Microsoft. All rights reserved. # Licensed under the MIT license. See LICENSE.md file in the project root # for full license information. # ============================================================================== ''' ...
1,747
39.651163
92
py
CNTK
CNTK-master/bindings/python/cntk/contrib/crosstalkcaffe/adapter/__init__.py
# ============================================================================== # Copyright (c) Microsoft. All rights reserved. # Licensed under the MIT license. See LICENSE.md file in the project root # for full license information. # ============================================================================== fro...
414
33.583333
80
py
CNTK
CNTK-master/bindings/python/cntk/contrib/crosstalkcaffe/adapter/bvlccaffe/caffeimpl.py
# ============================================================================== # Copyright (c) Microsoft. All rights reserved. # Licensed under the MIT license. See LICENSE.md file in the project root # for full license information. # ============================================================================== impo...
2,180
27.324675
80
py
CNTK
CNTK-master/bindings/python/cntk/contrib/crosstalkcaffe/adapter/bvlccaffe/caffeadapter.py
# ============================================================================== # Copyright (c) Microsoft. All rights reserved. # Licensed under the MIT license. See LICENSE.md file in the project root # for full license information. # ============================================================================== imp...
25,201
42.52677
129
py
CNTK
CNTK-master/bindings/python/cntk/contrib/crosstalkcaffe/adapter/bvlccaffe/caffe_pb2.py
# Generated by the protocol buffer compiler. DO NOT EDIT! # source: caffe.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf.internal import enum_type_wrapper from google.protobuf import descriptor as _descriptor from google.protobuf import message as _mes...
256,644
41.960328
29,402
py
CNTK
CNTK-master/bindings/python/cntk/contrib/crosstalkcaffe/unimodel/cntkinstance.py
# ============================================================================== # Copyright (c) Microsoft. All rights reserved. # Licensed under the MIT license. See LICENSE.md file in the project root # for full license information. # ============================================================================== fro...
20,497
40.9182
121
py
CNTK
CNTK-master/bindings/python/cntk/contrib/crosstalkcaffe/tests/op2cntk_test.py
# ============================================================================== # Copyright (c) Microsoft. All rights reserved. # Licensed under the MIT license. See LICENSE.md file in the project root # for full license information. # ============================================================================== imp...
8,256
31.507874
104
py
CNTK
CNTK-master/bindings/python/cntk/contrib/crosstalkcaffe/utils/globalconf.py
# ============================================================================== # Copyright (c) Microsoft. All rights reserved. # Licensed under the MIT license. See LICENSE.md file in the project root # for full license information. # ============================================================================== fro...
2,478
25.37234
98
py
CNTK
CNTK-master/bindings/python/cntk/contrib/crosstalkcaffe/validation/validcaffe.py
# ============================================================================== # Copyright (c) Microsoft. All rights reserved. # Licensed under the MIT license. See LICENSE.md file in the project root # for full license information. # ============================================================================== imp...
3,045
37.556962
105
py
CNTK
CNTK-master/bindings/python/cntk/contrib/crosstalkcaffe/validation/validcore.py
# ============================================================================== # Copyright (c) Microsoft. All rights reserved. # Licensed under the MIT license. See LICENSE.md file in the project root # for full license information. # ============================================================================== imp...
3,283
35.898876
99
py
CNTK
CNTK-master/bindings/python/doc/conf.py
import re try: import cntk except ImportError: raise ImportError("Unable to import cntk; the cntk module needs to be built " "and importable to generate documentation") from cntk.sample_installer import module_is_unreleased try: import sphinx_rtd_theme except ImportError: raise ...
2,815
26.076923
89
py
CNTK
CNTK-master/Tests/EndToEndTests/CNTKv2Python/Keras/conftest.py
# Copyright (c) Microsoft. All rights reserved. # Licensed under the MIT license. See LICENSE.md file in the project root # for full license information. # ============================================================================== import os import zipfile import shutil try: from urllib.request import urlretri...
1,756
39.860465
121
py
CNTK
CNTK-master/Tests/EndToEndTests/CNTKv2Python/Examples/rpn_unit_test.py
# Copyright (c) Microsoft. All rights reserved. # Licensed under the MIT license. See LICENSE.md file in the project root # for full license information. # ============================================================================== import os, sys import pytest import numpy as np from cntk import user_function from...
10,067
43.548673
140
py
CNTK
CNTK-master/Tests/EndToEndTests/CNTKv2Python/Examples/FlappingBird_with_keras_DQN_test.py
# Copyright (c) Microsoft. All rights reserved. # Licensed under the MIT license. See LICENSE.md file in the project root # for full license information. # ============================================================================== import numpy as np import os import platform import sys import pytest os.environ["...
2,132
32.857143
166
py
CNTK
CNTK-master/Examples/ReinforcementLearning/FlappingBirdWithKeras/FlappingBird_with_keras_DQN.py
#!/usr/bin/env python from __future__ import print_function import argparse from collections import deque import json import numpy as np import os import random import requests import skimage as skimage from skimage import transform, color, exposure from skimage.transform import rotate from skimage.viewer import Image...
9,162
34.378378
131
py
CNTK
CNTK-master/Examples/Image/Detection/utils/caffe_layers/default_config.py
# -------------------------------------------------------- # Fast R-CNN # Copyright (c) 2015 Microsoft # Licensed under The MIT License [see LICENSE for details] # Written by Ross Girshick # -------------------------------------------------------- """Fast R-CNN config system. This file specifies default config option...
9,213
31.216783
91
py
CNTK
CNTK-master/Examples/Image/Detection/utils/caffe_layers/proposal_layer.py
# -------------------------------------------------------- # Faster R-CNN # Copyright (c) 2015 Microsoft # Licensed under The MIT License [see LICENSE for details] # Written by Ross Girshick and Sean Bell # -------------------------------------------------------- #import caffe import numpy as np import yaml from utils...
6,978
37.136612
80
py
CNTK
CNTK-master/Examples/Image/Detection/utils/caffe_layers/proposal_target_layer.py
# -------------------------------------------------------- # Faster R-CNN # Copyright (c) 2015 Microsoft # Licensed under The MIT License [see LICENSE for details] # Written by Ross Girshick and Sean Bell # -------------------------------------------------------- #import caffe import yaml import numpy as np import num...
8,197
37.669811
106
py
CNTK
CNTK-master/Examples/Image/Detection/utils/caffe_layers/anchor_target_layer.py
# -------------------------------------------------------- # Faster R-CNN # Copyright (c) 2015 Microsoft # Licensed under The MIT License [see LICENSE for details] # Written by Ross Girshick and Sean Bell # -------------------------------------------------------- import os #import caffe import yaml import numpy as np ...
11,890
39.445578
95
py
CNTK
CNTK-master/Examples/Image/Detection/FastRCNN/BrainScript/fastRCNN/test.py
# -------------------------------------------------------- # Fast R-CNN # Copyright (c) 2015 Microsoft # Licensed under The MIT License [see LICENSE for details] # Written by Ross Girshick # -------------------------------------------------------- """Test a Fast R-CNN network on an imdb (image database).""" from __fu...
13,520
38.535088
161
py
CNTK
CNTK-master/Examples/Image/Classification/GoogLeNet/InceptionV3/Python/InceptionV3_ImageNet_Distributed.py
# Copyright (c) Microsoft. All rights reserved. # Licensed under the MIT license. See LICENSE.md file in the project root # for full license information. # ============================================================================== import os import math import argparse import numpy as np import cntk as C from Inc...
7,640
47.056604
167
py
CNTK
CNTK-master/Examples/Image/Classification/GoogLeNet/InceptionV3/Python/InceptionV3_ImageNet.py
# Copyright (c) Microsoft. All rights reserved. # Licensed under the MIT license. See LICENSE.md file in the project root # for full license information. # ============================================================================== import os import math import argparse import numpy as np import cntk as C from Inc...
10,529
43.808511
171
py
CNTK
CNTK-master/Examples/Image/Classification/GoogLeNet/BN-Inception/Python/BN_Inception_CIFAR10_Distributed.py
# Copyright (c) Microsoft. All rights reserved. # Licensed under the MIT license. See LICENSE.md file in the project root # for full license information. # ============================================================================== from __future__ import print_function from __future__ import division import os im...
8,349
47.265896
167
py
CNTK
CNTK-master/Examples/Image/Classification/GoogLeNet/BN-Inception/Python/BN_Inception_ImageNet.py
# Copyright (c) Microsoft. All rights reserved. # Licensed under the MIT license. See LICENSE.md file in the project root # for full license information. # ============================================================================== from __future__ import print_function from __future__ import division import os im...
10,786
42.495968
171
py
CNTK
CNTK-master/Examples/Image/Classification/GoogLeNet/BN-Inception/Python/BN_Inception_CIFAR10.py
# Copyright (c) Microsoft. All rights reserved. # Licensed under the MIT license. See LICENSE.md file in the project root # for full license information. # ============================================================================== from __future__ import print_function from __future__ import division import os im...
10,779
42.643725
167
py
CNTK
CNTK-master/Examples/Image/Classification/GoogLeNet/BN-Inception/Python/BN_Inception_ImageNet_Distributed.py
# Copyright (c) Microsoft. All rights reserved. # Licensed under the MIT license. See LICENSE.md file in the project root # for full license information. # ============================================================================== from __future__ import print_function from __future__ import division import os im...
8,215
46.767442
167
py
tardis
tardis-master/docs/conf.py
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst # # Astropy documentation build configuration file. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this file. # # All configurati...
13,520
32.634328
234
py
X-VLM
X-VLM-master/NLVR.py
import argparse import os import sys import math import ruamel.yaml as yaml import numpy as np import random import time import datetime import json from pathlib import Path import json import pickle import torch import torch.backends.cudnn as cudnn import torch.distributed as dist from models.model_nlvr import XVLM...
9,554
37.22
120
py
X-VLM
X-VLM-master/Grounding_bbox.py
import argparse import datetime import json import math import os import random import time from pathlib import Path import numpy as np import ruamel.yaml as yaml import torch import torch.backends.cudnn as cudnn import torch.distributed as dist import utils from dataset import create_dataset, create_sampler, create_...
10,756
39.746212
135
py