Coder Social home page Coder Social logo

kamathhrishi / pate Goto Github PK

View Code? Open in Web Editor NEW
42.0 4.0 9.0 21 KB

Pytorch implementation of paper Semi-supervised Knowledge Transfer for Deep Learning from Private Training Data (https://arxiv.org/abs/1610.05755)

Python 100.00%
deep-learning privacy differential-privacy

pate's Introduction

Hi there ๐Ÿ‘‹.

I just learnt how to add a README to my Github profile while I was procastrinating. I will update this soon

pate's People

Contributors

kamathhrishi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

pate's Issues

Problem When I run Main.py

the error msg is as follows:

Traceback (most recent call last):
  File "Main.py", line 3, in 
    from Teacher import Teacher
  File "E:\1-Research\0-DP+GCN\Code\(2020-09-20)PATE\Teacher.py", line 6, in 
    from syft.frameworks.torch.differential_privacy import pate
  File "D:\Anaconda\envs\torch\lib\site-packages\syft-0.2.9-py3.7.egg\syft\__init__.py", line 14, in 
    import syft.frameworks.torch.hook.hook_args
  File "D:\Anaconda\envs\torch\lib\site-packages\syft-0.2.9-py3.7.egg\syft\frameworks\torch\hook\hook_args.py", line 4, in 
    from syft.frameworks.torch.tensors.interpreters.native import TorchTensor
  File "D:\Anaconda\envs\torch\lib\site-packages\syft-0.2.9-py3.7.egg\syft\frameworks\torch\tensors\interpreters\native.py", line 11, in 
    from syft.messaging.message import TensorCommandMessage
  File "D:\Anaconda\envs\torch\lib\site-packages\syft-0.2.9-py3.7.egg\syft\messaging\message.py", line 17, in 
    from syft.execution.action import Action
  File "D:\Anaconda\envs\torch\lib\site-packages\syft-0.2.9-py3.7.egg\syft\execution\action.py", line 5, in 
    from syft.execution.placeholder import PlaceHolder
  File "D:\Anaconda\envs\torch\lib\site-packages\syft-0.2.9-py3.7.egg\syft\execution\placeholder.py", line 7, in 
    from syft_proto.execution.v1.placeholder_pb2 import Placeholder as PlaceholderPB
  File "D:\Anaconda\envs\torch\lib\site-packages\syft_proto-0.5.2-py3.7.egg\syft_proto\execution\v1\placeholder_pb2.py", line 14, in 
    from syft_proto.types.syft.v1 import id_pb2 as syft__proto_dot_types_dot_syft_dot_v1_dot_id__pb2
  File "D:\Anaconda\envs\torch\lib\site-packages\syft_proto-0.5.2-py3.7.egg\syft_proto\types\syft\v1\id_pb2.py", line 21, in 
    create_key=_descriptor._internal_create_key,
AttributeError: module 'google.protobuf.descriptor' has no attribute '_internal_create_key'

Problem when I run /PATE/SHVN/Main.py

$ python Main.py
Using downloaded and verified file: ../data/train_32x32.mat
Using downloaded and verified file: ../data/test_32x32.mat
TRAINING model_0
EPOCH: 1
Traceback (most recent call last):
File "Main.py", line 35, in
teacher.train(train_loader)
File "/home/liujj/PATE/SHVN/Teacher.py", line 116, in train
self.loop_body(split[index],model_name,1)
File "/home/liujj/PATE/SHVN/Teacher.py", line 129, in loop_body
output = model(data)
File "/mnt/data/conda/envs/pytorch/lib/python3.6/site-packages/torch/nn/modules/module.py", line 493, in call
result = self.forward(*input, **kwargs)
File "/home/liujj/PATE/SHVN/Model.py", line 18, in forward
x = F.relu(self.conv1(x))
File "/mnt/data/conda/envs/pytorch/lib/python3.6/site-packages/torch/nn/modules/module.py", line 493, in call
result = self.forward(*input, **kwargs)
File "/mnt/data/conda/envs/pytorch/lib/python3.6/site-packages/torch/nn/modules/conv.py", line 338, in forward
self.padding, self.dilation, self.groups)
RuntimeError: Given groups=1, weight of size 20 1 5 5, expected input[64, 3, 32, 32] to have 1 channels, but got 3 channels instead

what is the RuntimeError mean? Can you help me solve?

Can't seem to finish running Main.py (not SHVN)

Hey,

Love the repo, but I have an issue, whenever I run it it seems to get stuck at the last two lines of Main.py it does not show an error, but after a while i press force it to stop and its stuck at the same line every time. I run it on less epochs than in your file (1-2) just for testing purposes. My hyperparameters look like this:

    def __init__(self):

        self.batchsize = 64
        self.test_batchsize = 10
        self.epochs = **1**
        self.student_epochs = **1**
        self.lr = 0.01
        self.momentum = 0.5
        self.no_cuda = False
        self.seed = 1
        self.log_interval = 30
        self.n_teachers = **1**
        self.save_model = **True**

Last four lines of code look like this:

counts_lol = torch.stack(counts).contiguous().view(**1**, 10000)
predict_lol = torch.tensor(predict).view(10000)

data_dep_eps, data_ind_eps = teacher.analyze(counts_lol, predict_lol, moments=20)
print("Epsilon: ", teacher.analyze(counts_lol, predict_lol))

And it seems that my file is stuck at:

Traceback (most recent call last):
  File "main.py", line 91, in <module>
    #data_dep_eps, data_ind_eps = teacher.analyze(counts_lol, predict_lol, moments=20)
  File "C:\Users\Koen\PycharmProjects\pate-g\PATE\Teacher.py", line 176, in analyze
    preds, indices, noise_eps=0.1, delta=self.epsilon, moments=moments, beta=0.09
  File "C:\Users\Koen\Anaconda3\envs\pysyft\lib\site-packages\syft-0.2.0a2-py3.7.egg\syft\frameworks\torch\differential_privacy\pate.py", line 484, in perform_analysis_torch
  File "C:\Users\Koen\Anaconda3\envs\pysyft\lib\site-packages\syft-0.2.0a2-py3.7.egg\syft\frameworks\torch\differential_privacy\pate.py", line 484, in <listcomp>
  File "C:\Users\Koen\Anaconda3\envs\pysyft\lib\site-packages\syft-0.2.0a2-py3.7.egg\syft\frameworks\torch\differential_privacy\pate.py", line 379, in logmgf_from_counts_torch
  File "C:\Users\Koen\Anaconda3\envs\pysyft\lib\site-packages\syft-0.2.0a2-py3.7.egg\syft\frameworks\torch\differential_privacy\pate.py", line 354, in compute_q_noisy_max_torch
  File "C:\Users\Koen\Anaconda3\envs\pysyft\lib\site-packages\syft-0.2.0a2-py3.7.egg\syft\frameworks\torch\differential_privacy\pate.py", line 294, in tensors_to_literals
  File "C:\Users\Koen\Anaconda3\envs\pysyft\lib\site-packages\torch\tensor.py", line 427, in <lambda>
    return iter(imap(lambda i: self[i], range(self.size(0))))

Would you have any idea what I'm doing wrong here? I'm hesitant to run it for 1000 epochs as it would take a lot of time and I might still get stuck at the same point.
I am very curious to what the epsilon is and want to play around to see what the actual loss of accuracy would be with my own datasets.

Thanks in advance!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.