Giter Club home page Giter Club logo

stackgan-v2's People

Contributors

hanzhanggit 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  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  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  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

stackgan-v2's Issues

How do I fix this?AttributeError: 'module' object has no attribute '_cuda_setDevice'

I am running this on a MacBook Pro (Retina, 13-inch, Early 2015) macOS Catalina 10.15.3 GPU Intel Iris Graphics 6100 1536 MB
I am at this step in the instructions: python main.py --cfg cfg/birds_3stages.yml --gpu 0

And I get this as a result:
/Users/f00l/Desktop/GitHubProject/StackGAN-v2/code/miscc/config.py:103: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
yaml_cfg = edict(yaml.load(f))
Using config:
{'CONFIG_NAME': '3stages',
'CUDA': False,
'DATASET_NAME': 'birds',
'DATA_DIR': '../data/birds',
'EMBEDDING_TYPE': 'cnn-rnn',
'GAN': {'B_CONDITION': True,
'DF_DIM': 64,
'EMBEDDING_DIM': 128,
'GF_DIM': 64,
'NETWORK_TYPE': 'default',
'R_NUM': 2,
'Z_DIM': 100},
'GPU_ID': '0',
'TEST': {'B_EXAMPLE': True, 'SAMPLE_NUM': 30000},
'TEXT': {'DIMENSION': 1024},
'TRAIN': {'BATCH_SIZE': 24,
'COEFF': {'COLOR_LOSS': 0.0, 'KL': 2.0, 'UNCOND_LOSS': 1.0},
'DISCRIMINATOR_LR': 0.0002,
'FLAG': True,
'GENERATOR_LR': 0.0002,
'MAX_EPOCH': 600,
'NET_D': '',
'NET_G': '',
'SNAPSHOT_INTERVAL': 2000,
'VIS_COUNT': 64},
'TREE': {'BASE_SIZE': 64, 'BRANCH_NUM': 3},
'WORKERS': 4}
/Users/f00l/Desktop/GitHubProject/StackGAN-v2/venv/lib/python2.7/site-packages/torchvision/transforms/transforms.py:156: UserWarning: The use of the transforms.Scale transform is deprecated, please use transforms.Resize instead.
"please use transforms.Resize instead.")
Total filenames: 11788 001.Black_footed_Albatross/Black_Footed_Albatross_0046_18.jpg
Load filenames from: ../data/birds/train/filenames.pickle (8855)
embeddings: (8855, 10, 1024)
Traceback (most recent call last):
File "main.py", line 140, in
algo = trainer(output_dir, dataloader, imsize)
File "/Users/f00l/Desktop/GitHubProject/StackGAN-v2/code/trainer.py", line 537, in init
torch.cuda.set_device(self.gpus[0])
File "/Users/f00l/Desktop/GitHubProject/StackGAN-v2/venv/lib/python2.7/site-packages/torch/cuda/init.py", line 262, in set_device
torch._C._cuda_setDevice(device)
AttributeError: 'module' object has no attribute '_cuda_setDevice'

How do I fix this?

Malloc error while training on birds dataset

So I have followed all the steps necessary till the training of the StackGAN on the birds dataset but I am receiving a memory allocation error while training. I will enclose the Colab link I am using as well as the detailed error statement for your convenience. Any help would be deeply appreciated. Thank you!
Regards,
Parth Rangarajan.
Here is the collaboratory link: https://colab.research.google.com/drive/1ASXNdAWI54x8zXZROHcYhkhEX8ciK8-H?usp=sharing

