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

How to use it for GANs #24

Open
naoki7090624 opened this issue Aug 23, 2021 · 1 comment
Open

How to use it for GANs #24

naoki7090624 opened this issue Aug 23, 2021 · 1 comment
Assignees

Comments

@naoki7090624
Copy link

Thank you for sharing your great work!

Can actNN be used for GAN models? I used actNN with the following GAN architecture, but I got the error.
https://github.com/knazeri/edge-connect

Traceback (most recent call last):
  File "train.py", line 3, in <module>
    main(mode=1)
  File "***\edge-connect\main.py", line 50, in main
    model = EdgeConnect(config)
  File "***\edge-connect\src\edge_connect.py", line 27, in __init__
    self.edge_model = EdgeModel(config).to(config.DEVICE)
  File "***\edge-connect\src\models.py", line 67, in __init__
    generator = actnn.QModule(generator)
  File "***\actnn\actnn\actnn\module.py", line 18, in __init__
    QModule.convert_layers(model)
  File "***\actnn\actnn\actnn\module.py", line 76, in convert_layers
    QModule.convert_layers(child)
  File "***\actnn\actnn\actnn\module.py", line 48, in convert_layers
    child.groups, child.bias, child.dilation, child.padding_mode))
  File "***\actnn\actnn\actnn\layers.py", line 137, in __init__
    padding, output_padding, groups, bias, dilation, padding_mode)
  File "***\Python37\lib\site-packages\torch\nn\modules\conv.py", line 904, in __init__
    True, output_padding, groups, bias, padding_mode, **factory_kwargs)
  File "***\Python37\lib\site-packages\torch\nn\modules\conv.py", line 602, in __init__
    groups, bias, padding_mode, **factory_kwargs)
  File "***\Python37\lib\site-packages\torch\nn\modules\conv.py", line 133, in __init__
    if bias:
RuntimeError: Boolean value of Tensor with more than one value is ambiguous

I have add the following code to model.py#L61

        generator = EdgeGenerator(use_spectral_norm=True)
        discriminator = Discriminator(in_channels=2, use_sigmoid=config.GAN_LOSS != 'hinge')
        generator = actnn.QModule(generator)
        print(generator)
        exit()

I would like to seek your advice on this problem.
Thanks

@cjf00000
Copy link
Collaborator

This might be a bug in the converter function. @merrymercy could you take a look?

A quicker fix is to disable the bias in conv layers. (set bias=None)

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

3 participants