mingyuliutw / UNIT

Unsupervised Image-to-Image Translation
Other
1.98k stars 360 forks source link

Error while running on my own dataset #78

Closed mhusseinsh closed 5 years ago

mhusseinsh commented 6 years ago

Hello, I followed your instructions on getting the network running on my own dataset. However, I receive an error

Proxy tunneling failed: ForbiddenUnable to establish SSL connection.
Traceback (most recent call last):
  File "train.py", line 39, in <module>
    trainer = UNIT_Trainer(config)
  File "/mnt/DTAA_data/DTAA/code/z637177/UNIT-master/trainer.py", line 235, in __init__
    self.vgg = load_vgg16(hyperparameters['vgg_model_path'] + '/models')
  File "/mnt/DTAA_data/DTAA/code/z637177/UNIT-master/utils.py", line 225, in load_vgg16
    vgglua = load_lua(os.path.join(model_dir, 'vgg16.t7'))
  File "/home/adm.Z637177/.local/lib/python2.7/site-packages/torch/utils/serialization/read_lua_file.py", line 608, in load_lua
    return reader.read()
  File "/home/adm.Z637177/.local/lib/python2.7/site-packages/torch/utils/serialization/read_lua_file.py", line 579, in read
    typeidx = self.read_int()
  File "/home/adm.Z637177/.local/lib/python2.7/site-packages/torch/utils/serialization/read_lua_file.py", line 475, in read_int
    return self._read('i')
  File "/home/adm.Z637177/.local/lib/python2.7/site-packages/torch/utils/serialization/read_lua_file.py", line 466, in _read
    result = struct.unpack(fmt, self.f.read(sz))
struct.error: unpack requires a string argument of length 4

Any idea what can be the problem here ?

mhusseinsh commented 6 years ago

I believe this was a problem in failure of the download of vgg16.t7 I managed to download it manually and put it in the model folder

Now I have this error


  File "/mnt/DTAA_data/DTAA/code/z637177/UNIT-master/utils.py", line 244, in vgg_preprocess
    batch = batch.sub(Variable(mean)) # subtract mean
RuntimeError: Expected object of type torch.cuda.FloatTensor but found type torch.FloatTensor for argument #3 'other'
mhusseinsh commented 6 years ago

Update: I had to change mean = tensortype(batch.data.size()).cuda() to mean = tensortype(batch.data.size()).cuda() in def vgg_preprocess(batch) in utils.py

I am not sure if this is the correct solution

mingyuliutw commented 6 years ago

@mhusseinsh Thanks. This seems to fix the problem.