Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors during initialisation #3

Open
JTdeep opened this issue Feb 17, 2021 · 1 comment
Open

Errors during initialisation #3

JTdeep opened this issue Feb 17, 2021 · 1 comment

Comments

@JTdeep
Copy link

JTdeep commented Feb 17, 2021

Hello! I am using your code to define some INNs, which I will train in 2 ways, through your training code, as well as my own.
When I am loading in your INN model I get errors 'TypeError: init() got an unexpected keyword argument 'split_size_or_sections'.
(This was resolved following vislearn/FrEIA#67, ie switching to FrEIA v0.2)

I am also trying to initialise it elsewhere as part of my own training loop, and I get the error "TypeError: init() got an unexpected keyword argument 'track_running_stats" and when.

both errors appear to be happening during the initalisations of the network. Do you have any solution to this? Linux Debian, all packages are up to date.

My training loop
My environment: env.txt

Error in node Strided entry_flow
Traceback (most recent call last):
  File "./src/train_inn.py", line 438, in <module>
    train_openset_cls = TrainOpenset_INN()
  File "./src/train_inn.py", line 87, in __init__
    self.model = create_model(self.opt)  # create a model given opt.model and other options
  File "/media/james/LinuxStorage/Bayes/tmi_fork/openset-tmi19/src/models/__init__.py", line 65, in create_model
    instance = model(opt)
  File "/media/james/LinuxStorage/Bayes/tmi_fork/openset-tmi19/src/models/IBINN_model.py", line 108, in __init__
    finetune_mu = finetune_mu)
  File "/media/james/LinuxStorage/Bayes/tmi_fork/openset-tmi19/src/inn_model/classifiers/invertible_imagenet_classifier.py", line 28, in __init__
    self.construct_inn(Ff.InputNode(input_dims[0], input_dims[1], input_dims[2], name='input'), backbone, head)
  File "/media/james/LinuxStorage/Bayes/tmi_fork/openset-tmi19/src/inn_model/classifiers/invertible_imagenet_classifier.py", line 104, in construct_inn
    self.model = Ff.ReversibleGraphNet(nodes + split_nodes, verbose=True)
  File "/media/james/LinuxStorage/Bayes/tmi_env/lib/python3.7/site-packages/FrEIA/framework.py", line 274, in __init__
    node_list[i].build_modules(verbose=verbose)
  File "/media/james/LinuxStorage/Bayes/tmi_env/lib/python3.7/site-packages/FrEIA/framework.py", line 64, in build_modules
    for n, c in self.inputs]
  File "/media/james/LinuxStorage/Bayes/tmi_env/lib/python3.7/site-packages/FrEIA/framework.py", line 64, in <listcomp>
    for n, c in self.inputs]
  File "/media/james/LinuxStorage/Bayes/tmi_env/lib/python3.7/site-packages/FrEIA/framework.py", line 64, in build_modules
    for n, c in self.inputs]
  File "/media/james/LinuxStorage/Bayes/tmi_env/lib/python3.7/site-packages/FrEIA/framework.py", line 64, in <listcomp>
    for n, c in self.inputs]
  File "/media/james/LinuxStorage/Bayes/tmi_env/lib/python3.7/site-packages/FrEIA/framework.py", line 64, in build_modules
    for n, c in self.inputs]
  File "/media/james/LinuxStorage/Bayes/tmi_env/lib/python3.7/site-packages/FrEIA/framework.py", line 64, in <listcomp>
    for n, c in self.inputs]
  File "/media/james/LinuxStorage/Bayes/tmi_env/lib/python3.7/site-packages/FrEIA/framework.py", line 64, in build_modules
    for n, c in self.inputs]
  File "/media/james/LinuxStorage/Bayes/tmi_env/lib/python3.7/site-packages/FrEIA/framework.py", line 64, in <listcomp>
    for n, c in self.inputs]
  File "/media/james/LinuxStorage/Bayes/tmi_env/lib/python3.7/site-packages/FrEIA/framework.py", line 64, in build_modules
    for n, c in self.inputs]
  File "/media/james/LinuxStorage/Bayes/tmi_env/lib/python3.7/site-packages/FrEIA/framework.py", line 64, in <listcomp>
    for n, c in self.inputs]
  File "/media/james/LinuxStorage/Bayes/tmi_env/lib/python3.7/site-packages/FrEIA/framework.py", line 64, in build_modules
    for n, c in self.inputs]
  File "/media/james/LinuxStorage/Bayes/tmi_env/lib/python3.7/site-packages/FrEIA/framework.py", line 64, in <listcomp>
    for n, c in self.inputs]
  File "/media/james/LinuxStorage/Bayes/tmi_env/lib/python3.7/site-packages/FrEIA/framework.py", line 64, in build_modules
    for n, c in self.inputs]
  File "/media/james/LinuxStorage/Bayes/tmi_env/lib/python3.7/site-packages/FrEIA/framework.py", line 64, in <listcomp>
    for n, c in self.inputs]
  File "/media/james/LinuxStorage/Bayes/tmi_env/lib/python3.7/site-packages/FrEIA/framework.py", line 64, in build_modules
    for n, c in self.inputs]
  File "/media/james/LinuxStorage/Bayes/tmi_env/lib/python3.7/site-packages/FrEIA/framework.py", line 64, in <listcomp>
    for n, c in self.inputs]
  File "/media/james/LinuxStorage/Bayes/tmi_env/lib/python3.7/site-packages/FrEIA/framework.py", line 64, in build_modules
    for n, c in self.inputs]
  File "/media/james/LinuxStorage/Bayes/tmi_env/lib/python3.7/site-packages/FrEIA/framework.py", line 64, in <listcomp>
    for n, c in self.inputs]
  File "/media/james/LinuxStorage/Bayes/tmi_env/lib/python3.7/site-packages/FrEIA/framework.py", line 64, in build_modules
    for n, c in self.inputs]
  File "/media/james/LinuxStorage/Bayes/tmi_env/lib/python3.7/site-packages/FrEIA/framework.py", line 64, in <listcomp>
    for n, c in self.inputs]
  File "/media/james/LinuxStorage/Bayes/tmi_env/lib/python3.7/site-packages/FrEIA/framework.py", line 64, in build_modules
    for n, c in self.inputs]
  File "/media/james/LinuxStorage/Bayes/tmi_env/lib/python3.7/site-packages/FrEIA/framework.py", line 64, in <listcomp>
    for n, c in self.inputs]
  File "/media/james/LinuxStorage/Bayes/tmi_env/lib/python3.7/site-packages/FrEIA/framework.py", line 64, in build_modules
    for n, c in self.inputs]
  File "/media/james/LinuxStorage/Bayes/tmi_env/lib/python3.7/site-packages/FrEIA/framework.py", line 64, in <listcomp>
    for n, c in self.inputs]
  File "/media/james/LinuxStorage/Bayes/tmi_env/lib/python3.7/site-packages/FrEIA/framework.py", line 64, in build_modules
    for n, c in self.inputs]
  File "/media/james/LinuxStorage/Bayes/tmi_env/lib/python3.7/site-packages/FrEIA/framework.py", line 64, in <listcomp>
    for n, c in self.inputs]
  File "/media/james/LinuxStorage/Bayes/tmi_env/lib/python3.7/site-packages/FrEIA/framework.py", line 64, in build_modules
    for n, c in self.inputs]
  File "/media/james/LinuxStorage/Bayes/tmi_env/lib/python3.7/site-packages/FrEIA/framework.py", line 64, in <listcomp>
    for n, c in self.inputs]
  File "/media/james/LinuxStorage/Bayes/tmi_env/lib/python3.7/site-packages/FrEIA/framework.py", line 64, in build_modules
    for n, c in self.inputs]
  File "/media/james/LinuxStorage/Bayes/tmi_env/lib/python3.7/site-packages/FrEIA/framework.py", line 64, in <listcomp>
    for n, c in self.inputs]
  File "/media/james/LinuxStorage/Bayes/tmi_env/lib/python3.7/site-packages/FrEIA/framework.py", line 64, in build_modules
    for n, c in self.inputs]
  File "/media/james/LinuxStorage/Bayes/tmi_env/lib/python3.7/site-packages/FrEIA/framework.py", line 64, in <listcomp>
    for n, c in self.inputs]
  File "/media/james/LinuxStorage/Bayes/tmi_env/lib/python3.7/site-packages/FrEIA/framework.py", line 64, in build_modules
    for n, c in self.inputs]
  File "/media/james/LinuxStorage/Bayes/tmi_env/lib/python3.7/site-packages/FrEIA/framework.py", line 64, in <listcomp>
    for n, c in self.inputs]
  File "/media/james/LinuxStorage/Bayes/tmi_env/lib/python3.7/site-packages/FrEIA/framework.py", line 64, in build_modules
    for n, c in self.inputs]
  File "/media/james/LinuxStorage/Bayes/tmi_env/lib/python3.7/site-packages/FrEIA/framework.py", line 64, in <listcomp>
    for n, c in self.inputs]
  File "/media/james/LinuxStorage/Bayes/tmi_env/lib/python3.7/site-packages/FrEIA/framework.py", line 64, in build_modules
    for n, c in self.inputs]
  File "/media/james/LinuxStorage/Bayes/tmi_env/lib/python3.7/site-packages/FrEIA/framework.py", line 64, in <listcomp>
    for n, c in self.inputs]
  File "/media/james/LinuxStorage/Bayes/tmi_env/lib/python3.7/site-packages/FrEIA/framework.py", line 64, in build_modules
    for n, c in self.inputs]
  File "/media/james/LinuxStorage/Bayes/tmi_env/lib/python3.7/site-packages/FrEIA/framework.py", line 64, in <listcomp>
    for n, c in self.inputs]
  File "/media/james/LinuxStorage/Bayes/tmi_env/lib/python3.7/site-packages/FrEIA/framework.py", line 64, in build_modules
    for n, c in self.inputs]
  File "/media/james/LinuxStorage/Bayes/tmi_env/lib/python3.7/site-packages/FrEIA/framework.py", line 64, in <listcomp>
    for n, c in self.inputs]
  File "/media/james/LinuxStorage/Bayes/tmi_env/lib/python3.7/site-packages/FrEIA/framework.py", line 64, in build_modules
    for n, c in self.inputs]
  File "/media/james/LinuxStorage/Bayes/tmi_env/lib/python3.7/site-packages/FrEIA/framework.py", line 64, in <listcomp>
    for n, c in self.inputs]
  File "/media/james/LinuxStorage/Bayes/tmi_env/lib/python3.7/site-packages/FrEIA/framework.py", line 75, in build_modules
    raise e
  File "/media/james/LinuxStorage/Bayes/tmi_env/lib/python3.7/site-packages/FrEIA/framework.py", line 72, in build_modules
    **self.module_args)
  File "/media/james/LinuxStorage/Bayes/tmi_fork/openset-tmi19/src/inn_model/coupling_blocks/downsampling.py", line 124, in __init__
    clamp=clamp
  File "/media/james/LinuxStorage/Bayes/tmi_fork/openset-tmi19/src/inn_model/coupling_blocks/downsampling.py", line 30, in __init__
    self.s_hi = subnet_constructor_strided(self.split_len1, 8 * self.split_len2)
  File "/media/james/LinuxStorage/Bayes/tmi_fork/openset-tmi19/src/inn_model/backbones/invertible_resnet.py", line 166, in _entry_flow_block_strided
    self.BatchNorm(self.base_width, track_running_stats=True, momentum=0.05),
