Code Monkey home page Code Monkey logo

node-bnn-covariate-shift's People

Contributors

trungtrinh44 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-bnn-covariate-shift's Issues

Incompatible versions in requirements.txt

Your requirements.txt does not seem to be correct. Using python3.8:

node-BNN-covariate-shift$ pip install -r requirements.txt
...
node-BNN-covariate-shift$ pip freeze | grep torch
torch==1.5.1
torchvision==0.6.1

node-BNN-covariate-shift$ python train_node_bnn.py
Traceback (most recent call last):
  File "train_node_bnn.py", line 20, in <module>
    from new_datasets import get_corrupt_data_loader, get_data_loader
  File "/home/svirpioj/src/node-BNN-covariate-shift/new_datasets.py", line 10, in <module>
    from tiny_imagenet import TrainTinyImageNetDataset, TestTinyImageNetDataset, CorruptTinyImageNetDataset
  File "/home/svirpioj/src/node-BNN-covariate-shift/tiny_imagenet.py", line 10, in <module>
    from torchvision.io.image import ImageReadMode, decode_image, read_image
ModuleNotFoundError: No module named 'torchvision.io.image'

Errors running train_node_bnn.py

I got a bit further with the new requirements.txt, but now I'm encountering other errors.

Running the script simply with defaults:

node-BNN-covariate-shift$ python train_node_bnn.py
INFO - experiments - Running command 'main'
INFO - experiments - Started run with ID "StoWideResNet28x10_1_cifar100_name"
Files already downloaded and verified
Files already downloaded and verified
Files already downloaded and verified
INFO - get_logger - Train size: 45000, validation size: 5000, test size: 10000
ERROR - experiments - Failed after 0:00:02!
Traceback (most recent call last):
  File "/home/svirpioj/.virtualenvs/node-bnn/lib/python3.8/site-packages/sacred/experiment.py", line 312, in run_commandline
    return self.run(
  File "/home/svirpioj/.virtualenvs/node-bnn/lib/python3.8/site-packages/sacred/experiment.py", line 276, in run
    run()
  File "/home/svirpioj/.virtualenvs/node-bnn/lib/python3.8/site-packages/sacred/run.py", line 238, in __call__
    self.result = self.main_function(*args)
  File "/home/svirpioj/.virtualenvs/node-bnn/lib/python3.8/site-packages/sacred/config/captured_function.py", line 42, in captured_function
    result = wrapped(*args, **kwargs)
  File "train_node_bnn.py", line 261, in main
    model, optimizer, scheduler= get_model()
  File "/home/svirpioj/.virtualenvs/node-bnn/lib/python3.8/site-packages/sacred/config/captured_function.py", line 42, in captured_function
    result = wrapped(*args, **kwargs)
  File "train_node_bnn.py", line 150, in get_model
    for name, param in model.named_parameters():
UnboundLocalError: local variable 'model' referenced before assignment

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "train_node_bnn.py", line 250, in <module>
    def main(_run, num_train_sample, device, validation, num_epochs, logging_freq, kl_type, gamma, entropy_type, det_checkpoint, dataset, save_freq):
  File "/home/svirpioj/.virtualenvs/node-bnn/lib/python3.8/site-packages/sacred/experiment.py", line 190, in automain
    self.run_commandline()
  File "/home/svirpioj/.virtualenvs/node-bnn/lib/python3.8/site-packages/sacred/experiment.py", line 347, in run_commandline
    print_filtered_stacktrace()
  File "/home/svirpioj/.virtualenvs/node-bnn/lib/python3.8/site-packages/sacred/utils.py", line 493, in print_filtered_stacktrace
    print(format_filtered_stacktrace(filter_traceback), file=sys.stderr)
  File "/home/svirpioj/.virtualenvs/node-bnn/lib/python3.8/site-packages/sacred/utils.py", line 528, in format_filtered_stacktrace
    return "".join(filtered_traceback_format(tb_exception))
  File "/home/svirpioj/.virtualenvs/node-bnn/lib/python3.8/site-packages/sacred/utils.py", line 568, in filtered_traceback_format
    current_tb = tb_exception.exc_traceback
AttributeError: 'TracebackException' object has no attribute 'exc_traceback'

Taking the first example in README:

node-BNN-covariate-shift$ python train_node_bnn.py with model_name=StoVGG16 validation=False validation_fraction=5000 augment_data=True "kl_type=upper_bound" "gamma=<GAMMA>" entropy_type=BD \
                          num_epochs=300 save_freq=301 logging_freq=1 'kl_weight.kl_min=0.0' "kl_weight.kl_max=1.0" 'kl_weight.last_iter=200' lr_ratio_det=0.01 lr_ratio_sto=1.0 \
                          prior_std=0.30 prior_mean=1.0 "det_params.weight_decay=0.0005" n_components=4 dataset=cifar10 "posterior_mean_init=(1.0,0.05)" "posterior_std_init=(0.30,0.02)" \
                          "det_params.lr=0.05" 'sto_params.lr'=0.05 'sto_params.weight_decay=0.0' "sto_params.momentum=0.0" 'sto_params.nesterov=True' 'num_train_sample'=4 bn_momentum=0.1 \
                          noise_mode=out 'sgd_params.nesterov'=True 'det_milestones=(0.50,0.90)' \
                          name=test \
                          batch_size=128 test_batch_size=512 seed=1 num_test_sample=8
WARNING - root - Changed type of config entry "gamma" from float to str
INFO - experiments - Running command 'main'
INFO - experiments - Started run with ID "StoVGG16_1_cifar10_test"
Files already downloaded and verified
...
ERROR - experiments - Failed after 0:00:02!
Traceback (most recent call last):
  File "/home/svirpioj/.virtualenvs/node-bnn/lib/python3.8/site-packages/sacred/experiment.py", line 312, in run_commandline
    return self.run(
  File "/home/svirpioj/.virtualenvs/node-bnn/lib/python3.8/site-packages/sacred/experiment.py", line 276, in run
    run()
  File "/home/svirpioj/.virtualenvs/node-bnn/lib/python3.8/site-packages/sacred/run.py", line 238, in __call__
    self.result = self.main_function(*args)
  File "/home/svirpioj/.virtualenvs/node-bnn/lib/python3.8/site-packages/sacred/config/captured_function.py", line 42, in captured_function
    result = wrapped(*args, **kwargs)
  File "train_node_bnn.py", line 276, in main
    loss= eloglike + viw*(kl - gamma*entropy)/(n_batch*bx.size(0))
TypeError: only integer tensors of a single element can be converted to an index

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "train_node_bnn.py", line 250, in <module>
    def main(_run, num_train_sample, device, validation, num_epochs, logging_freq, kl_type, gamma, entropy_type, det_checkpoint, dataset, save_freq):
  File "/home/svirpioj/.virtualenvs/node-bnn/lib/python3.8/site-packages/sacred/experiment.py", line 190, in automain
    self.run_commandline()
  File "/home/svirpioj/.virtualenvs/node-bnn/lib/python3.8/site-packages/sacred/experiment.py", line 347, in run_commandline
    print_filtered_stacktrace()
  File "/home/svirpioj/.virtualenvs/node-bnn/lib/python3.8/site-packages/sacred/utils.py", line 493, in print_filtered_stacktrace
    print(format_filtered_stacktrace(filter_traceback), file=sys.stderr)
  File "/home/svirpioj/.virtualenvs/node-bnn/lib/python3.8/site-packages/sacred/utils.py", line 528, in format_filtered_stacktrace
    return "".join(filtered_traceback_format(tb_exception))
  File "/home/svirpioj/.virtualenvs/node-bnn/lib/python3.8/site-packages/sacred/utils.py", line 568, in filtered_traceback_format
    current_tb = tb_exception.exc_traceback
AttributeError: 'TracebackException' object has no attribute 'exc_traceback'

(By the way, there's train_node_bnn.py.py in the example commands.)

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.