Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

struct.error: unpack requires a buffer of 4 bytes #44

Open
kingiw opened this issue Mar 20, 2019 · 4 comments
Open

struct.error: unpack requires a buffer of 4 bytes #44

kingiw opened this issue Mar 20, 2019 · 4 comments

Comments

@kingiw
Copy link

kingiw commented Mar 20, 2019

I tried to convert a Torch pretrained model from https://github.com/tyshiwo/FSRNet. However it crashed when I run the scripts. Here is the error info:

Traceback (most recent call last):
  File ".\convert_torch.py", line 314, in <module>
    torch_to_pytorch(args.model,args.output)
  File ".\convert_torch.py", line 259, in torch_to_pytorch
    model = load_lua(t7_filename,unknown_classes=True)
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 608, in load_lua
    return reader.read()
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 593, in read
    return self.read_object()
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 523, in wrapper
    result = fn(self, *args, **kwargs)
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 548, in read_object
    return TorchObject(cls_name, self.read())
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 595, in read
    return self.read_table()
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 523, in wrapper
    result = fn(self, *args, **kwargs)
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 571, in read_table
    k = self.read()
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 593, in read
    return self.read_object()
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 523, in wrapper
    result = fn(self, *args, **kwargs)
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 548, in read_object
    return TorchObject(cls_name, self.read())
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 595, in read
    return self.read_table()
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 523, in wrapper
    result = fn(self, *args, **kwargs)
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 572, in read_table
    v = self.read()
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 595, in read
    return self.read_table()
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 523, in wrapper
    result = fn(self, *args, **kwargs)
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 572, in read_table
    v = self.read()
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 595, in read
    return self.read_table()
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 523, in wrapper
    result = fn(self, *args, **kwargs)
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 572, in read_table
    v = self.read()
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 595, in read
    return self.read_table()
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 523, in wrapper
    result = fn(self, *args, **kwargs)
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 572, in read_table
    v = self.read()
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 595, in read
    return self.read_table()
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 523, in wrapper
    result = fn(self, *args, **kwargs)
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 572, in read_table
    v = self.read()
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 595, in read
    return self.read_table()
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 523, in wrapper
    result = fn(self, *args, **kwargs)
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 572, in read_table
    v = self.read()
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 595, in read
    return self.read_table()
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 523, in wrapper
    result = fn(self, *args, **kwargs)
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 572, in read_table
    v = self.read()
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 595, in read
    return self.read_table()
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 523, in wrapper
    result = fn(self, *args, **kwargs)
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 572, in read_table
    v = self.read()
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 595, in read
    return self.read_table()
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 523, in wrapper
    result = fn(self, *args, **kwargs)
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 572, in read_table
    v = self.read()
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 595, in read
    return self.read_table()
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 523, in wrapper
    result = fn(self, *args, **kwargs)
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 572, in read_table
    v = self.read()
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 595, in read
    return self.read_table()
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 523, in wrapper
    result = fn(self, *args, **kwargs)
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 572, in read_table
    v = self.read()
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 595, in read
    return self.read_table()
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 523, in wrapper
    result = fn(self, *args, **kwargs)
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 572, in read_table
    v = self.read()
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 595, in read
    return self.read_table()
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 523, in wrapper
    result = fn(self, *args, **kwargs)
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 572, in read_table
    v = self.read()
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 595, in read
    return self.read_table()
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 523, in wrapper
    result = fn(self, *args, **kwargs)
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 572, in read_table
    v = self.read()
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 595, in read
    return self.read_table()
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 523, in wrapper
    result = fn(self, *args, **kwargs)
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 571, in read_table
    k = self.read()
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 593, in read
    return self.read_object()
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 523, in wrapper
    result = fn(self, *args, **kwargs)
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 548, in read_object
    return TorchObject(cls_name, self.read())
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 595, in read
    return self.read_table()
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 523, in wrapper
    result = fn(self, *args, **kwargs)
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 572, in read_table
    v = self.read()
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 595, in read
    return self.read_table()
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 523, in wrapper
    result = fn(self, *args, **kwargs)
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 571, in read_table
    k = self.read()
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 591, in read
    return self.read_function()
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 523, in wrapper
    result = fn(self, *args, **kwargs)
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 532, in read_function
    upvalues = self.read()
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 579, in read
    typeidx = self.read_int()
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\site-packages\torch\utils\serialization\read_lua_file.py"
, line 475, in read_int
    return self._read('i')
  File "C:\Users\Administrator\Miniconda3\envs\pytorch-old\lib\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 buffer of 4 bytes

Greatly appreciate if you can fix it.

@JauB1981
Copy link

Hi @kingiw I'm trying too to convert the model from https://github.com/tyshiwo/FSRNet but I have the same issue like you. Did you fixed the issue ?
Thanks

@kingiw
Copy link
Author

kingiw commented Aug 19, 2019

Hi @kingiw I'm trying too to convert the model from https://github.com/tyshiwo/FSRNet but I have the same issue like you. Did you fixed the issue ?
Thanks

Not yet. I gave up running this repo in the end.

@RuiJZ
Copy link

RuiJZ commented May 26, 2020

@JauB1981 Did you fixed the issue ?

@JauB1981
Copy link

@JauB1981 Did you fixed the issue ?

unfortunately no !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants