AttnGAN
AttnGAN copied to clipboard
Transition from Python 2.7 to 3.0+
After invoking "python main.py --cfg cfg/bird_attn2.yml --gpu 2" for bird dataset, I get the following error:
Total filenames: 11788 001.Black_footed_Albatross/Black_Footed_Albatross_0046_18.jpg
Load filenames from: ../data/birds/train/filenames.pickle (8855)
Load filenames from: ../data/birds/test/filenames.pickle (2933)
Load from: ../data/birds/captions.pickle
Traceback (most recent call last):
File "main.py", line 129, in
I couldn't find an answer through Google so I posted back to the community.
I meet the same problem. Have you solved it?
I have successfully solved,You should modify (AttnGAN-master/code/datasets.py", line 254, in load_class_id)“class_id = pickle.load(f)” to “class_id = pickle.load(f,encoding="bytes")”.I hope that you can successful.
For a python 3.6 and pytorch 1.0 version, see my Pull request.
@davidstap ### when i run yours python3.6 in colab, the follow error appear
"""
/content/drive/My Drive/AttnGAN/code
Using config:
{'B_VALIDATION': False,
'CONFIG_NAME': 'attn2',
'CUDA': True,
'DATASET_NAME': 'birds',
'DATA_DIR': '../data/birds',
'GAN': {'B_ATTENTION': True,
'B_DCGAN': False,
'CONDITION_DIM': 100,
'DF_DIM': 64,
'GF_DIM': 32,
'R_NUM': 2,
'Z_DIM': 100},
'GPU_ID': 0,
'RNN_TYPE': 'LSTM',
'TEXT': {'CAPTIONS_PER_IMAGE': 10, 'EMBEDDING_DIM': 256, 'WORDS_NUM': 25},
'TRAIN': {'BATCH_SIZE': 100,
'B_NET_D': False,
'DISCRIMINATOR_LR': 0.0002,
'ENCODER_LR': 0.0002,
'FLAG': False,
'GENERATOR_LR': 0.0002,
'MAX_EPOCH': 600,
'NET_E': '../DAMSMencoders/bird/text_encoder200.pth',
'NET_G': '../models/bird_AttnGAN2.pth',
'RNN_GRAD_CLIP': 0.25,
'SMOOTH': {'GAMMA1': 5.0,
'GAMMA2': 5.0,
'GAMMA3': 10.0,
'LAMBDA': 1.0},
'SNAPSHOT_INTERVAL': 2000},
'TREE': {'BASE_SIZE': 64, 'BRANCH_NUM': 3},
'WORKERS': 1}
Total filenames: 11788 001.Black_footed_Albatross/Black_Footed_Albatross_0046_18.jpg
Load filenames from: ../data/birds/train/filenames.pickle (8855)
Load filenames from: ../data/birds/test/filenames.pickle (2933)
Load from: ../data/birds/captions.pickle
THCudaCheck FAIL file=/pytorch/aten/src/THC/THCGeneral.cpp line=47 error=100 : no CUDA-capable device is detected
Traceback (most recent call last):
File "main.py", line 136, in
then i change the vision to torch==1.2.0; torchvision==0.4.0; it will appear the follow error
"""
/content/drive/My Drive/AttnGAN/code
Traceback (most recent call last):
File "main.py", line 4, in