woozzu / dong_iccv_2017

A PyTorch implementation of the paper "Semantic Image Synthesis via Adversarial Learning" in ICCV 2017
MIT License
145 stars 25 forks source link

ValueError: some of the strides of a given numpy array are negative. #5

Open XinCynthia opened 6 years ago

XinCynthia commented 6 years ago

I have successfully run train_text_embedding_flowers.sh, but when I run train_flowers.sh there is an error like following: Traceback (most recent call last): File "/home/xin/PycharmProjects/newcolorchage/train.py", line 149, in preprocess(img, desc, len_desc, txt_encoder) File "/home/xin/PycharmProjects/newcolorchage/train.py", line 68, in preprocess desc[sorted_indices, ...].transpose(0, 1), ValueError: some of the strides of a given numpy array are negative. This is currently not supported, but will be added in future releases.

could you please tell me why this happened? Thank you very much!

zhouqzzw commented 5 years ago

I got an IndexError when I tried to run train_text_embedding_flowers.sh, as the raw_desc in read_lua_file.py is NoneType. It has bothered me for a long time.

woozzu commented 5 years ago

@rookie-zzw Could you elaborate your issue? e.g. stack traces.. I made this code long time ago, so detailed description would help me understand the issue.

zhouqzzw commented 5 years ago

@woozzu Thank you very much for your reply. Stack traces are as follows: Traceback (most recent call last): File "D:/code/code for Semantic Image Synthesis via Adversarial Learning/train_text_embedding.py", line 80, in std=[0.229, 0.224, 0.225]) File "D:\code\code for Semantic Image Synthesis via Adversarial Learning\data.py", line 31, in init self.data = self._load_dataset(img_root, caption_root, classes_fllename, word_embedding) File "D:\code\code for Semantic Image Synthesis via Adversarial Learning\data.py", line 46, in _load_dataset desc, len_desc = self._get_word_vectors(raw_desc, word_embedding) File "D:\code\code for Semantic Image Synthesis via Adversarial Learning\data.py", line 57, in _get_word_vectors for i in range(desc.shape[1]): IndexError: tuple index out of range

woozzu commented 5 years ago

@rookie-zzw I have no problem when running it on my machine. Can you describe about your environment? e.g. python/pytorch version. And, did you accurately follow the README?

BTW, if you are interested in related projects like this, please check out our recent paper (TAGAN)

zhouqzzw commented 5 years ago

@woozzu I use python 3.5.2 and pytorch 0.4.1 on my machine, and I do follow the README. Surprising, I just read the paper you mentioned a few days ago! It is very meaningful and it is worth learning.

woozzu commented 5 years ago

@rookie-zzw hmm.. that's strange. Can you confirm that raw_desc in this line is None? If so, I think the dataset might be the problem. Please double check the paths in CONFIG, or re-download the dataset.

zhouqzzw commented 5 years ago

@woozzu I tried the solution you suggested, but every time I step through that line, I get the following error: Unable to display children: Error resolving variables Trackback(most recent call last): File "C:\Program Files\JetBrains\PyCharm 2017.3\helpers\pydev_pydevd_bundle\pydevd_comm.py", line 1029, in do_it _typeName, val_dict = pydevd_vars.resolve_compound_variable(self.thread_i, self.frame_id, self.scope, self.attributes) TypeError: 'NoneType' object is not iterable

woozzu commented 5 years ago

@rookie-zzw I'm sorry but I can't reproduce your error. If you can use pdb or something for debugging, printing any suspicious variables might be helpful to find the culprit.

IvonaTau commented 5 years ago

I had the same error and and was able to fix it by copying the numpy array (the indices are thus turned positive) :

packed_desc = nn.utils.rnn.pack_padded_sequence(
        desc[sorted_indices.copy(), ...].transpose(0, 1),
        len_desc[sorted_indices]