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
end-to-end-asd
end-to-end-asd-main/experiment_config.py
import torch.nn as nn import torch.optim as optim import models.graph_models as g3d EASEE_R3D_18_inputs = { # input files 'csv_train_full': '/Dataset/ava_active_speaker/csv/ava_activespeaker_train_augmented.csv', 'csv_val_full': '/Dataset/ava_active_speaker/csv/ava_activespeaker_val_augmented.csv', '...
2,020
27.871429
94
py
end-to-end-asd
end-to-end-asd-main/easee_R3D50.py
import os import torch import experiment_config as exp_conf import util.custom_transforms as ct from torchvision import transforms from torch_geometric.loader import DataLoader from torch.optim.lr_scheduler import MultiStepLR from ez_io.logging import setup_optim_outputs from datasets.graph_datasets import Independe...
4,566
43.77451
108
py
end-to-end-asd
end-to-end-asd-main/easee_R3D18.py
import os import sys import torch import experiment_config as exp_conf import util.custom_transforms as ct from torchvision import transforms from torch_geometric.loader import DataLoader from torch.optim.lr_scheduler import MultiStepLR from ez_io.logging import setup_optim_outputs from datasets.graph_datasets impor...
4,585
43.524272
108
py
end-to-end-asd
end-to-end-asd-main/models/shared_3d.py
import math from functools import partial import torch import torch.nn as nn import torch.nn.functional as F def get_inplanes(): return [64, 128, 256, 512] def conv3x3x3(in_planes, out_planes, stride=1): return nn.Conv3d(in_planes, out_planes, kernel_size=3, stride=stride, padding=1, b...
2,293
23.666667
73
py
end-to-end-asd
end-to-end-asd-main/models/shared_2d.py
import torch.nn as nn from torch import Tensor from typing import Type, Any, Callable, Union, List, Optional def conv3x3(in_planes: int, out_planes: int, stride: int = 1, groups: int = 1, dilation: int = 1) -> nn.Conv2d: """3x3 convolution with padding""" return nn.Conv2d(in_planes, out_planes, kernel_size=3,...
3,514
33.80198
111
py
end-to-end-asd
end-to-end-asd-main/models/graph_models.py
import torch import torch.nn as nn import torch.nn.parameter from functools import partial from torch_geometric.nn import EdgeConv from models.graph_layouts import generate_av_mask from models.shared_2d import BasicBlock2D, conv1x1 from models.shared_3d import BasicBlock3D, Bottleneck3D, conv1x1x1, get_inplanes try...
15,486
39.225974
146
py
end-to-end-asd
end-to-end-asd-main/util/custom_transforms.py
from torchvision import transforms video_train = transforms.Compose([ transforms.ToTensor(), transforms.Normalize((0.3729, 0.2850, 0.2439), (0.2286, 0.2008, 0.1911)) ]) video_val = transforms.Compose([ transforms.ToTensor(), transforms.Normalize((0.3729, 0.2850, 0.2439), (0.2286, 0.2008, 0.1911)) ])
318
28
76
py
end-to-end-asd
end-to-end-asd-main/util/augmentations.py
import random from PIL import Image from torchvision.transforms import RandomCrop from torchvision.transforms.functional import hflip def video_temporal_crop(video_data, crop_ratio): # random flip if bool(random.getrandbits(1)): video_data = [s.transpose(Image.FLIP_LEFT_RIGHT) for s in video_data] ...
814
27.103448
98
py
end-to-end-asd
end-to-end-asd-main/datasets/graph_datasets.py
import os import math import torch import random import numpy as np import ez_io.io_ava as io import util.clip_utils as cu from torch_geometric.data import Data, Dataset from ez_io.file_util import csv_to_list, postprocess_speech_label, postprocess_entity_label from util.augmentations import video_temporal_crop, vide...
14,316
40.259366
176
py
end-to-end-asd
end-to-end-asd-main/optimization/losses.py
import torch import torch.nn as nn class assignation_loss_audio(torch.nn.Module): def __init__(self, graph_size): super(assignation_loss_audio, self).__init__() self.graph_size = graph_size self.softmax_layer = torch.nn.Softmax(dim=1) def forward(self, outputs, audio_targets): ...
749
33.090909
71
py
end-to-end-asd
end-to-end-asd-main/optimization/optimization_amp.py
import os import torch from torch.cuda.amp import autocast from models.graph_layouts import generate_av_mask from sklearn.metrics import average_precision_score from models.graph_layouts import generate_temporal_video_center_mask, generate_temporal_video_mask def optimize_easee(model, dataloader_train, data_loader_...
7,919
39.615385
128
py
JEMPP
JEMPP-master/eval_jempp.py
# coding=utf-8 # Copyright 2019 The Google Research Authors. # # 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 applicab...
25,406
37.730183
147
py
JEMPP
JEMPP-master/train_jempp.py
# coding=utf-8 # Copyright 2019 The Google Research Authors. # # 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 applicab...
17,931
43.606965
166
py
JEMPP
JEMPP-master/utils.py
import os import torch import torch as t import torch.nn as nn import torchvision as tv import torchvision.transforms as tr from torch.utils.data import DataLoader, Dataset import numpy as np from torch.nn.modules.loss import _Loss from ExpUtils import AverageMeter class Hamiltonian(_Loss): def __init__(self, la...
7,385
32.572727
139
py
JEMPP
JEMPP-master/ExpUtils.py
import os import sys import json import time import socket import shutil import signal import logging from functools import partial import torch import numpy as np import tensorboardX as tbX import matplotlib.pyplot as plt logging.basicConfig(level=logging.INFO, format="%(asctime)s: %(filename)s[%(lineno)d]: %(messa...
12,387
31.686016
131
py
JEMPP
JEMPP-master/Task/data.py
from tensorflow.python.platform import flags from tensorflow.contrib.data.python.ops import batching import tensorflow as tf import json from torch.utils.data import Dataset import pickle import os.path as osp import os import numpy as np import time from scipy.misc import imread, imresize from torchvision.datasets imp...
19,913
33.512998
135
py
JEMPP
JEMPP-master/Task/calibration.py
import random import torch import torch.nn as nn import torch.nn.functional as F import numpy as np import matplotlib.pyplot as plt import seaborn as sns def expected_calibration_error(predictions, truths, confidences, bin_size=0.1, title='demo'): upper_bounds = np.arange(bin_size, 1 + bin_size, bin_size) ac...
8,434
39.748792
169
py
JEMPP
JEMPP-master/Task/eval_buffer.py
import os import torch as t import numpy as np from torch.utils.data import DataLoader from tqdm import tqdm def norm_ip(img, min, max): temp = t.clamp(img, min=min, max=max) temp = (temp + -min) / (max - min + 1e-5) return temp def eval_fid(f, replay_buffer, args): from Task.inception import get_in...
1,753
28.728814
120
py
JEMPP
JEMPP-master/models/jem_models.py
import torch as t import torch.nn as nn from models import wideresnet import models from models import wideresnet_yopo im_sz = 32 n_ch = 3 class F(nn.Module): def __init__(self, depth=28, width=2, norm=None, dropout_rate=0.0, n_classes=10, model='wrn', args=None): super(F, self).__init__() # defau...
2,494
32.716216
130
py
JEMPP
JEMPP-master/models/norms.py
# coding=utf-8 # Copyright 2019 The Google Research Authors. # # 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 applicab...
5,894
33.881657
107
py
JEMPP
JEMPP-master/models/wideresnet_yopo.py
# coding=utf-8 # Copyright 2019 The Google Research Authors. # # 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 applicab...
4,536
35.58871
98
py
JEMPP
JEMPP-master/models/wideresnet.py
# coding=utf-8 # Copyright 2019 The Google Research Authors. # # 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 applicab...
4,325
35.974359
105
py
DiT
DiT-main/sample.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. """ Sample new images from a pre-trained DiT. """ import torch torch.backends.cuda.matmul.allow_tf32 = True torch.backends...
3,269
37.928571
120
py
DiT
DiT-main/download.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. """ Functions for downloading pre-trained DiT models """ from torchvision.datasets.utils import download_url import torch ...
1,713
32.607843
111
py
DiT
DiT-main/sample_ddp.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. """ Samples a large number of images from a pre-trained DiT model using DDP. Subsequently saves a .npz file that can be us...
7,411
43.383234
120
py
DiT
DiT-main/models.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # -------------------------------------------------------- # References: # GLIDE: https://github.com/openai/glide-text2im #...
14,995
39.420485
113
py
DiT
DiT-main/train.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. """ A minimal training script for DiT using PyTorch DDP. """ import torch # the first flag below was False when we tested ...
10,949
39.555556
132
py
DiT
DiT-main/diffusion/timestep_sampler.py
# Modified from OpenAI's diffusion repos # GLIDE: https://github.com/openai/glide-text2im/blob/main/glide_text2im/gaussian_diffusion.py # ADM: https://github.com/openai/guided-diffusion/blob/main/guided_diffusion # IDDPM: https://github.com/openai/improved-diffusion/blob/main/improved_diffusion/gaussian_d...
6,013
38.827815
108
py
DiT
DiT-main/diffusion/gaussian_diffusion.py
# Modified from OpenAI's diffusion repos # GLIDE: https://github.com/openai/glide-text2im/blob/main/glide_text2im/gaussian_diffusion.py # ADM: https://github.com/openai/guided-diffusion/blob/main/guided_diffusion # IDDPM: https://github.com/openai/improved-diffusion/blob/main/improved_diffusion/gaussian_d...
34,326
38.275744
129
py
DiT
DiT-main/diffusion/diffusion_utils.py
# Modified from OpenAI's diffusion repos # GLIDE: https://github.com/openai/glide-text2im/blob/main/glide_text2im/gaussian_diffusion.py # ADM: https://github.com/openai/guided-diffusion/blob/main/guided_diffusion # IDDPM: https://github.com/openai/improved-diffusion/blob/main/improved_diffusion/gaussian_d...
3,189
34.842697
108
py
DiT
DiT-main/diffusion/respace.py
# Modified from OpenAI's diffusion repos # GLIDE: https://github.com/openai/glide-text2im/blob/main/glide_text2im/gaussian_diffusion.py # ADM: https://github.com/openai/guided-diffusion/blob/main/guided_diffusion # IDDPM: https://github.com/openai/improved-diffusion/blob/main/improved_diffusion/gaussian_d...
5,485
41.2
108
py
FATE
FATE-master/examples/pipeline/homo_nn/pipeline_homo_nn_train_binary.py
# # Copyright 2019 The FATE 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 appli...
3,330
34.817204
120
py
FATE
FATE-master/examples/pipeline/homo_nn/pipeline_homo_nn_train_regression.py
# # Copyright 2019 The FATE 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 appli...
3,333
35.637363
120
py
FATE
FATE-master/examples/pipeline/homo_nn/pipeline_homo_nn_train_multi.py
# # Copyright 2019 The FATE 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 appli...
3,628
37.2
120
py
FATE
FATE-master/examples/pipeline/homo_nn/pipeline_homo_nn_aggregate_n_epoch.py
# # Copyright 2019 The FATE 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 appli...
3,357
35.107527
120
py
FATE
FATE-master/examples/pipeline/hetero_ftl/pipeline-hetero-ftl-with-predict.py
# # Copyright 2019 The FATE 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 appli...
3,842
37.818182
103
py
FATE
FATE-master/examples/pipeline/hetero_ftl/pipeline-hetero-ftl-encrypted.py
# # Copyright 2019 The FATE 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 appli...
3,286
38.60241
103
py
FATE
FATE-master/examples/pipeline/hetero_ftl/pipeline-hetero-ftl-communication-efficient.py
# # Copyright 2019 The FATE 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 appli...
3,471
38.908046
103
py
FATE
FATE-master/examples/pipeline/hetero_ftl/pipeline-hetero-ftl-plain.py
# # Copyright 2019 The FATE 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 appli...
3,282
38.554217
103
py
FATE
FATE-master/examples/pipeline/hetero_nn/pipeline-hetero-nn-train-binary-selective-bp.py
# # Copyright 2019 The FATE 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 appli...
4,307
35.201681
117
py
FATE
FATE-master/examples/pipeline/hetero_nn/pipeline-hetero-nn-train-binary-drop-out.py
# # Copyright 2019 The FATE 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 appli...
4,241
34.949153
116
py
FATE
FATE-master/examples/pipeline/hetero_nn/pipeline-hetero-nn-train-with-early-stop.py
# # Copyright 2019 The FATE 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 appli...
5,533
39.101449
110
py
FATE
FATE-master/examples/pipeline/hetero_nn/pipeline-hetero-nn-train-binary.py
# # Copyright 2019 The FATE 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 appli...
4,154
35.130435
116
py
FATE
FATE-master/examples/pipeline/hetero_nn/pipeline-hetero-nn-train-binary-coae.py
# # Copyright 2019 The FATE 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 appli...
4,957
36.560606
118
py
FATE
FATE-master/examples/pipeline/hetero_nn/pipeline-hetero-nn-train-binary-multi-host.py
# # Copyright 2019 The FATE 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 appli...
4,613
37.45
116
py
FATE
FATE-master/examples/pipeline/hetero_nn/pipeline-hetero-nn-train-with-check-point.py
# # Copyright 2019 The FATE 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 appli...
4,374
35.458333
110
py
FATE
FATE-master/examples/pipeline/hetero_nn/pipeline-hetero-nn-train-with-warm_start.py
# # Copyright 2019 The FATE 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 appli...
4,500
36.508333
117
py
FATE
FATE-master/examples/pipeline/hetero_nn/pipeline-hetero-nn-train-multi.py
# # Copyright 2019 The FATE 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 appli...
4,593
37.283333
117
py
FATE
FATE-master/examples/pipeline/homo_graph/pipeline_homo_graph_sage.py
# # Copyright 2019 The FATE 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 appli...
3,919
38.59596
117
py
FATE
FATE-master/examples/benchmark_quality/homo_nn/local-homo_nn.py
# # Copyright 2019 The FATE 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 appli...
3,738
27.761538
76
py
FATE
FATE-master/examples/benchmark_quality/homo_nn/fate-homo_nn.py
# # Copyright 2019 The FATE 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 appli...
7,460
34.870192
120
py
FATE
FATE-master/examples/benchmark_quality/hetero_nn/local-hetero_nn.py
import argparse import numpy as np import os import pandas from sklearn import metrics from pipeline.utils.tools import JobConfig import torch as t from torch import nn from pipeline import fate_torch_hook from torch.utils.data import DataLoader, TensorDataset from federatedml.nn.backend.utils.common import global_se...
4,651
27.365854
79
py
FATE
FATE-master/examples/benchmark_quality/hetero_nn/fate-hetero_nn.py
# # Copyright 2019 The FATE 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 appli...
7,650
32.853982
81
py
FATE
FATE-master/examples/benchmark_quality/hetero_nn_pytorch/local-hetero_nn.py
import argparse import numpy as np import os from tensorflow import keras import pandas import tensorflow as tf from tensorflow.keras.utils import to_categorical from tensorflow.keras import optimizers from sklearn import metrics from pipeline.utils.tools import JobConfig from sklearn.preprocessing import LabelEncoder ...
4,792
30.741722
97
py
FATE
FATE-master/examples/benchmark_quality/hetero_nn_pytorch/fate-hetero_nn.py
import argparse from collections import OrderedDict from pipeline.backend.pipeline import PipeLine from pipeline.component import DataTransform from pipeline.component import HeteroNN from pipeline.component import Intersection from pipeline.component import Reader from pipeline.component import Evaluation from pipelin...
6,139
40.768707
116
py
FATE
FATE-master/python/fate_test/fate_test/scripts/data_cli.py
import os import re import sys import time import uuid import json from datetime import timedelta import click from pathlib import Path from ruamel import yaml from fate_test import _config from fate_test._config import Config from fate_test._client import Clients from fate_test._io import LOGGER, echo from fate_test...
19,039
43.176334
119
py
FATE
FATE-master/python/fate_client/setup.py
# -*- coding: utf-8 -*- from setuptools import setup packages = [ "flow_client", "flow_client.flow_cli", "flow_client.flow_cli.commands", "flow_client.flow_cli.utils", "flow_sdk", "flow_sdk.client", "flow_sdk.client.api", "pipeline", "pipeline.backend", "pipeline.component", ...
2,995
43.058824
1,418
py
FATE
FATE-master/python/fate_client/pipeline/__init__.py
try: from pipeline.component.nn.backend.torch.import_hook import fate_torch_hook from pipeline.component.nn.backend import torch as fate_torch except ImportError: fate_torch_hook, fate_torch = None, None except ValueError: fate_torch_hook, fate_torch = None, None __all__ = ['fate_torch_hook', 'fate_tor...
325
31.6
79
py
FATE
FATE-master/python/fate_client/pipeline/param/ftl_param.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2019 The FATE 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/lic...
7,810
47.216049
127
py
FATE
FATE-master/python/fate_client/pipeline/param/hetero_nn_param.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2019 The FATE 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/lic...
12,330
41.37457
139
py
FATE
FATE-master/python/fate_client/pipeline/param/boosting_param.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2019 The FATE 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/lic...
35,176
47.253772
134
py
FATE
FATE-master/python/fate_client/pipeline/param/homo_nn_param.py
from pipeline.param.base_param import BaseParam class TrainerParam(BaseParam): def __init__(self, trainer_name=None, **kwargs): super(TrainerParam, self).__init__() self.trainer_name = trainer_name self.param = kwargs def check(self): if self.trainer_name is not None: ...
2,340
31.971831
107
py
FATE
FATE-master/python/fate_client/pipeline/component/hetero_ftl.py
# # Copyright 2019 The FATE 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 appli...
3,526
35.739583
95
py
FATE
FATE-master/python/fate_client/pipeline/component/homo_nn.py
# # Copyright 2019 The FATE 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 appli...
8,452
41.691919
136
py
FATE
FATE-master/python/fate_client/pipeline/component/__init__.py
from pipeline.component.column_expand import ColumnExpand from pipeline.component.data_statistics import DataStatistics from pipeline.component.dataio import DataIO from pipeline.component.data_transform import DataTransform from pipeline.component.evaluation import Evaluation from pipeline.component.hetero_data_split ...
3,628
37.606383
141
py
FATE
FATE-master/python/fate_client/pipeline/component/hetero_nn.py
# # Copyright 2019 The FATE 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 appli...
11,564
43.141221
134
py
FATE
FATE-master/python/fate_client/pipeline/component/nn/models/sequantial.py
# # Copyright 2019 The FATE 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 appli...
3,465
34.731959
112
py
FATE
FATE-master/python/fate_client/pipeline/component/nn/models/keras_interface.py
# # Copyright 2019 The FATE 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 appli...
2,295
28.435897
91
py
FATE
FATE-master/python/fate_client/pipeline/component/nn/backend/torch/import_hook.py
try: from pipeline.component.nn.backend.torch import nn as nn_ from pipeline.component.nn.backend.torch import init as init_ from pipeline.component.nn.backend.torch import optim as optim_ from pipeline.component.nn.backend.torch.cust import CustModel, CustLoss from pipeline.component.nn.backend.tor...
1,920
36.666667
101
py
FATE
FATE-master/python/fate_client/pipeline/component/nn/backend/torch/base.py
import json import torch as t from torch.nn import Sequential as tSequential from pipeline.component.nn.backend.torch.operation import OpBase class FateTorchLayer(object): def __init__(self): t.nn.Module.__init__(self) self.param_dict = dict() self.initializer = {'weight': None, 'bias': N...
4,209
26.880795
81
py
FATE
FATE-master/python/fate_client/pipeline/component/nn/backend/torch/optim.py
from torch import optim from pipeline.component.nn.backend.torch.base import FateTorchOptimizer class ASGD(optim.ASGD, FateTorchOptimizer): def __init__( self, params=None, lr=0.01, lambd=0.0001, alpha=0.75, t0=1000000.0, weight_decay=0, foreach=Non...
12,959
30.228916
118
py
FATE
FATE-master/python/fate_client/pipeline/component/nn/backend/torch/cust.py
from torch import nn import importlib from pipeline.component.nn.backend.torch.base import FateTorchLayer, FateTorchLoss import difflib MODEL_PATH = None LOSS_PATH = None def str_simi(str_a, str_b): return difflib.SequenceMatcher(None, str_a, str_b).quick_ratio() def get_class(module_name, class_name, param, ...
4,188
36.738739
119
py
FATE
FATE-master/python/fate_client/pipeline/component/nn/backend/torch/init.py
import copy import torch as t from torch.nn import init as torch_init import functools from pipeline.component.nn.backend.torch.base import FateTorchLayer from pipeline.component.nn.backend.torch.base import Sequential str_init_func_map = { "uniform": torch_init.uniform_, "normal": torch_init.normal_, "con...
6,775
25.677165
89
py
FATE
FATE-master/python/fate_client/pipeline/component/nn/backend/torch/nn.py
from pipeline.component.nn.backend.torch.base import FateTorchLayer, FateTorchLoss from pipeline.component.nn.backend.torch.base import Sequential from torch import nn class Bilinear(nn.modules.linear.Bilinear, FateTorchLayer): def __init__( self, in1_features, in2_features, ...
81,792
32.412173
82
py
FATE
FATE-master/python/fate_client/pipeline/component/nn/backend/torch/interactive.py
import torch as t from torch.nn import ReLU, Linear, LazyLinear, Tanh, Sigmoid, Dropout, Sequential from pipeline.component.nn.backend.torch.base import FateTorchLayer class InteractiveLayer(t.nn.Module, FateTorchLayer): r"""A :class: InteractiveLayer. An interface for InteractiveLayer. In interactive...
5,522
34.178344
113
py
FATE
FATE-master/python/fate_client/pipeline/component/nn/backend/torch/__init__.py
try: from pipeline.component.nn.backend.torch import nn, init, operation, optim, serialization except ImportError: nn, init, operation, optim, serialization = None, None, None, None, None __all__ = ['nn', 'init', 'operation', 'optim', 'serialization']
261
36.428571
93
py
FATE
FATE-master/python/fate_client/pipeline/component/nn/backend/torch/operation.py
import torch import torch as t import copy from torch.nn import Module class OpBase(object): def __init__(self): self.param_dict = {} def to_dict(self): ret = copy.deepcopy(self.param_dict) ret['op'] = type(self).__name__ return ret class Astype(Module, OpBase): def __...
3,488
23.570423
89
py
FATE
FATE-master/python/fate_client/pipeline/component/nn/backend/torch/serialization.py
import copy import inspect from collections import OrderedDict try: from torch.nn import Sequential as tSeq from pipeline.component.nn.backend.torch import optim, init, nn from pipeline.component.nn.backend.torch import operation from pipeline.component.nn.backend.torch.base import Sequential, get_torch...
4,867
37.03125
100
py
FATE
FATE-master/python/fate_client/flow_client/flow_cli/commands/model.py
# # Copyright 2019 The FATE 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 appli...
17,583
35.941176
120
py
FATE
FATE-master/python/federatedml/nn/model_zoo/graphsage.py
import torch as t from torch import nn from torch.nn import Module import torch_geometric.nn as pyg class Sage(nn.Module): def __init__(self, in_channels, hidden_channels, class_num): super().__init__() self.model = nn.ModuleList([ pyg.SAGEConv(in_channels=in_channels, out_channels=hid...
702
29.565217
94
py
FATE
FATE-master/python/federatedml/nn/model_zoo/homographsage.py
import torch as t from torch import nn from torch.nn import Module import torch_geometric.nn as pyg class Sage(nn.Module): def __init__(self, in_channels, hidden_channels, class_num): super().__init__() self.model = nn.ModuleList([ pyg.SAGEConv(in_channels=in_channels, out_channels=hi...
703
28.333333
94
py
FATE
FATE-master/python/federatedml/nn/model_zoo/vision.py
import torch as t from torchvision.models import get_model class TorchVisionModels(t.nn.Module): """ This Class provides ALL torchvision classification models, instantiate models and using pretrained weights by providing string model name and weight names Parameters ---------- vision_model_na...
1,062
38.37037
114
py
FATE
FATE-master/python/federatedml/nn/model_zoo/pretrained_bert.py
from transformers.models.bert import BertModel from torch.nn import Module from federatedml.util import LOGGER class PretrainedBert(Module): def __init__(self, pretrained_model_name_or_path: str = 'bert-base-uncased', freeze_weight=False): """ A pretrained Bert Model based on transformers ...
1,566
38.175
117
py
FATE
FATE-master/python/federatedml/nn/dataset/base.py
from torch.utils.data import Dataset as Dataset_ from federatedml.nn.backend.utils.common import ML_PATH, LLM_PATH import importlib import abc import numpy as np class Dataset(Dataset_): def __init__(self, **kwargs): super(Dataset, self).__init__() self._type = 'local' # train/predict se...
5,430
28.677596
119
py
FATE
FATE-master/python/federatedml/nn/dataset/image.py
import torch from federatedml.nn.dataset.base import Dataset from torchvision.datasets import ImageFolder from torchvision import transforms import numpy as np class ImageDataset(Dataset): """ A basic Image Dataset built on pytorch ImageFolder, supports simple image transform Given a folder path, ImageD...
3,837
35.552381
119
py
FATE
FATE-master/python/federatedml/nn/dataset/graph.py
import numpy as np import pandas as pd from federatedml.statistic.data_overview import with_weight from federatedml.nn.dataset.base import Dataset try: from torch_geometric.data import Data except BaseException: pass import torch from federatedml.util import LOGGER class GraphDataset(Dataset): """ A...
4,680
39.353448
145
py
FATE
FATE-master/python/federatedml/nn/backend/torch/import_hook.py
try: from federatedml.component.nn.backend.torch import nn as nn_ from federatedml.component.nn.backend.torch import init as init_ from federatedml.component.nn.backend.torch import optim as optim_ from federatedml.component.nn.backend.torch.cust import CustModel, CustLoss from federatedml.nn.backen...
1,925
36.764706
101
py
FATE
FATE-master/python/federatedml/nn/backend/torch/base.py
import json import torch as t from torch.nn import Sequential as tSequential from federatedml.nn.backend.torch.operation import OpBase class FateTorchLayer(object): def __init__(self): t.nn.Module.__init__(self) self.param_dict = dict() self.initializer = {'weight': None, 'bias': None} ...
4,203
26.657895
81
py
FATE
FATE-master/python/federatedml/nn/backend/torch/optim.py
from torch import optim from federatedml.nn.backend.torch.base import FateTorchLayer, Sequential from federatedml.nn.backend.torch.base import FateTorchOptimizer class ASGD(optim.ASGD, FateTorchOptimizer): def __init__( self, params=None, lr=0.01, lambd=0.0001, alpha=0.75,...
13,025
30.3125
118
py
FATE
FATE-master/python/federatedml/nn/backend/torch/cust_model.py
import importlib from torch import nn from federatedml.nn.backend.torch.base import FateTorchLayer from federatedml.nn.backend.utils.common import ML_PATH PATH = '{}.model_zoo'.format(ML_PATH) class CustModel(FateTorchLayer, nn.Module): def __init__(self, module_name, class_name, **kwargs): super(Cust...
1,984
34.446429
97
py
FATE
FATE-master/python/federatedml/nn/backend/torch/cust.py
from torch import nn import importlib from federatedml.nn.backend.torch.base import FateTorchLayer, FateTorchLoss from federatedml.nn.backend.utils.common import ML_PATH, LLM_PATH import difflib LLM_MODEL_PATH = '{}.model_zoo'.format(LLM_PATH) MODEL_PATH = '{}.model_zoo'.format(ML_PATH) LOSS_PATH = '{}.loss'.format(M...
4,907
34.057143
118
py
FATE
FATE-master/python/federatedml/nn/backend/torch/init.py
import copy import torch as t from torch.nn import init as torch_init import functools from federatedml.nn.backend.torch.base import FateTorchLayer from federatedml.nn.backend.torch.base import Sequential str_init_func_map = { "uniform": torch_init.uniform_, "normal": torch_init.normal_, "constant": torch_...
6,761
25.622047
89
py
FATE
FATE-master/python/federatedml/nn/backend/torch/nn.py
from torch import nn from federatedml.nn.backend.torch.base import FateTorchLayer, FateTorchLoss from federatedml.nn.backend.torch.base import Sequential class Bilinear(nn.modules.linear.Bilinear, FateTorchLayer): def __init__( self, in1_features, in2_features, out...
81,778
32.406454
79
py
FATE
FATE-master/python/federatedml/nn/backend/torch/interactive.py
import torch as t from torch.nn import ReLU, Linear, LazyLinear, Tanh, Sigmoid, Dropout, Sequential from federatedml.nn.backend.torch.base import FateTorchLayer class InteractiveLayer(t.nn.Module, FateTorchLayer): r"""A :class: InteractiveLayer. An interface for InteractiveLayer. In interactive layer...
5,516
33.917722
113
py
FATE
FATE-master/python/federatedml/nn/backend/torch/__init__.py
try: from federatedml.nn.backend.torch import nn, init, operation, optim, serialization except ImportError: nn, init, operation, optim, serialization = None, None, None, None, None __all__ = ['nn', 'init', 'operation', 'optim', 'serialization']
254
35.428571
86
py
FATE
FATE-master/python/federatedml/nn/backend/torch/operation.py
import torch as t import copy from torch.nn import Module class OpBase(object): def __init__(self): self.param_dict = {} def to_dict(self): ret = copy.deepcopy(self.param_dict) ret['op'] = type(self).__name__ return ret class Astype(Module, OpBase): def __init__(self, ...
3,475
23.652482
89
py
FATE
FATE-master/python/federatedml/nn/backend/torch/serialization.py
import copy import inspect from collections import OrderedDict try: from torch.nn import Sequential as tSeq from federatedml.nn.backend.torch import optim, init, nn from federatedml.nn.backend.torch import operation from federatedml.nn.backend.torch.base import Sequential, get_torch_instance from fe...
4,832
36.757813
100
py
FATE
FATE-master/python/federatedml/nn/backend/torch/torch_modules_extract/extract_pytorch_modules.py
import inspect from torch.nn.modules import linear, activation, rnn, dropout, sparse, pooling, conv, transformer, batchnorm from torch.nn.modules import padding, pixelshuffle from torch.nn.modules import loss class Required(object): def __init__(self): pass def __repr__(self): return '(Requi...
3,479
27.064516
108
py
FATE
FATE-master/python/federatedml/nn/backend/torch/torch_modules_extract/extract_pytorch_optim.py
import inspect from torch import optim from federatedml.nn.backend.torch.torch_modules_extract.extract_pytorch_modules import extract_init_param, Required from torch.optim.optimizer import required def code_assembly(param, nn_class): para_str = "" non_default_param = "" init_str = """""" special_param...
2,304
27.45679
121
py
FATE
FATE-master/python/federatedml/nn/backend/torch/test/test_cust_model.py
from federatedml.nn.backend.torch import nn, init import json from federatedml.nn.backend.torch import serialization as s import torch as t from federatedml.nn.backend.torch.import_hook import fate_torch_hook from federatedml.nn.backend.torch.cust import CustModel fate_torch_hook(t) cust_resnet = CustModel(name='resn...
713
31.454545
77
py