Coder Social home page Coder Social logo

Fresh install. Received this error: "ValueError: Expected tensor to be a tensor image of size (C, H, W). Got tensor.size() = torch.Size([128, 3, 224, 224])" about big-sleep HOT 10 OPEN

lucidrains avatar lucidrains commented on August 14, 2024
Fresh install. Received this error: "ValueError: Expected tensor to be a tensor image of size (C, H, W). Got tensor.size() = torch.Size([128, 3, 224, 224])"

from big-sleep.

Comments (10)

lucidrains avatar lucidrains commented on August 14, 2024

@Danscap hmm, that's really weird, what OS are you on?

from big-sleep.

Danscap avatar Danscap commented on August 14, 2024

@lucidrains I am on windows 10 home. Is that the issue?

Could the issue instead be that the version of this software installed from pip is outdated?

from big-sleep.

Danscap avatar Danscap commented on August 14, 2024

@lucidrains here is the full output of the error:


Imagining "a slice of ham with a human mouth" from the depths of my weights...
iteration: 0%| | 0/1050 [00:00<?, ?it/s]
epochs: 0%| | 0/20 [00:00<?, ?it/s]
Traceback (most recent call last):
File "c:\users\jorge\appdata\local\programs\python\python38\lib\runpy.py", line 193, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\users\jorge\appdata\local\programs\python\python38\lib\runpy.py", line 86, in run_code
exec(code, run_globals)
File "C:\Users\Jorge\AppData\Local\Programs\Python\Python38\Scripts\dream.exe_main
.py", line 7, in
File "c:\users\jorge\appdata\local\programs\python\python38\lib\site-packages\big_sleep\cli.py", line 42, in main
fire.Fire(train)
File "c:\users\jorge\appdata\local\programs\python\python38\lib\site-packages\fire\core.py", line 141, in Fire
component_trace = _Fire(component, args, parsed_flag_args, context, name)
File "c:\users\jorge\appdata\local\programs\python\python38\lib\site-packages\fire\core.py", line 466, in _Fire
component, remaining_args = _CallAndUpdateTrace(
File "c:\users\jorge\appdata\local\programs\python\python38\lib\site-packages\fire\core.py", line 681, in _CallAndUpdateTrace
component = fn(*varargs, **kwargs)
File "c:\users\jorge\appdata\local\programs\python\python38\lib\site-packages\big_sleep\cli.py", line 39, in train
imagine()
File "c:\users\jorge\appdata\local\programs\python\python38\lib\site-packages\torch\nn\modules\module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "c:\users\jorge\appdata\local\programs\python\python38\lib\site-packages\big_sleep\big_sleep.py", line 237, in forward
loss = self.train_step(epoch, i)
File "c:\users\jorge\appdata\local\programs\python\python38\lib\site-packages\big_sleep\big_sleep.py", line 207, in train_step
losses = self.model(self.encoded_text)
File "c:\users\jorge\appdata\local\programs\python\python38\lib\site-packages\torch\nn\modules\module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "c:\users\jorge\appdata\local\programs\python\python38\lib\site-packages\big_sleep\big_sleep.py", line 130, in forward
into = normalize_image(into)
File "c:\users\jorge\appdata\local\programs\python\python38\lib\site-packages\torchvision\transforms\transforms.py", line 166, in call
return F.normalize(tensor, self.mean, self.std, self.inplace)
File "c:\users\jorge\appdata\local\programs\python\python38\lib\site-packages\torchvision\transforms\functional.py", line 193, in normalize
raise ValueError('Expected tensor to be a tensor image of size (C, H, W). Got tensor.size() = '
ValueError: Expected tensor to be a tensor image of size (C, H, W). Got tensor.size() = torch.Size([128, 3, 224, 224]).


from big-sleep.

lucidrains avatar lucidrains commented on August 14, 2024

@Danscap I just did a fresh install and it works fine

maybe it is a windows thing, but i'm not sure

from big-sleep.

DrJKL avatar DrJKL commented on August 14, 2024

@Danscap Could you try updating your pip installations?
https://www.activestate.com/resources/quick-reads/how-to-update-all-python-packages/

from big-sleep.

Danscap avatar Danscap commented on August 14, 2024

@DrJKL while I did have some outdated packages that were updated with the commands from the article. Trying afterwards gave the same result.

It's possible the way this code is structured, it may only work on Linux?

from big-sleep.

DrJKL avatar DrJKL commented on August 14, 2024

I've been running it exclusively on Windows 10.

from big-sleep.

htoyryla avatar htoyryla commented on August 14, 2024

return F.normalize(tensor, self.mean, self.std, self.inplace)
File "c:\users\jorge\appdata\local\programs\python\python38\lib\site-packages\torchvision\transforms\functional.py", line 193, in normalize
raise ValueError('Expected tensor to be a tensor image of size (C, H, W). Got tensor.size() = '
ValueError: Expected tensor to be a tensor image of size (C, H, W). Got tensor.size() = torch.Size([128, 3, 224, 224]).

Looks like an older version of torchvision is in use which only accepts 3-dim tensors. Update torchvision.

from big-sleep.

Danscap avatar Danscap commented on August 14, 2024

@htoyryla what torchvision version do you recommend? I have 0.6.1 according to 'print(torchvision.version)'

from big-sleep.

htoyryla avatar htoyryla commented on August 14, 2024

I have 0.8.2. I guess 0.8.x versions are the ones to use with pytorch 1.7.x . There seems been a lot of development going on torchvision transforms, making them more general (to work with both images and batches of tensors).

I am a bit baffled by the line number in your error message, though, the corresponding line in 0.6.1 should be around 290. This is what led me to think that your version is older.

PS. I see, there is a windows specific branch which explains the line number https://github.com/pytorch/vision/blob/3ff9865c0b424ddc4f7ce7f312aa28e604150fa8/torchvision/transforms/functional.py#L192-L194

from big-sleep.

Related Issues (20)

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.