repo
stringlengths
2
99
file
stringlengths
13
225
code
stringlengths
0
18.3M
file_length
int64
0
18.3M
avg_line_length
float64
0
1.36M
max_line_length
int64
0
4.26M
extension_type
stringclasses
1 value
FATE
FATE-master/python/fate_client/pipeline/component/hetero_lr.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...
1,343
35.324324
75
py
FATE
FATE-master/python/fate_client/pipeline/component/nn/__init__.py
from pipeline.component.nn.interface import save_to_fate, save_to_fate_llm, DatasetParam, TrainerParam __all__ = ["save_to_fate_llm", "DatasetParam", "TrainerParam"]
167
41
102
py
FATE
FATE-master/python/fate_client/pipeline/component/nn/interface.py
from pipeline.param.base_param import BaseParam import sys def not_working_save_to_fate(*args, **kwargs): raise ValueError( 'save to fate not working, please check if your ipython is installed, ' 'and if ipython.get_ipython() is working') def not_working_save_to_fate_llm(*args, **kwargs): ra...
5,089
32.486842
215
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/models/__init__.py
0
0
0
py
FATE
FATE-master/python/fate_client/pipeline/component/nn/backend/__init__.py
0
0
0
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.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,142
38.464088
116
py
FATE
FATE-master/python/fate_client/flow_client/__init__.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...
616
37.5625
75
py
FATE
FATE-master/python/fate_client/flow_client/flow_cli/__init__.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...
616
37.5625
75
py
FATE
FATE-master/python/fate_client/flow_client/flow_cli/commands/checkpoint.py
# # Copyright 2021 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...
1,956
33.333333
86
py
FATE
FATE-master/python/fate_client/flow_client/flow_cli/commands/test.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...
9,661
38.761317
120
py
FATE
FATE-master/python/fate_client/flow_client/flow_cli/commands/resource.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...
1,750
26.793651
82
py
FATE
FATE-master/python/fate_client/flow_client/flow_cli/commands/table.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...
6,001
24.218487
97
py
FATE
FATE-master/python/fate_client/flow_client/flow_cli/commands/task.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...
1,886
25.957143
76
py
FATE
FATE-master/python/fate_client/flow_client/flow_cli/commands/queue.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...
1,182
25.886364
75
py
FATE
FATE-master/python/fate_client/flow_client/flow_cli/commands/template.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,044
31.983871
111
py
FATE
FATE-master/python/fate_client/flow_client/flow_cli/commands/server.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...
1,482
31.23913
94
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/fate_client/flow_client/flow_cli/commands/privilege.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,272
25.126437
90
py
FATE
FATE-master/python/fate_client/flow_client/flow_cli/commands/tag.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,699
27.90625
119
py
FATE
FATE-master/python/fate_client/flow_client/flow_cli/commands/data.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,063
32.098039
131
py
FATE
FATE-master/python/fate_client/flow_client/flow_cli/commands/component.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...
13,399
35.021505
332
py
FATE
FATE-master/python/fate_client/flow_client/flow_cli/commands/service.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...
1,273
31.666667
94
py
FATE
FATE-master/python/fate_client/flow_client/flow_cli/commands/key.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,153
23.758621
83
py
FATE
FATE-master/python/fate_client/flow_client/flow_cli/commands/__init__.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...
616
37.5625
75
py
FATE
FATE-master/python/fate_client/flow_client/flow_cli/commands/job.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...
10,950
32.695385
197
py
FATE
FATE-master/python/fate_client/flow_client/flow_cli/commands/tracking.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,924
36.343096
118
py
FATE
FATE-master/python/fate_client/flow_client/flow_cli/commands/provider.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,094
33.916667
94
py
FATE
FATE-master/python/fate_client/flow_client/flow_cli/utils/cli_utils.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,929
32.179916
101
py
FATE
FATE-master/python/fate_client/flow_client/flow_cli/utils/detect_utils.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...
1,522
42.514286
101
py
FATE
FATE-master/python/fate_client/flow_client/flow_cli/utils/__init__.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...
616
37.5625
75
py
FATE
FATE-master/python/fate_client/flow_client/flow_cli/utils/cli_args.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,116
59.313559
118
py
FATE
FATE-master/python/fate_client/flow_sdk/utils.py
import os import json import socket import time import typing import tarfile import datetime from enum import Enum, IntEnum PROJECT_BASE = os.getenv("FATE_DEPLOY_BASE") def start_cluster_standalone_job_server(): print("use service.sh to start standalone node server....") os.system("sh service.sh start --stan...
5,047
28.694118
85
py
FATE
FATE-master/python/fate_client/flow_sdk/__init__.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...
616
37.5625
75
py
FATE
FATE-master/python/fate_client/flow_sdk/client/base.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,394
34.443548
114
py
FATE
FATE-master/python/fate_client/flow_sdk/client/__init__.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...
1,252
32.864865
75
py
FATE
FATE-master/python/fate_client/flow_sdk/client/api/base.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...
1,520
27.698113
75
py
FATE
FATE-master/python/fate_client/flow_sdk/client/api/checkpoint.py
# # Copyright 2021 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...
1,510
42.171429
108
py
FATE
FATE-master/python/fate_client/flow_sdk/client/api/test.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,698
32.627273
115
py
FATE
FATE-master/python/fate_client/flow_sdk/client/api/table.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...
1,706
40.634146
114
py
FATE
FATE-master/python/fate_client/flow_sdk/client/api/task.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...
1,144
37.166667
93
py
FATE
FATE-master/python/fate_client/flow_sdk/client/api/queue.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...
763
33.727273
75
py
FATE
FATE-master/python/fate_client/flow_sdk/client/api/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...
6,695
43.939597
120
py
FATE
FATE-master/python/fate_client/flow_sdk/client/api/privilege.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...
1,629
41.894737
89
py
FATE
FATE-master/python/fate_client/flow_sdk/client/api/tag.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...
1,697
36.733333
75
py
FATE
FATE-master/python/fate_client/flow_sdk/client/api/data.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,669
41.183908
115
py
FATE
FATE-master/python/fate_client/flow_sdk/client/api/component.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...
6,888
44.026144
119
py
FATE
FATE-master/python/fate_client/flow_sdk/client/api/version.py
# # Copyright 2021 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,036
37.433962
107
py
FATE
FATE-master/python/fate_client/flow_sdk/client/api/__init__.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...
1,160
40.464286
75
py
FATE
FATE-master/python/fate_client/flow_sdk/client/api/job.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,908
39.908333
121
py
FATE
FATE-master/python/federatedml/model_base.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/lice...
25,116
32.26755
116
py
FATE
FATE-master/python/federatedml/__init__.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...
616
37.5625
75
py
FATE
FATE-master/python/federatedml/nn/__init__.py
from federatedml.nn.dataset.base import Dataset from federatedml.nn.homo.trainer.trainer_base import TrainerBase __all__ = ['Dataset', 'TrainerBase']
151
29.4
64
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/table.py
import numpy as np import pandas as pd from federatedml.statistic.data_overview import with_weight from federatedml.nn.dataset.base import Dataset from federatedml.util import LOGGER class TableDataset(Dataset): """ A Table Dataset, load data from a give csv path, or transform FATE DTable Parameters ...
6,846
35.036842
117
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/dataset/__init__.py
0
0
0
py
FATE
FATE-master/python/federatedml/nn/backend/__init__.py
0
0
0
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/__init__.py
0
0
0
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
FATE
FATE-master/python/federatedml/nn/backend/utils/deepspeed_util.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...
1,695
30.407407
85
py
FATE
FATE-master/python/federatedml/nn/backend/utils/data.py
import numpy as np from torch.utils.data import Dataset as torchDataset from federatedml.util import LOGGER from federatedml.nn.dataset.base import Dataset, get_dataset_class from federatedml.nn.dataset.image import ImageDataset from federatedml.nn.dataset.table import TableDataset from federatedml.nn.dataset.graph imp...
2,598
35.605634
109
py
FATE
FATE-master/python/federatedml/nn/backend/utils/rng.py
import random from fate_arch.session import computing_session import numpy as np from federatedml.secureprotol.paillier_tensor import PaillierTensor BITS = 10 MIXED_RATE = 0.5 class RandomNumberGenerator(object): def __init__(self): self.lower_bound = -2 ** BITS self.upper_bound = 2 ** BITS ...
2,603
30.373494
98
py
FATE
FATE-master/python/federatedml/nn/backend/utils/common.py
import torch as t import numpy as np import tempfile ML_PATH = 'federatedml.nn' LLM_PATH = "fate_llm" HOMOMODELMETA = "HomoNNMeta" HOMOMODELPARAM = "HomoNNParam" def global_seed(seed): # set random seed of torch t.manual_seed(seed) t.cuda.manual_seed_all(seed) t.backends.cudnn.deterministic = True ...
968
20.065217
72
py
FATE
FATE-master/python/federatedml/nn/backend/utils/__init__.py
0
0
0
py
FATE
FATE-master/python/federatedml/nn/backend/utils/distributed_util.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...
815
27.137931
75
py
FATE
FATE-master/python/federatedml/nn/homo/server.py
from federatedml.model_base import ModelBase from federatedml.param.homo_nn_param import HomoNNParam from federatedml.nn.homo.trainer.trainer_base import get_trainer_class from federatedml.model_base import MetricMeta from federatedml.util import LOGGER from federatedml.nn.homo.client import NNModelExporter from federa...
3,107
35.139535
88
py
FATE
FATE-master/python/federatedml/nn/homo/client.py
import json import torch import inspect from fate_arch.computing.non_distributed import LocalData from fate_arch.computing import is_table from federatedml.model_base import ModelBase from federatedml.nn.homo.trainer.trainer_base import get_trainer_class, TrainerBase from federatedml.nn.backend.utils.data import load_d...
15,960
35.861432
145
py
FATE
FATE-master/python/federatedml/nn/homo/__init__.py
0
0
0
py
FATE
FATE-master/python/federatedml/nn/homo/trainer/fedavg_trainer.py
import torch import torch as t import torch.distributed as dist import tqdm import numpy as np import transformers from torch.nn import DataParallel from torch.utils.data import DataLoader from torch.utils.data.distributed import DistributedSampler from federatedml.framework.homo.aggregator.secure_aggregator import Sec...
25,839
41.291326
146
py
FATE
FATE-master/python/federatedml/nn/homo/trainer/trainer_base.py
import os import abc import importlib import torch as t import numpy as np from torch.nn import Module from typing import List from federatedml.util import consts from federatedml.util import LOGGER from federatedml.model_base import serialize_models from federatedml.nn.backend.utils.common import ML_PATH from federat...
20,753
35.410526
131
py