TypeError: __init__() got an unexpected keyword argument 'track_running_stats'

Below error was caused by updates in the FrEIA package
~~
Importing a model

>>> beta_0_model = trustworthy_gc_beta_0(pretrained=True)
/media/james/LinuxStorage/Bayes/i/ibinn_imagenet/ibinn_imagenet/utils/dct_transform.py:20: UserWarning: The function torch.rfft is deprecated and will be removed in a future PyTorch release. Use the new torch.fft module functions, instead, by importing torch.fft and calling torch.fft.fft or torch.fft.rfft. (Triggered internally at  /pytorch/aten/src/ATen/native/SpectralOps.cpp:590.)
  Vc = torch.rfft(v, 1, onesided=False)
/media/james/LinuxStorage/Bayes/i/ibinn_imagenet/ibinn_imagenet/utils/dct_transform.py:57: UserWarning: The function torch.irfft is deprecated and will be removed in a future PyTorch release. Use the new torch.fft module functions, instead, by importing torch.fft and calling torch.fft.ifft or torch.fft.irfft. (Triggered internally at  /pytorch/aten/src/ATen/native/SpectralOps.cpp:602.)
  v = torch.irfft(V, 1, onesided=False)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/media/james/LinuxStorage/Bayes/i/ibinn_imagenet/ibinn_imagenet/model/classifiers/invertible_imagenet_classifier.py", line 249, in trustworthy_gc_beta_0
    return _trustworthy_gc(0, [3, 4, 6, 3], pretrained, progress, pretrained_model_path, **kwargs)
  File "/media/james/LinuxStorage/Bayes/i/ibinn_imagenet/ibinn_imagenet/model/classifiers/invertible_imagenet_classifier.py", line 239, in _trustworthy_gc
    model = InvertibleImagenetClassifier(0.0, 0.0, 0.0, 128, [3,224,224], 1000, 3072, 224*224*3, backbone, head, finetune_mu=False, **kwargs)
  File "/media/james/LinuxStorage/Bayes/i/ibinn_imagenet/ibinn_imagenet/model/classifiers/invertible_imagenet_classifier.py", line 28, in __init__
    self.construct_inn(Ff.InputNode(input_dims[0], input_dims[1], input_dims[2], name='input'), backbone, head)
  File "/media/james/LinuxStorage/Bayes/i/ibinn_imagenet/ibinn_imagenet/model/classifiers/invertible_imagenet_classifier.py", line 97, in construct_inn
    head_nodes, head_split_nodes = head.construct_inn(nodes[-1])
  File "/media/james/LinuxStorage/Bayes/i/ibinn_imagenet/ibinn_imagenet/model/heads/invertible_multiclass_classifier.py", line 86, in construct_inn
    split_node = Ff.Node(dctpooling.out0, Fm.Split1D, {'split_size_or_sections': (self.n_loss_dims_1d, self.n_total_dims_1d - self.n_loss_dims_1d), 'dim': 0}, name='exit_flow split')
  File "/media/james/LinuxStorage/Bayes/i/ibinn_imagenet/FrEIA/FrEIA/framework/graph_inn.py", line 50, in __init__
    input_shapes)
  File "/media/james/LinuxStorage/Bayes/i/ibinn_imagenet/FrEIA/FrEIA/framework/graph_inn.py", line 72, in build_module
    module = self.module_type(input_shapes, **self.module_args)
  File "/media/james/LinuxStorage/Bayes/i/ibinn_imagenet/FrEIA/FrEIA/modules/graph_topology.py", line 161, in __init__
    super().__init__(*args, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'split_size_or_sections'

~~

@RayDeeA
Copy link
Owner

RayDeeA commented Oct 18, 2021

Hi, do you still have the problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants