question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DCGAN Example pickle exception

See original GitHub issue

First of all i’m sorry for my poor English I just tried to run dcgan example and faced with following exception:

Traceback (most recent call last):
  File "C:/Users/Daiver/Documents/Depth/ignite_examples/dcgan_orig.py", line 438, in <module>
    alpha=0.98, output_dir=output_dir)
  File "C:/Users/Daiver/Documents/Depth/ignite_examples/dcgan_orig.py", line 417, in main
    trainer.run(loader, epochs)
  File "C:\Users\Daiver\Anaconda3\lib\site-packages\ignite\engine\engine.py", line 326, in run
    self._handle_exception(e)
  File "C:\Users\Daiver\Anaconda3\lib\site-packages\ignite\engine\engine.py", line 289, in _handle_exception
    self._fire_event(Events.EXCEPTION_RAISED, e)
  File "C:\Users\Daiver\Anaconda3\lib\site-packages\ignite\engine\engine.py", line 226, in _fire_event
    func(self, *(event_args + args), **kwargs)
  File "C:/Users/Daiver/Documents/Depth/ignite_examples/dcgan_orig.py", line 414, in handle_exception
    raise e
  File "C:\Users\Daiver\Anaconda3\lib\site-packages\ignite\engine\engine.py", line 313, in run
    hours, mins, secs = self._run_once_on_dataset()
  File "C:\Users\Daiver\Anaconda3\lib\site-packages\ignite\engine\engine.py", line 280, in _run_once_on_dataset
    self._handle_exception(e)
  File "C:\Users\Daiver\Anaconda3\lib\site-packages\ignite\engine\engine.py", line 289, in _handle_exception
    self._fire_event(Events.EXCEPTION_RAISED, e)
  File "C:\Users\Daiver\Anaconda3\lib\site-packages\ignite\engine\engine.py", line 226, in _fire_event
    func(self, *(event_args + args), **kwargs)
  File "C:/Users/Daiver/Documents/Depth/ignite_examples/dcgan_orig.py", line 414, in handle_exception
    raise e
  File "C:\Users\Daiver\Anaconda3\lib\site-packages\ignite\engine\engine.py", line 268, in _run_once_on_dataset
    for batch in self.state.dataloader:
  File "C:\Users\Daiver\Anaconda3\lib\site-packages\torch\utils\data\dataloader.py", line 819, in __iter__
    return _DataLoaderIter(self)
  File "C:\Users\Daiver\Anaconda3\lib\site-packages\torch\utils\data\dataloader.py", line 560, in __init__
    w.start()
  File "C:\Users\Daiver\Anaconda3\lib\multiprocessing\process.py", line 105, in start
    self._popen = self._Popen(self)
  File "C:\Users\Daiver\Anaconda3\lib\multiprocessing\context.py", line 223, in _Popen
    return _default_context.get_context().Process._Popen(process_obj)
  File "C:\Users\Daiver\Anaconda3\lib\multiprocessing\context.py", line 322, in _Popen
    return Popen(process_obj)
  File "C:\Users\Daiver\Anaconda3\lib\multiprocessing\popen_spawn_win32.py", line 65, in __init__
    reduction.dump(process_obj, to_child)
  File "C:\Users\Daiver\Anaconda3\lib\multiprocessing\reduction.py", line 60, in dump
    ForkingPickler(file, protocol).dump(obj)
AttributeError: Can't pickle local object 'check_dataset.<locals>.<lambda>'

Process finished with exit code 1

I’m pretty sure this is due this line to_rgb = transforms.Lambda(lambda img: img.convert('RGB')). (i commented this and example failed with channels mismatch error) Unfortunately i’m not very good with Python/Torch/Ignite so i have no idea why this example attempts to pickle lambda.

This is exactly what i run: https://gist.github.com/Daiver/cfaa55410d3d1f9082197e4113bf7328 (just dcgan example with hardcoded options)

My Python/packages versions

torch version: 1.0.0
torchvision version: 0.2.1
ignite version:  0.1.2
Python version: 3.6.5 |Anaconda, Inc.| (default, Mar 29 2018, 13:32:41) [MSC v.1900 64 bit (AMD64)] (Windows)

Please, tell me if i can provide more data.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
vfdev-5commented, Dec 22, 2018

@Daiver glad that it helps !

Let’s leave it open. I think we need to modify DCGAN example such that we can run it on any platform: Win, LInux, OSX.

And if you would like to contribute, PRs are welcome 😃 See contributing for more info.

0reactions
vfdev-5commented, Jan 16, 2019

@anmolsjoshi yes, you can introduce a parameter as nc:

https://github.com/pytorch/examples/blob/0d3fe14a1c5a00795e3671ea3473caef6f0da72d/dcgan/main.py#L82-L89

I’ll try tonight and report back.

Sounds good

Read more comments on GitHub >

github_iconTop Results From Across the Web

Deep Convolutional GANs - | notebook.community
In this notebook, you'll build a GAN using convolutional layers in the generator and discriminator. This is called a Deep Convolutional GAN, or...
Read more >
DCGAN Basic using SVHN - Kaggle
%matplotlib inline import pickle as pkl import matplotlib.pyplot as plt import ... if not isdir(data_dir): raise Exception("Data directory doesn't exist!
Read more >
Flower GAN
import os import tensorflow as tf import numpy as np import helper from glob import glob import pickle as pkl import scipy.misc import...
Read more >
Exception Propagation From Another Process | Geek Culture
It is very difficult if not impossible to pickle exceptions back to the parent process. Simple ones work, but many others don't. For...
Read more >
DCGAN Tutorial - Generative Adversarial Networks - PyTorch
This tutorial will give an introduction to DCGANs through an example. We will train a generative adversarial network (GAN) to generate new celebrities...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found