Here is the error:
Using config: {'CONFIG_NAME': '3stages', 'CUDA': True, 'DATASET_NAME': 'birds', 'DATA_DIR': '../data/birds', 'EMBEDDING_TYPE': 'cnn-rnn', 'GAN': {'B_CONDITION': True, 'DF_DIM': 64, 'EMBEDDING_DIM': 128, 'GF_DIM': 64, 'NETWORK_TYPE': 'default', 'R_NUM': 2, 'Z_DIM': 100}, 'GPU_ID': '0', 'TEST': {'B_EXAMPLE': True, 'SAMPLE_NUM': 30000}, 'TEXT': {'DIMENSION': 1024}, 'TRAIN': {'BATCH_SIZE': 24, 'COEFF': {'COLOR_LOSS': 0.0, 'KL': 2.0, 'UNCOND_LOSS': 1.0}, 'DISCRIMINATOR_LR': 0.0002, 'FLAG': True, 'GENERATOR_LR': 0.0002, 'MAX_EPOCH': 600, 'NET_D': '', 'NET_G': '', 'SNAPSHOT_INTERVAL': 2000, 'VIS_COUNT': 64}, 'TREE': {'BASE_SIZE': 64, 'BRANCH_NUM': 3}, 'WORKERS': 4} /usr/local/lib/python3.7/dist-packages/torchvision/transforms/transforms.py:310: UserWarning: The use of the transforms.Scale transform is deprecated, please use transforms.Resize instead. warnings.warn("The use of the transforms.Scale transform is deprecated, " + Total filenames: 11788 001.Black_footed_Albatross/Black_Footed_Albatross_0046_18.jpg Load filenames from: ../data/birds/train/filenames.pickle (8855) tcmalloc: large alloc 65850621952 bytes == 0x5631f8284000 @ 0x7fd36b19a001 0x7fd274fd754f 0x7fd275027b58 0x7fd27502ae83 0x7fd27502b07b 0x7fd2750cc761 0x5631778c24b0 0x5631778c2240 0x5631779360f3 0x5631778c3afa 0x563177931c0d 0x5631779309ee 0x5631778c448c 0x563177905159 0x5631779020a4 0x5631778c2d49 0x56317793694f 0x5631779309ee 0x5631779306f3 0x5631779fa4c2 0x5631779fa83d 0x5631779fa6e6 0x5631779d2163 0x5631779d1e0c 0x7fd369f82bf7 0x5631779d1cea ^C

Why do we compute KL loss in this way?

def KL_loss(mu, logvar):
# -0.5 * sum(1 + log(sigma^2) - mu^2 - sigma^2)
KLD_element = mu.pow(2).add_(logvar.exp()).mul_(-1).add_(1).add_(logvar)
KLD = torch.mean(KLD_element).mul_(-0.5)
return KLD

dataset preparation

Can anyone clearly explain how do we prepare the dataset. I've refered many issues but dataset preparation is still unclear.

Embeddings - Why does t_embeddings have 3 dimensions instead of 2?

Hi,

I have used a script from another StackGAN repo to generate embeddings for sentences. The result for a set of sentences when I load in the t7 file and convert it numpy is a 2D matrix - where there is a 1 dimensional embedding for each sentence - this is to be expected.

However, when I look at the code for this repo is shows the below reference:
t_embeddings[:, i, :]

indicating that t_embeddings is 3D - where does the extra dimension come from?

KeyError following with TypeError during training

1544482069207
Hello, I was training the bird dataset with the command python3 main.py --cfg cfg/birds_3stages.yml --gpu 0 and these two errors occurred. This happened after the 2nd epoch of the training. Does anyone know anything about these errors and how to fix them?

NOTE:
I am using python version 3.5

Thank you.

CUDA out of memory ? How to resolve this issue ?

Traceback (most recent call last):
File "main.py", line 146, in
algo.evaluate(split_dir)
File "/home/user/Downloads/StackGAN-v2-master/code/trainer.py", line 874, in evaluate
fake_imgs, _, _ = netG(noise, t_embeddings[:, i, :])

File "/home/user/anaconda2/envs/stackGANv2/lib/python2.7/site-packages/torch/nn/modules/module.py", line 477, in call
result = self.forward(*input, **kwargs)
File "/home/user/anaconda2/envs/stackGANv2/lib/python2.7/site-packages/torch/nn/parallel/data_parallel.py", line 121, in forward
return self.module(*inputs[0], **kwargs[0])
File "/home/user/anaconda2/envs/stackGANv2/lib/python2.7/site-packages/torch/nn/modules/module.py", line 477, in call
result = self.forward(*input, **kwargs)
File "/home/user/Downloads/StackGAN-v2-master/code/model.py", line 275, in forward
h_code3 = self.h_net3(h_code2, c_code)
File "/home/user/anaconda2/envs/stackGANv2/lib/python2.7/site-packages/torch/nn/modules/module.py", line 477, in call
result = self.forward(*input, **kwargs)
File "/home/user/Downloads/StackGAN-v2-master/code/model.py", line 215, in forward
out_code = self.upsample(out_code)
File "/home/user/anaconda2/envs/stackGANv2/lib/python2.7/site-packages/torch/nn/modules/module.py", line 477, in call
result = self.forward(*input, **kwargs)
File "/home/user/anaconda2/envs/stackGANv2/lib/python2.7/site-packages/torch/nn/modules/container.py", line 91, in forward
input = module(input)
File "/home/user/anaconda2/envs/stackGANv2/lib/python2.7/site-packages/torch/nn/modules/module.py", line 477, in call
result = self.forward(*input, **kwargs)
File "/home/user/anaconda2/envs/stackGANv2/lib/python2.7/site-packages/torch/nn/modules/batchnorm.py", line 66, in forward
exponential_average_factor, self.eps)
File "/home/user/anaconda2/envs/stackGANv2/lib/python2.7/site-packages/torch/nn/functional.py", line 1254, in batch_norm
training, momentum, eps, torch.backends.cudnn.enabled
RuntimeError: CUDA error: out of memory

Demo File

Can we get a demo file for StackGAN-v2 please?

protobuf import error

Hi, I have an error when importing protobuf. Anyone know how to deal with it? Really appreciate it.

embeddings: (8855, 10, 1024)
Traceback (most recent call last):
File "main.py", line 139, in
from trainer import condGANTrainer as trainer
File "/home/lby/Desktop/StackGAN-v2/code/trainer.py", line 19, in
from tensorboard import summary
File "/home/lby/anaconda3/envs/GAN/lib/python2.7/site-packages/tensorboard/init.py", line 4, in
from .writer import FileWriter, SummaryWriter
File "/home/lby/anaconda3/envs/GAN/lib/python2.7/site-packages/tensorboard/writer.py", line 23, in
from .src import event_pb2
File "/home/lby/anaconda3/envs/GAN/lib/python2.7/site-packages/tensorboard/src/event_pb2.py", line 6, in
from google.protobuf import descriptor as _descriptor
File "/home/lby/anaconda3/envs/GAN/lib/python2.7/site-packages/google/protobuf/descriptor.py", line 113
class DescriptorBase(metaclass=DescriptorMetaclass):
^
SyntaxError: invalid syntax

torch.cuda.set_device(self.gpus[0])

RuntimeError: cuda runtime error (10) : invalid device ordinal at torch/csrc/cuda/Module.cpp:32

Please tell me how to solve this problem?

char-CNN-RNN text embeddings for ImageNet and LSUN

It's really helpful that you provided this, especially with the pre-extracted text features for the birds. Could you also link to the pre-extracted text features for ImageNet and LSUN? Or at least where the raw captions are, so we can run the extractor ourselves? Thanks!

class StringIO has no attribute 'StringIO'

Hi I am running the code but an error occurs:

Traceback (most recent call last):
File "main.py", line 144, in
algo.train()
File "/home/zzw/program/text2img/StackGAN-v2/code/trainer.py", line 755, in train
count, self.image_dir, self.summary_writer)
File "/home/zzw/program/text2img/StackGAN-v2/code/trainer.py", line 206, in save_img_results
sup_real_img = summary.image('real_img', real_img_set)
File "/usr/local/lib/python2.7/dist-packages/tensorboard/summary.py", line 179, in image
image = make_image(tensor, height, width, channel)
File "/usr/local/lib/python2.7/dist-packages/tensorboard/summary.py", line 186, in make_image
output = StringIO.StringIO()
AttributeError: class StringIO has no attribute 'StringIO'

I am using python 2.7 and tensorboard1.0.0a6, and it seems like something wrong with the tensorboard version, could anybody help me?

/data/birds/train/filenames.pickle

When running main.py on the birds dataset, I get an error:

IOError: [Errno 2] No such file or directory: u'../data/birds/train/filenames.pickle'

How is /data/birds/train/filenames.pickle generated? I downloaded the CUB_200_2011 dataset and unzipped into /data/birds/CUB_200_2011

Thank you

trying my own dataset

i am trying to use my own dataset on this GAN model, can you please give me some advice on how to pre-process the dataset images and text to make it fit the model

RuntimeError: reduce failed to synchronize: device-side assert triggered

[219/600][368]
Loss_D: 1.21 Loss_G: 47.18 Loss_KL: 9.08 Time: 264.67s

/pytorch/aten/src/THCUNN/BCECriterion.cu:42: Acctype bce_functor<Dtype, Acctype>::operator()(Tuple) [with Tuple = thrust::detail::tuple_of_iterator_references<thrust::device_reference, thrust::device_reference, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>, Dtype = float, Acctype = float]: block: [0,0,0], thread: [0,0,0] Assertion input >= 0. && input <= 1. failed.
/pytorch/aten/src/THCUNN/BCECriterion.cu:42: Acctype bce_functor<Dtype, Acctype>::operator()(Tuple) [with Tuple = thrust::detail::tuple_of_iterator_references<thrust::device_reference, thrust::device_reference, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>, Dtype = float, Acctype = float]: block: [0,0,0], thread: [1,0,0] Assertion input >= 0. && input <= 1. failed.
/pytorch/aten/src/THCUNN/BCECriterion.cu:42: Acctype bce_functor<Dtype, Acctype>::operator()(Tuple) [with Tuple = thrust::detail::tuple_of_iterator_references<thrust::device_reference, thrust::device_reference, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>, Dtype = float, Acctype = float]: block: [0,0,0], thread: [2,0,0] Assertion input >= 0. && input <= 1. failed.
/pytorch/aten/src/THCUNN/BCECriterion.cu:42: Acctype bce_functor<Dtype, Acctype>::operator()(Tuple) [with Tuple = thrust::detail::tuple_of_iterator_references<thrust::device_reference, thrust::device_reference, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>, Dtype = float, Acctype = float]: block: [0,0,0], thread: [3,0,0] Assertion input >= 0. && input <= 1. failed.
/pytorch/aten/src/THCUNN/BCECriterion.cu:42: Acctype bce_functor<Dtype, Acctype>::operator()(Tuple) [with Tuple = thrust::detail::tuple_of_iterator_references<thrust::device_reference, thrust::device_reference, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>, Dtype = float, Acctype = float]: block: [0,0,0], thread: [4,0,0] Assertion input >= 0. && input <= 1. failed.
/pytorch/aten/src/THCUNN/BCECriterion.cu:42: Acctype bce_functor<Dtype, Acctype>::operator()(Tuple) [with Tuple = thrust::detail::tuple_of_iterator_references<thrust::device_reference, thrust::device_reference, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>, Dtype = float, Acctype = float]: block: [0,0,0], thread: [5,0,0] Assertion input >= 0. && input <= 1. failed.
/pytorch/aten/src/THCUNN/BCECriterion.cu:42: Acctype bce_functor<Dtype, Acctype>::operator()(Tuple) [with Tuple = thrust::detail::tuple_of_iterator_references<thrust::device_reference, thrust::device_reference, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>, Dtype = float, Acctype = float]: block: [0,0,0], thread: [6,0,0] Assertion input >= 0. && input <= 1. failed.
/pytorch/aten/src/THCUNN/BCECriterion.cu:42: Acctype bce_functor<Dtype, Acctype>::operator()(Tuple) [with Tuple = thrust::detail::tuple_of_iterator_references<thrust::device_reference, thrust::device_reference, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>, Dtype = float, Acctype = float]: block: [0,0,0], thread: [7,0,0] Assertion input >= 0. && input <= 1. failed.
/pytorch/aten/src/THCUNN/BCECriterion.cu:42: Acctype bce_functor<Dtype, Acctype>::operator()(Tuple) [with Tuple = thrust::detail::tuple_of_iterator_references<thrust::device_reference, thrust::device_reference, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>, Dtype = float, Acctype = float]: block: [0,0,0], thread: [8,0,0] Assertion input >= 0. && input <= 1. failed.
/pytorch/aten/src/THCUNN/BCECriterion.cu:42: Acctype bce_functor<Dtype, Acctype>::operator()(Tuple) [with Tuple = thrust::detail::tuple_of_iterator_references<thrust::device_reference, thrust::device_reference, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>, Dtype = float, Acctype = float]: block: [0,0,0], thread: [9,0,0] Assertion input >= 0. && input <= 1. failed.
/pytorch/aten/src/THCUNN/BCECriterion.cu:42: Acctype bce_functor<Dtype, Acctype>::operator()(Tuple) [with Tuple = thrust::detail::tuple_of_iterator_references<thrust::device_reference, thrust::device_reference, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>, Dtype = float, Acctype = float]: block: [0,0,0], thread: [10,0,0] Assertion input >= 0. && input <= 1. failed.
/pytorch/aten/src/THCUNN/BCECriterion.cu:42: Acctype bce_functor<Dtype, Acctype>::operator()(Tuple) [with Tuple = thrust::detail::tuple_of_iterator_references<thrust::device_reference, thrust::device_reference, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>, Dtype = float, Acctype = float]: block: [0,0,0], thread: [11,0,0] Assertion input >= 0. && input <= 1. failed.
/pytorch/aten/src/THCUNN/BCECriterion.cu:42: Acctype bce_functor<Dtype, Acctype>::operator()(Tuple) [with Tuple = thrust::detail::tuple_of_iterator_references<thrust::device_reference, thrust::device_reference, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>, Dtype = float, Acctype = float]: block: [0,0,0], thread: [12,0,0] Assertion input >= 0. && input <= 1. failed.
/pytorch/aten/src/THCUNN/BCECriterion.cu:42: Acctype bce_functor<Dtype, Acctype>::operator()(Tuple) [with Tuple = thrust::detail::tuple_of_iterator_references<thrust::device_reference, thrust::device_reference, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>, Dtype = float, Acctype = float]: block: [0,0,0], thread: [13,0,0] Assertion input >= 0. && input <= 1. failed.
/pytorch/aten/src/THCUNN/BCECriterion.cu:42: Acctype bce_functor<Dtype, Acctype>::operator()(Tuple) [with Tuple = thrust::detail::tuple_of_iterator_references<thrust::device_reference, thrust::device_reference, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>, Dtype = float, Acctype = float]: block: [0,0,0], thread: [14,0,0] Assertion input >= 0. && input <= 1. failed.
/pytorch/aten/src/THCUNN/BCECriterion.cu:42: Acctype bce_functor<Dtype, Acctype>::operator()(Tuple) [with Tuple = thrust::detail::tuple_of_iterator_references<thrust::device_reference, thrust::device_reference, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>, Dtype = float, Acctype = float]: block: [0,0,0], thread: [15,0,0] Assertion input >= 0. && input <= 1. failed.
/pytorch/aten/src/THCUNN/BCECriterion.cu:42: Acctype bce_functor<Dtype, Acctype>::operator()(Tuple) [with Tuple = thrust::detail::tuple_of_iterator_references<thrust::device_reference, thrust::device_reference, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>, Dtype = float, Acctype = float]: block: [0,0,0], thread: [16,0,0] Assertion input >= 0. && input <= 1. failed.
/pytorch/aten/src/THCUNN/BCECriterion.cu:42: Acctype bce_functor<Dtype, Acctype>::operator()(Tuple) [with Tuple = thrust::detail::tuple_of_iterator_references<thrust::device_reference, thrust::device_reference, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>, Dtype = float, Acctype = float]: block: [0,0,0], thread: [17,0,0] Assertion input >= 0. && input <= 1. failed.
/pytorch/aten/src/THCUNN/BCECriterion.cu:42: Acctype bce_functor<Dtype, Acctype>::operator()(Tuple) [with Tuple = thrust::detail::tuple_of_iterator_references<thrust::device_reference, thrust::device_reference, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>, Dtype = float, Acctype = float]: block: [0,0,0], thread: [18,0,0] Assertion input >= 0. && input <= 1. failed.
/pytorch/aten/src/THCUNN/BCECriterion.cu:42: Acctype bce_functor<Dtype, Acctype>::operator()(Tuple) [with Tuple = thrust::detail::tuple_of_iterator_references<thrust::device_reference, thrust::device_reference, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>, Dtype = float, Acctype = float]: block: [0,0,0], thread: [19,0,0] Assertion input >= 0. && input <= 1. failed.
/pytorch/aten/src/THCUNN/BCECriterion.cu:42: Acctype bce_functor<Dtype, Acctype>::operator()(Tuple) [with Tuple = thrust::detail::tuple_of_iterator_references<thrust::device_reference, thrust::device_reference, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>, Dtype = float, Acctype = float]: block: [0,0,0], thread: [20,0,0] Assertion input >= 0. && input <= 1. failed.
/pytorch/aten/src/THCUNN/BCECriterion.cu:42: Acctype bce_functor<Dtype, Acctype>::operator()(Tuple) [with Tuple = thrust::detail::tuple_of_iterator_references<thrust::device_reference, thrust::device_reference, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>, Dtype = float, Acctype = float]: block: [0,0,0], thread: [21,0,0] Assertion input >= 0. && input <= 1. failed.
/pytorch/aten/src/THCUNN/BCECriterion.cu:42: Acctype bce_functor<Dtype, Acctype>::operator()(Tuple) [with Tuple = thrust::detail::tuple_of_iterator_references<thrust::device_reference, thrust::device_reference, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>, Dtype = float, Acctype = float]: block: [0,0,0], thread: [22,0,0] Assertion input >= 0. && input <= 1. failed.
/pytorch/aten/src/THCUNN/BCECriterion.cu:42: Acctype bce_functor<Dtype, Acctype>::operator()(Tuple) [with Tuple = thrust::detail::tuple_of_iterator_references<thrust::device_reference, thrust::device_reference, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>, Dtype = float, Acctype = float]: block: [0,0,0], thread: [23,0,0] Assertion input >= 0. && input <= 1. failed.
Traceback (most recent call last):
File "main.py", line 146, in
algo.train()
File "/home/wt/pycharmprojects/StackGAN-v2-master/code/trainer.py", line 733, in train
errD = self.train_Dnet(i, count)
File "/home/wt/pycharmprojects/StackGAN-v2-master/code/trainer.py", line 596, in train_Dnet
errD_wrong = criterion(wrong_logits[0], fake_labels)
File "/usr/local/anaconda3/envs/wtstackgan/lib/python2.7/site-packages/torch/nn/modules/module.py", line 493, in call
result = self.forward(*input, **kwargs)
File "/usr/local/anaconda3/envs/wtstackgan/lib/python2.7/site-packages/torch/nn/modules/loss.py", line 512, in forward
return F.binary_cross_entropy(input, target, weight=self.weight, reduction=self.reduction)
File "/usr/local/anaconda3/envs/wtstackgan/lib/python2.7/site-packages/torch/nn/functional.py", line 2113, in binary_cross_entropy
input, target, weight, reduction_enum)
RuntimeError: reduce failed to synchronize: device-side assert triggered

Cuda out of memory error

I try to reproduce the code but get stuck in cuda out of memory error when loading Inception-v3 model.

I tried both on a Windows 10 PC with Nvidia 1060X graphic card (6G) and a Linux server with Nvidia Geforce Titan Graphic card (12G). But both time I ran out of memory with the following message:

THCudaCheck FAIL file=/opt/conda/conda-bld/pytorch_1513368888240/work/torch/lib/THC/generic/THCStorage.cu line=58 error=2 : out of memory Traceback (most recent call last): File "main.py", line 144, in <module> algo.train() File "/backup1/lingboyang/StackGANv2/code/trainer.py", line 666, in train self.inception_model, start_count = load_network(self.gpus) File "/backup1/lingboyang/StackGANv2/code/trainer.py", line 126, in load_network netsD[i] = torch.nn.DataParallel(netsD[i], device_ids=gpus) File "/home/vcl/anaconda3/envs/pytorch/lib/python3.6/site-packages/torch/nn/parallel/data_parallel.py", line 59, in __init__ self.module.cuda(device_ids[0]) File "/home/vcl/anaconda3/envs/pytorch/lib/python3.6/site-packages/torch/nn/modules/module.py", line 216, in cuda return self._apply(lambda t: t.cuda(device)) File "/home/vcl/anaconda3/envs/pytorch/lib/python3.6/site-packages/torch/nn/modules/module.py", line 146, in _apply module._apply(fn) File "/home/vcl/anaconda3/envs/pytorch/lib/python3.6/site-packages/torch/nn/modules/module.py", line 146, in _apply module._apply(fn) File "/home/vcl/anaconda3/envs/pytorch/lib/python3.6/site-packages/torch/nn/modules/module.py", line 152, in _apply param.data = fn(param.data) File "/home/vcl/anaconda3/envs/pytorch/lib/python3.6/site-packages/torch/nn/modules/module.py", line 216, in <lambda> return self._apply(lambda t: t.cuda(device)) File "/home/vcl/anaconda3/envs/pytorch/lib/python3.6/site-packages/torch/_utils.py", line 69, in _cuda return new_type(self.size()).copy_(self, async) RuntimeError: cuda runtime error (2) : out of memory at /opt/conda/conda-bld/pytorch_1513368888240/work/torch/lib/THC/generic/THCStorage.cu:58

Is this normal? @hanzhanggit Could you tell me what's the minimal hardware requirement to run this program? Is there any way to save graphic memory? Thanks!

could not reproduce the expriment

Hi,I'm very interested in your work. And I followed everything in README. However,when I evaluate the model(using the birds dataset) I've trained myself with 600 epochs, I even could not get any image have a blurry bird on it, all the images just have one single color without any pattern. And when I use tensorboard, I found that it could not converge. So I'm very confused, is there anything wrong or the training not enough?
image
image
image
image

[Ask]please tell me library's version

I tried StackGANv2, but in a horrible library version I could not move it differently.

Did you tell us the version of the following library of StackGANv2 moved environment?

  • tensorflow
  • tensorboard

Because I cant import

from tensorboard import FileWriter

Cannot handle this data type: (1, 1, 260), |u1

Traceback (most recent call last):
File "C:\Users\suman\OneDrive\Documents\StackGan-2\code\main.py", line 144, in
algo.train()
File "C:\Users\suman\OneDrive\Documents\StackGan-2\code\trainer.py", line 756, in train
save_img_results(self.imgs_tcpu, self.fake_imgs, self.num_Ds,
File "C:\Users\suman\OneDrive\Documents\StackGan-2\code\trainer.py", line 207, in save_img_results
sup_real_img = summary.image('real_img', real_img_set).convert('RGB')
File "C:\Users\suman\AppData\Local\Programs\Python\Python310\lib\site-packages\tensorboardX\summary.py", line 287, in image
image = make_image(tensor, rescale=rescale)
File "C:\Users\suman\AppData\Local\Programs\Python\Python310\lib\site-packages\tensorboardX\summary.py", line 329, in make_image
image = Image.fromarray(tensor)
File "C:\Users\suman\AppData\Local\Programs\Python\Python310\lib\site-packages\PIL\Image.py", line 2955, in fromarray
raise TypeError("Cannot handle this data type: %s, %s" % typekey) from e
TypeError: Cannot handle this data type: (1, 1, 260), |u1

This line is causing the error --> sup_real_img = summary.image('real_img', real_img_set)

CUBLAS_STATUS_INTERNAL_ERROR

Hi,

I am trying to run your code, but I keep getting this error:
```RuntimeError: CUDA error: CUBLAS_STATUS_INTERNAL_ERROR when calling `cublasCreate(handle)````

I am using:
CUDA Version: 11.0
Driver Version: 450.66

Could the CUDA version be the source of the problem?

Thanks

cannot import name FileWriter

File "/home/txl/TF-Projects/GAN/StackGAN-v2-master/code/trainer.py", line 20, in
from tensorboard import FileWriter
ImportError: cannot import name FileWriter

I found that tensorboard has no model named FileWriter.
anyone can tell me how to resolve this problem ?

MultiGPU multiplier very low.

1x TITAN XP,260s/epoch ( birds_3stages )
2x TITAN XP,240s/epoch ( birds_3stages )
3x TITAN XP,220s/epoch ( birds_3stages )

EOFError, cant find a solution

Traceback (most recent call last):
File "main.py", line 150, in
algo.train()
File "/disk/StackGAN-v2-master/code/trainer.py", line 347, in train
self.inception_model, start_count = load_network(self.gpus)
File "/disk/StackGAN-v2-master/code/trainer.py", line 132, in load_network
state_dict = torch.load(cfg.TRAIN.NET_G)
File "/usr/local/lib/python2.7/dist-packages/torch/serialization.py", line 358, in load
return _load(f, map_location, pickle_module)
File "/usr/local/lib/python2.7/dist-packages/torch/serialization.py", line 531, in _load
magic_number = pickle_module.load(f)
EOFError

GLU instead of ReLU

Why are you using gated linear units (GLU) instead of the ReLU mentioned in the paper?

Also, why did you define your own GLU instead of using the built-in one? Was there a reason or was it just not implemented yet when you wrote this?

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.