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
DiffMIC
DiffMIC-main/diffusion_trainer.py
import logging import time import gc import matplotlib.pyplot as plt import statsmodels.api as sm import numpy as np import torch import torch.nn as nn import torch.utils.data as data from scipy.stats import ttest_rel from tqdm import tqdm from ema import EMA from model import * from pretraining.dcg import DCG as Aux...
31,018
51.843271
185
py
DiffMIC
DiffMIC-main/utils.py
import random import math import numpy as np import argparse import torch import torch.optim as optim import torchvision from torch import nn from torchvision import transforms from dataloader.loading import * import torch.nn.functional as F def set_random_seed(seed): print(f"\n* Set seed {seed}") torch.manual...
8,144
39.321782
104
py
DiffMIC
DiffMIC-main/model.py
import torch import torch.nn as nn import torch.nn.functional as F from torchvision.models.resnet import resnet18, resnet50 from torchvision.models.densenet import densenet121 from timm.models import create_model import numpy as np class ConditionalLinear(nn.Module): def __init__(self, num_in, num_out, n_steps):...
3,986
30.393701
74
py
DiffMIC
DiffMIC-main/ema.py
import torch.nn as nn class EMA(object): def __init__(self, mu=0.999): self.mu = mu self.shadow = {} def register(self, module): for name, param in module.named_parameters(): if param.requires_grad: self.shadow[name] = param.data.clone() def update(self...
1,053
30
103
py
DiffMIC
DiffMIC-main/diffusion_utils.py
import math import torch import numpy as np def make_beta_schedule(schedule="linear", num_timesteps=1000, start=1e-5, end=1e-2): if schedule == "linear": betas = torch.linspace(start, end, num_timesteps) elif schedule == "const": betas = end * torch.ones(num_timesteps) elif schedule == "qua...
7,115
41.357143
117
py
DiffMIC
DiffMIC-main/pretraining/dcg.py
import torch import torch.nn as nn import numpy as np import pretraining.tools as tools import pretraining.modules as m class DCG(nn.Module): def __init__(self, parameters): super(DCG, self).__init__() # save parameters self.experiment_parameters = { "device_type": 'gpu', ...
5,533
41.569231
147
py
DiffMIC
DiffMIC-main/pretraining/modules.py
import torch import torch.nn as nn import torch.nn.functional as F import numpy as np import pretraining.tools as tools from torchvision.models.resnet import conv3x3, resnet18, resnet50 class BasicBlockV2(nn.Module): """ Basic Residual Block of ResNet V2 """ expansion = 1 def __init__(self, inpl...
15,698
34.679545
119
py
DiffMIC
DiffMIC-main/pretraining/resnet.py
import torch.nn as nn import torch.nn.functional as F class BasicBlock(nn.Module): expansion = 1 def __init__(self, inplanes, planes, stride=1, downsample=None, groups=1, base_width=64, dilation=1): super(BasicBlock, self).__init__() self.conv1 = nn.Conv2d(inplanes, planes, k...
4,706
31.6875
78
py
DiffMIC
DiffMIC-main/pretraining/densenet.py
import re import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.checkpoint as cp from collections import OrderedDict from torchvision._internally_replaced_utils import load_state_dict_from_url from torch import Tensor from typing import Any, List, Tuple __all__ = ['DenseNet', 'densenet...
12,797
39.628571
105
py
DiffMIC
DiffMIC-main/pretraining/tools.py
import numpy as np import torch from torch.autograd import Variable import torch.nn.functional as F def partition_batch(ls, size): """ Partitions a list into buckets of given maximum length. """ i = 0 partitioned_lists = [] while i < len(ls): partitioned_lists.append(ls[i: i+size]) ...
8,163
36.62212
120
py
DiffMIC
DiffMIC-main/dataloader/loading.py
import os, torch, cv2, random import numpy as np from torch.utils.data import Dataset, Sampler import torchvision.transforms as transforms from scipy.ndimage.morphology import binary_erosion import torchvision.transforms.functional as TF from PIL import Image, ImageOps from PIL import ImageFile ImageFile.LOAD_TRUNCATED...
5,506
31.976048
128
py
DiffMIC
DiffMIC-main/dataloader/functional.py
import math import random from PIL import Image, ImageEnhance, ImageOps try: import accimage except ImportError: accimage = None import collections import numbers import types import warnings import cv2 import numpy as np from PIL import Image _cv2_pad_to_str = { 'constant': cv2.BORDER_CONSTANT, 'ed...
23,553
41.516245
122
py
mbtr
mbtr-master/docs/source/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,038
31.365079
79
py
Variational-Inequality-GAN
Variational-Inequality-GAN-master/train_extraadam.py
# MIT License # Copyright (c) Facebook, Inc. and its affiliates. # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy...
11,901
37.895425
263
py
Variational-Inequality-GAN
Variational-Inequality-GAN-master/train_optimisticadam.py
# MIT License # Copyright (c) Facebook, Inc. and its affiliates. # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy...
11,654
38.508475
259
py
Variational-Inequality-GAN
Variational-Inequality-GAN-master/eval_fid.py
# MIT License # Copyright (c) Facebook, Inc. and its affiliates. # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy...
3,742
33.027273
105
py
Variational-Inequality-GAN
Variational-Inequality-GAN-master/utils.py
# MIT License # Copyright (c) Facebook, Inc. and its affiliates. # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy...
2,680
39.014925
152
py
Variational-Inequality-GAN
Variational-Inequality-GAN-master/train_pastextraadam.py
# MIT License # Copyright (c) Facebook, Inc. and its affiliates. # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy...
11,844
38.352159
259
py
Variational-Inequality-GAN
Variational-Inequality-GAN-master/train_adam.py
# MIT License # Copyright (c) Facebook, Inc. and its affiliates. # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy...
12,152
37.097179
263
py
Variational-Inequality-GAN
Variational-Inequality-GAN-master/eval_inception_score.py
# MIT License # Copyright (c) Facebook, Inc. and its affiliates. # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy...
3,176
32.797872
104
py
Variational-Inequality-GAN
Variational-Inequality-GAN-master/models/discriminator.py
# MIT License # Copyright (c) 2017 Ishaan Gulrajani # Copyright (c) 2017 Marvin Cao # Copyright (c) Facebook, Inc. and its affiliates. # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software witho...
2,109
43.893617
222
py
Variational-Inequality-GAN
Variational-Inequality-GAN-master/models/resnet.py
# MIT License # Copyright (c) Facebook, Inc. and its affiliates. # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy...
4,785
41.732143
109
py
Variational-Inequality-GAN
Variational-Inequality-GAN-master/models/dcgan.py
# MIT License # Copyright (c) Facebook, Inc. and its affiliates. # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy...
3,533
35.43299
92
py
Variational-Inequality-GAN
Variational-Inequality-GAN-master/tflib/inception_score.py
# From https://github.com/openai/improved-gan/blob/master/inception_score/model.py # Code derived from tensorflow/tensorflow/models/image/imagenet/classify_image.py from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import os.path import sys import ta...
3,708
34.32381
90
py
Variational-Inequality-GAN
Variational-Inequality-GAN-master/optim/extragradient.py
# MIT License # Copyright (c) Facebook, Inc. and its affiliates. # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy...
10,809
39.335821
199
py
Variational-Inequality-GAN
Variational-Inequality-GAN-master/optim/omd.py
# MIT License # Copyright (c) Facebook, Inc. and its affiliates. # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy...
5,917
39.534247
116
py
JamBot
JamBot-master/polyphonic_lstm_training.py
# Author: Jonas Wiesendanger wjonas@student.ethz.ch from settings import * from keras.models import Sequential from keras.layers.recurrent import LSTM from keras.layers import Dense, Activation from keras.layers.embeddings import Embedding from keras.optimizers import RMSprop, Adam # from keras.utils import to_categori...
8,195
34.025641
265
py
JamBot
JamBot-master/chord_model.py
from settings import * from keras.models import load_model import keras import numpy as np from numpy import array import _pickle as pickle from keras import backend as K from data_processing import get_chord_dict class Chord_Model: def __init__(self, model_path, predi...
4,054
27.356643
124
py
JamBot
JamBot-master/generation.py
from settings import * from keras.models import load_model import numpy as np from numpy import array import _pickle as pickle import os import data_processing import chord_model import midi_functions as mf import data_class chord_model_folder = 'models/chords/1523433134-Shifted_True_Lr_1e-05_EmDim_10_opt_Adam_bi_...
4,976
28.625
187
py
JamBot
JamBot-master/chord_lstm_training.py
# Author: Jonas Wiesendanger, Andres Konrad, Gino Brunner (brunnegi@ethz.ch) from settings import * from keras.models import Sequential from keras.layers import LSTM from keras.layers import Dense, Activation from keras.layers import Embedding from keras.optimizers import RMSprop, Adam import keras.utils from keras.uti...
5,989
35.975309
191
py
DSRE
DSRE-main/main.py
# coding:utf-8 import torch import numpy as np import json import sys import os import argparse import logging import framework import encoder import model1 import model2 parser = argparse.ArgumentParser() parser.add_argument('--pretrain_path', default='bert-base-uncased', help='Pre-trained ckpt path / model ...
4,541
32.644444
147
py
DSRE
DSRE-main/encoder/passage_encoder.py
import logging import torch import torch.nn as nn from transformers import BertModel, BertTokenizer class PassageEncoder(nn.Module): def __init__(self, pretrain_path, batch_size, blank_padding=True, mask_entity=False): super().__init__() self.blank_padding = blank_padding self.hidden_size =...
4,027
40.958333
112
py
DSRE
DSRE-main/model1/passage_att.py
import torch from torch import nn, optim from torch.nn import functional as F class PassageAttention(nn.Module): """ token-level attention for passage-level relation extraction. """ def __init__(self, passage_encoder, num_class, rel2id): """ ...
2,684
41.619048
163
py
DSRE
DSRE-main/model2/passage_att.py
import torch from torch import nn, optim from torch.nn import functional as F import pdb class PassageAttention(nn.Module): """ token-level attention for passage-level relation extraction. """ def __init__(self, passage_encoder, num_class, rel2id): ...
3,204
41.733333
163
py
DSRE
DSRE-main/framework/passage_re.py
import torch from torch import nn, optim from .data_loader import PassageRELoader from .utils import AverageMeter from tqdm import tqdm import pdb class PassageRE(nn.Module): def __init__(self, model, train_path, val_path, test_path, ...
7,276
39.882022
154
py
DSRE
DSRE-main/framework/data_loader.py
import torch import torch.utils.data as data import os, random, json, logging import numpy as np import sklearn.metrics class PassageREDataset(data.Dataset): """ Bag-level relation extraction dataset. Note that relation of NA should be named as 'NA'. """ def __init__(self, path, rel2id, tokenizer): ...
11,370
43.592157
372
py
CmpLoss
CmpLoss-main/run_squad.py
#!/usr/bin/env python # coding=utf-8 # Copyright 2020 The HuggingFace Team All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-...
20,046
45.838785
119
py
CmpLoss
CmpLoss-main/run_glue.py
#!/usr/bin/env python # coding=utf-8 # Copyright 2020 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LI...
22,570
44.690283
119
py
CmpLoss
CmpLoss-main/run_hotpot.py
#!/usr/bin/env python # coding=utf-8 # Copyright 2020 The HuggingFace Team All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-...
13,817
42.866667
120
py
CmpLoss
CmpLoss-main/modeling.py
from dataclasses import dataclass import json import logging import os from typing import Any, Dict, Optional, Union import torch from torch import nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from transformers import AutoModel, LongformerModel, RobertaModel, PreTrainedModel from transformers....
28,205
41.224551
125
py
CmpLoss
CmpLoss-main/trainer.py
# coding=utf-8 # Copyright 2020 The HuggingFace Team All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless require...
49,544
46.140818
130
py
CmpLoss
CmpLoss-main/utils/data.py
from collections import OrderedDict from dataclasses import dataclass import json import logging import os import random from tqdm.auto import tqdm from typing import Any, List, Dict, Optional, Tuple import numpy as np import torch from torch.utils.data import Dataset from transformers import LongformerTokenizerFast,...
21,763
45.504274
118
py
CmpLoss
CmpLoss-main/utils/qa.py
# coding=utf-8 # Copyright 2020 The HuggingFace Team All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless require...
17,507
47.633333
119
py
CmpLoss
CmpLoss-main/utils/ranking.py
import logging from itertools import product from typing import Optional import torch import torch.nn.functional as F logger = logging.getLogger(__name__) def list_mle(y_pred: torch.Tensor, y_true: torch.Tensor, mask: Optional[torch.Tensor] = None, reduction: Optional[str] = 'mean', eps: Optional[float...
4,044
37.52381
100
py
CmpLoss
CmpLoss-main/utils/tensor.py
from typing import List import torch def mask_where0(x, m): """ Args: x (torch.Tensor): (*) m (torch.Tensor): same size as logits 1 for positions that are NOT MASKED, 0 for MASKED positions. Returns: torch.Tensor: same size as logits """ if x.dtype == torch.f...
1,471
31
111
py
BPAM
BPAM-master/Baselines/DeepCF/MLP2.py
import numpy as np import tensorflow as tf from keras import initializers from keras.regularizers import l2 from keras.models import Model from keras.layers import Embedding, Input, Dense, Flatten, concatenate, Lambda, Reshape from keras.optimizers import Adagrad, Adam, SGD, RMSprop from keras import backend as K from ...
11,843
43.19403
139
py
BPAM
BPAM-master/Baselines/DeepCF/DMF_implicit2.py
import numpy as np import tensorflow as tf from keras import initializers from keras.regularizers import l2 from keras.models import Model from keras.layers import Embedding, Input, Dense, Flatten, concatenate, Dot, Lambda, multiply, Reshape, merge from keras.optimizers import Adagrad, Adam, SGD, RMSprop from keras imp...
9,721
43.801843
138
py
BPAM
BPAM-master/Baselines/DeepCF/DeepCF4.py
import numpy as np import tensorflow as tf from keras import initializers from keras.regularizers import l2 from keras.models import Model from keras.layers import Embedding, Input, Dense, Flatten, concatenate, Dot, Lambda, multiply, Reshape, multiply from keras.optimizers import Adagrad, Adam, SGD, RMSprop from keras ...
12,443
44.582418
139
py
BPAM
BPAM-master/Baselines/NMF/GMF.py
''' Created on Aug 9, 2016 Keras Implementation of Generalized Matrix Factorization (GMF) recommender model in: He Xiangnan et al. Neural Collaborative Filtering. In WWW 2017. @author: Xiangnan He (xiangnanhe@gmail.com) ''' import numpy as np import theano.tensor as T from keras import backend as K from keras impor...
7,381
41.425287
106
py
BPAM
BPAM-master/Baselines/NMF/NeuMF.py
''' Created on Aug 9, 2016 Keras Implementation of Neural Matrix Factorization (NeuMF) recommender model in: He Xiangnan et al. Neural Collaborative Filtering. In WWW 2017. @author: Xiangnan He (xiangnanhe@gmail.com) ''' import numpy as np import theano import theano.tensor as T import keras from keras import backe...
11,298
46.079167
157
py
BPAM
BPAM-master/Baselines/NMF/MLP.py
''' Created on Aug 9, 2016 Keras Implementation of Multi-Layer Perceptron (GMF) recommender model in: He Xiangnan et al. Neural Collaborative Filtering. In WWW 2017. @author: Xiangnan He (xiangnanhe@gmail.com) ''' import numpy as np import theano import theano.tensor as T import keras from keras import backend as ...
7,721
42.139665
165
py
t3f
t3f-master/docs/conf.py
# -*- coding: utf-8 -*- # # t3f documentation build configuration file, created by # sphinx-quickstart on Sun Mar 12 10:06:09 2017. # # 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 # autogenerated file. # # All c...
5,326
30.708333
107
py
t3f
t3f-master/t3f/nn.py
"""Utils for simplifying building neural networks with TT-layers""" from itertools import count import numpy as np from tensorflow.keras.layers import Layer from tensorflow.keras.layers import Activation import t3f import tensorflow as tf class KerasDense(Layer): _counter = count(0) def __init__(self, input_dim...
2,954
36.884615
79
py
lime
lime-master/doc/conf.py
# -*- coding: utf-8 -*- # # lime documentation build configuration file, created by # sphinx-quickstart on Fri Mar 18 16:20:40 2016. # # 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 # autogenerated file. # # All ...
10,195
31.368254
95
py
lime
lime-master/lime/lime_tabular.py
""" Functions for explaining classifiers that use tabular data (matrices). """ import collections import copy from functools import partial import json import warnings import numpy as np import scipy as sp import sklearn import sklearn.preprocessing from sklearn.utils import check_random_state from pyDOE2 import lhs f...
34,542
46.254446
100
py
PaddleHelix-dev
PaddleHelix-dev/apps/drug_target_interaction/moltrans_dti/helper/utils/paddle_io.py
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
4,237
29.489209
119
py
PaddleHelix-dev
PaddleHelix-dev/apps/drug_target_interaction/batchdta/pointwise/GraphDTA/train_kiba.py
"""Training scripts for GraphDTA backbone.""" import rdkit import torch import sklearn import numpy as np import pandas as pd import sys, os import os.path from os import path import random from random import shuffle from time import time from rdkit import Chem import torch.nn as nn from argparse import ArgumentParser...
8,902
35.338776
160
py
PaddleHelix-dev
PaddleHelix-dev/apps/drug_target_interaction/batchdta/pointwise/GraphDTA/utils_bindingDB.py
"""Utils scripts for GraphDTA.""" import os import numpy as np from math import sqrt from scipy import stats from torch_geometric.data import InMemoryDataset, DataLoader from torch_geometric import data as DATA import torch class TestbedDataset(InMemoryDataset): """TestbedDataset.""" def __init__(self, root=...
3,795
31.724138
109
py
PaddleHelix-dev
PaddleHelix-dev/apps/drug_target_interaction/batchdta/pointwise/GraphDTA/processing.py
"""Preprocessing scripts for GraphDTA.""" import pandas as pd import numpy as np import os import rdkit import sklearn import torch import json,pickle from collections import OrderedDict from rdkit import Chem from rdkit.Chem import MolFromSmiles import networkx as nx from utils import * # Global setting seq_voc = "A...
3,178
33.554348
316
py
PaddleHelix-dev
PaddleHelix-dev/apps/drug_target_interaction/batchdta/pointwise/GraphDTA/train_davis.py
"""Training scripts for GraphDTA backbone.""" import rdkit import torch import sklearn import numpy as np import pandas as pd import sys, os import random from random import shuffle from time import time from rdkit import Chem import torch.nn as nn from argparse import ArgumentParser from models.gat import GATNet fro...
7,864
37.365854
161
py
PaddleHelix-dev
PaddleHelix-dev/apps/drug_target_interaction/batchdta/pointwise/GraphDTA/utils.py
"""Utils scripts for GraphDTA.""" import os import numpy as np from math import sqrt from scipy import stats from torch_geometric.data import InMemoryDataset, DataLoader from torch_geometric import data as DATA import torch class TestbedDataset(InMemoryDataset): """TestbedDataset.""" def __init__(self, root=...
3,851
29.816
109
py
PaddleHelix-dev
PaddleHelix-dev/apps/drug_target_interaction/batchdta/pointwise/GraphDTA/train_bindingDB.py
"""Training scripts for GraphDTA backbone.""" import rdkit import torch import sklearn import numpy as np import pandas as pd import sys, os import random from random import shuffle from time import time from rdkit import Chem import torch.nn as nn from argparse import ArgumentParser from models.gat import GATNet fro...
9,787
35.118081
160
py
PaddleHelix-dev
PaddleHelix-dev/apps/drug_target_interaction/batchdta/pointwise/GraphDTA/preprocess.py
"""Preprocessing scripts for GraphDTA.""" import pandas as pd import numpy as np import os import rdkit import sklearn import torch import json,pickle from collections import OrderedDict from rdkit import Chem from rdkit.Chem import MolFromSmiles import networkx as nx from utils import * # Global setting seq_voc = "A...
3,938
34.809091
316
py
PaddleHelix-dev
PaddleHelix-dev/apps/drug_target_interaction/batchdta/pointwise/GraphDTA/models/ginconv.py
"""GraphDTA_GIN backbone model.""" import torch import torch.nn as nn import torch.nn.functional as F from torch.nn import Sequential, Linear, ReLU from torch_geometric.nn import GINConv, global_add_pool from torch_geometric.nn import global_mean_pool as gap, global_max_pool as gmp # GINConv backbone model class GIN...
3,247
34.304348
91
py
PaddleHelix-dev
PaddleHelix-dev/apps/drug_target_interaction/batchdta/pointwise/GraphDTA/models/gcn.py
"""GraphDTA_GCN backbone model.""" import torch import torch.nn as nn import torch.nn.functional as F from torch_geometric.nn import GCNConv, global_max_pool as gmp # GCN backbone model class GCNNet(torch.nn.Module): """GCN model. Args: data: Input data. Returns: out: Prediction res...
2,487
30.897436
132
py
PaddleHelix-dev
PaddleHelix-dev/apps/drug_target_interaction/batchdta/pointwise/GraphDTA/models/gat.py
"""GraphDTA_GAT backbone model.""" import torch import torch.nn as nn import torch.nn.functional as F from torch.nn import Sequential, Linear, ReLU from torch_geometric.nn import GATConv from torch_geometric.nn import global_max_pool as gmp # GAT backbone model class GATNet(torch.nn.Module): """GAT model. A...
2,428
31.386667
90
py
PaddleHelix-dev
PaddleHelix-dev/apps/drug_target_interaction/batchdta/pointwise/GraphDTA/models/gat_gcn.py
"""GraphDTA_GATGCN backbone model.""" import torch import torch.nn as nn import torch.nn.functional as F from torch.nn import Sequential, Linear, ReLU from torch_geometric.nn import GCNConv, GATConv, GINConv, global_add_pool from torch_geometric.nn import global_mean_pool as gap, global_max_pool as gmp # GATGCN back...
2,577
33.373333
91
py
PaddleHelix-dev
PaddleHelix-dev/apps/drug_target_interaction/batchdta/pointwise/Moltrans/helper/utils/paddle_io.py
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
4,237
29.489209
119
py
PaddleHelix-dev
PaddleHelix-dev/apps/drug_target_interaction/batchdta/pairwise/GraphDTA/run_pairwise_GraphDTA_BindingDB.py
from itertools import combinations import itertools import argparse from random import * import random import pdb from lifelines.utils import concordance_index import functools import random import time import pandas as pd import torch.multiprocessing as mp import torch.distributed as dist from torch.nn.parallel impor...
19,537
37.385069
230
py
PaddleHelix-dev
PaddleHelix-dev/apps/drug_target_interaction/batchdta/pairwise/GraphDTA/processing.py
import pandas as pd import numpy as np import os import rdkit import sklearn import torch import json,pickle from collections import OrderedDict from rdkit import Chem from rdkit.Chem import MolFromSmiles import networkx as nx from torch_geometric.data import InMemoryDataset, DataLoader from utils import * import pdb i...
6,546
29.593458
316
py
PaddleHelix-dev
PaddleHelix-dev/apps/drug_target_interaction/batchdta/pairwise/GraphDTA/utils.py
import os import numpy as np from math import sqrt from scipy import stats from torch_geometric.data import InMemoryDataset, DataLoader from torch_geometric.data import Dataset from torch_geometric import data as DATA import torch import pdb class TrainDataset(Dataset): def __init__(self, root='./', train_x1_index...
9,638
30.603279
168
py
PaddleHelix-dev
PaddleHelix-dev/apps/drug_target_interaction/batchdta/pairwise/GraphDTA/run_pairwise_GraphDTA_CV.py
from itertools import combinations import itertools from random import * import random import pdb from lifelines.utils import concordance_index from sklearn import preprocessing import functools import random import time import pandas as pd import torch.multiprocessing as mp import torch.distributed as dist from torch...
18,993
36.243137
230
py
PaddleHelix-dev
PaddleHelix-dev/apps/drug_target_interaction/batchdta/pairwise/GraphDTA/models/ginconv.py
import torch import torch.nn as nn import torch.nn.functional as F from torch.nn import Sequential, Linear, ReLU from torch_geometric.nn import GINConv, global_add_pool from torch_geometric.nn import global_mean_pool as gap, global_max_pool as gmp # GINConv model class GINConvNet(torch.nn.Module): def __init__(sel...
3,499
34.353535
101
py
PaddleHelix-dev
PaddleHelix-dev/apps/drug_target_interaction/batchdta/pairwise/GraphDTA/models/gcn.py
import torch import torch.nn as nn import torch.nn.functional as F from torch_geometric.nn import GCNConv, global_max_pool as gmp # GCN based model class GCNNet(torch.nn.Module): def __init__(self, n_output=1, n_filters=32, embed_dim=128,num_features_xd=78, num_features_xt=25, output_dim=128, dropout=0.2): ...
2,456
30.101266
132
py
PaddleHelix-dev
PaddleHelix-dev/apps/drug_target_interaction/batchdta/pairwise/GraphDTA/models/gat.py
import torch import torch.nn as nn import torch.nn.functional as F from torch.nn import Sequential, Linear, ReLU from torch_geometric.nn import GATConv from torch_geometric.nn import global_max_pool as gmp # GAT model class GATNet(torch.nn.Module): def __init__(self, num_features_xd=78, n_output=1, num_features_x...
2,418
31.689189
90
py
PaddleHelix-dev
PaddleHelix-dev/apps/drug_target_interaction/batchdta/pairwise/GraphDTA/models/gat_gcn.py
import torch import torch.nn as nn import torch.nn.functional as F from torch.nn import Sequential, Linear, ReLU from torch_geometric.nn import GCNConv, GATConv, GINConv, global_add_pool from torch_geometric.nn import global_mean_pool as gap, global_max_pool as gmp # GCN-CNN based model class GAT_GCN(torch.nn.Module)...
2,495
33.666667
91
py
PaddleHelix-dev
PaddleHelix-dev/apps/drug_target_interaction/batchdta/pairwise/Moltrans/helper/utils/paddle_io.py
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
4,237
29.489209
119
py
PaddleHelix-dev
PaddleHelix-dev/apps/fewshot_molecular_property/chem_lib/models/relation.py
from collections import OrderedDict import paddle import paddle.nn as nn import paddle.nn.functional as F class MLP(nn.Layer): def __init__(self, inp_dim, hidden_dim, num_layers,batch_norm=False, dropout=0.): super(MLP, self).__init__() layer_list = OrderedDict() in_dim = inp_dim f...
13,630
40.685015
142
py
PaddleHelix-dev
PaddleHelix-dev/apps/fewshot_molecular_property/chem_lib/models/maml.py
import paddle.nn as nn import paddlefsl.utils as utils class MAML(nn.Layer): def __init__( self, model, lr, first_order=False, allow_unused=None, allow_nograd=False, anil=False, ): super(MAML, self).__init__() self.layers = model self.lr = lr self.first_order = first_order self.allow...
1,819
26.575758
89
py
PaddleHelix-dev
PaddleHelix-dev/apps/fewshot_molecular_property/chem_lib/datasets/loader.py
import os import json import numpy as np import paddle import pgl.graph as G from pahelix.datasets import InMemoryDataset try: from rdkit import Chem from rdkit.Chem import AllChem allowable_features = { 'possible_atomic_num_list' : list(range(1, 119)), 'possible_formal_charge_list' : [-5, ...
15,028
39.400538
91
py
PaddleHelix-dev
PaddleHelix-dev/apps/protein_folding/helixfold-single/alphafold_paddle/model/modules.py
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
107,160
42.543681
136
py
PaddleHelix-dev
PaddleHelix-dev/apps/protein_folding/helixfold-single/alphafold_paddle/model/utils.py
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
10,196
31.578275
132
py
PaddleHelix-dev
PaddleHelix-dev/apps/protein_folding/helixfold-single/alphafold_paddle/model/model.py
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
9,721
34.097473
84
py
PaddleHelix-dev
PaddleHelix-dev/apps/protein_folding/helixfold/train.py
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
23,213
38.75
152
py
PaddleHelix-dev
PaddleHelix-dev/apps/protein_folding/helixfold/alphafold_paddle/model/modules.py
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
99,940
41.080421
159
py
PaddleHelix-dev
PaddleHelix-dev/apps/protein_folding/helixfold/alphafold_paddle/model/utils.py
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
10,211
31.626198
132
py
PaddleHelix-dev
PaddleHelix-dev/apps/protein_folding/helixfold/alphafold_paddle/model/model.py
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
11,831
36.561905
148
py
PaddleHelix-dev
PaddleHelix-dev/apps/protein_folding/helixfold/utils/misc.py
# copyright (c) 2021 PaddlePaddle Authors. All Rights Reserve. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
4,773
31.040268
97
py
PaddleHelix-dev
PaddleHelix-dev/apps/pretrained_compound/ChemRL/GEM-2/src/dataset.py
#!/usr/bin/python #-*-coding:utf-8-*- # Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance wi...
2,678
32.911392
113
py
PaddleHelix-dev
PaddleHelix-dev/apps/protein_function_prediction/PTHL/layers.py
import paddle from paddle import nn import paddle.nn.functional as F from utils import _norm_no_nan import pgl import pgl.math as math class GVP(nn.Layer): ''' Paddle version of the GVP proposed by https://github.com/drorlab/gvp-pytorch ''' def __init__(self, in_dims, out_dims, h_dim=None, activatio...
3,468
31.12037
104
py
PaddleHelix-dev
PaddleHelix-dev/pahelix/utils/metrics/molecular_generation/metrics_.py
#!/usr/bin/python3 #-*-coding:utf-8-*- # Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance w...
12,863
33.580645
114
py
PaddleHelix-dev
PaddleHelix-dev/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...
3,510
30.348214
175
py
PaddleHelix-dev
PaddleHelix-dev/competition/kddcup2021-PCQM4M-LSC/models/conv.py
import numpy as np import paddle import paddle.nn as nn import paddle.nn.functional as F import pgl import pgl.nn as gnn from pgl.utils.logger import log import models.mol_encoder as ME import models.layers as L class LiteGEM(paddle.nn.Layer): def __init__(self, config, with_efeat=False): super(LiteGEM, ...
13,481
38.421053
182
py
PaddleHelix-dev
PaddleHelix-dev/competition/kddcup2021-PCQM4M-LSC/ensemble/ensemble.py
import os import os.path as osp import glob import pickle import numpy as np import pandas as pd import sklearn import sklearn.linear_model import torch def mae(pred, true): return np.mean(np.abs(pred-true)) model_root = "./model_pred" max_min_drop_rate = 0.2 # <=0 means no drop, should < 0.5 split_idx = t...
4,960
36.022388
92
py
PaddleHelix-dev
PaddleHelix-dev/competition/ogbg_molhiv/main.py
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applic...
6,215
32.967213
88
py
interpretability
interpretability-master/context-atlas/preprocess.py
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
6,574
30.45933
102
py
interpretability
interpretability-master/text-dream/python/dream/mlm.py
# Copyright 2018 Google LLC. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
3,024
37.782051
80
py
interpretability
interpretability-master/text-dream/python/dream/dream.py
# Copyright 2018 Google LLC. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
13,732
46.355172
80
py
interpretability
interpretability-master/text-dream/python/dream/reconstruct_changed_activation.py
# Copyright 2018 Google LLC. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
11,710
45.472222
82
py
interpretability
interpretability-master/text-dream/python/dream/dream_mlm.py
# Copyright 2018 Google LLC. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
14,960
46.646497
80
py