walkwithfastai / walkwithfastai.github.io

Host for https://walkwithfastai.com
Other
143 stars 53 forks source link

RuntimeError: running_mean should contain 1024 elements not 2048. #18

Closed craine closed 3 years ago

craine commented 3 years ago

Hi. Posting this over here instead of fastai 👍 I'm seeing the same exact issue all of the sudden: RuntimeError: running_mean should contain 1024 elements not 2048. https://colab.research.google.com/drive/1kY_qH-GCG9IiUhQmH0Gk3-IU338bD0Ea?usp=sharing

Thanks! Charlie

muellerzr commented 3 years ago

This should now be fixed!

dreamflasher commented 3 years ago

I installed the latest timm version from pip: "0.3.4", but still receiving this error.

muellerzr commented 3 years ago

What are your versions of fastai and wwf? Also can you share a reproducer?

On Fri, Jan 8, 2021 at 9:56 AM Marcel Ackermann notifications@github.com wrote:

I installed the latest timm version from pip: "0.3.4", but still receiving this error.

— You are receiving this because you modified the open/close state.

Reply to this email directly, view it on GitHub https://github.com/walkwithfastai/walkwithfastai.github.io/issues/18#issuecomment-756797824, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB3YCV4SRMTIO6PB2BM5OYTSY4MJ5ANCNFSM4VZ2ROFA .

dreamflasher commented 3 years ago
python3 -c "import fastai; import torch; import fastcore; import timm; print(torch.__version__, fastai.__version__, fastcore.__version__, timm.__version__)" 
1.7.0+cu110 2.2.2 1.3.16 0.3.4
from wwf.vision.timm import timm_learner

from fastai.vision.all import *

def label_func(f):
    return f[0].isupper()

path = untar_data(URLs.PETS)
files = get_image_files(path / "images")
dls = ImageDataLoaders.from_name_func(path, files, label_func, item_tfms=Resize(224))
learn = timm_learner(dls, "efficientnet_b2", metrics=error_rate)

learn.fit_one_cycle(3, slice(0.001, 0.03))
dreamflasher commented 3 years ago

Sorry, my bad, I didn't realize that wwf and timm are seperate libraries, updated wwf and now it's working.

muellerzr commented 3 years ago

Great! Glad to see it's working now

davecampbell commented 3 years ago

i am using an offline copy of timm (0.3.4) and wwf (0.0.10) in a kaggle notebook, and just got this error. it actually ran perfectly earlier today, and was able to do a submission from that notebook.

fairly green to all this, but wanted to use an efficientnet in fast.ai so was so glad i discovered wwf!

RuntimeError: running_mean should contain 3072 elements not 1536
muellerzr commented 3 years ago

@davecampbell what is your version of fastai? Looks like it's not the most recent version

davecampbell commented 3 years ago

whatever is on the kaggle containers, i suppose. !pip freeze produced:

fastai==2.1.8
muellerzr commented 3 years ago

You need to update fastai as well, as that is outdated. This fix is for versions > 2.2.4 I believe. This library will always be updated to the latest fastai version, which Kaggle will not always be

davecampbell commented 3 years ago

that sounds reasonable - let me work on getting that fixed and will report back. will also inform another fellow who said he had the same issue. funky thing is that it actually ran error-free earlier today. thanks so much for your attention.

davecampbell commented 3 years ago

i did load fastai 2.2.5 - but as it loaded, it said it was already there. nonetheless, it ran after that - so i think that was the right advice! thanks for that!

craine commented 2 years ago

I ran a notebook last night, woke up this morning and re-ran it and it is giving me this error: RuntimeError: running_mean should contain 4304 elements not 8608

Here is what happened with my frozen parameters.

Screen Shot 2021-10-18 at 8 22 12 AM
muellerzr commented 2 years ago

Can you tell me your versions of fastai and fastcore?

On Mon, Oct 18, 2021, 7:22 AM craine @.***> wrote:

I ran a notebook last night, woke up this morning and re-ran it and it is giving me this error: RuntimeError: running_mean should contain 4304 elements not 8608

Here is what happened with my frozen parameters. [image: Screen Shot 2021-10-18 at 8 22 12 AM] https://user-images.githubusercontent.com/6070016/137729442-dae76586-619a-4775-aee1-ed11b91fb46e.png

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/walkwithfastai/walkwithfastai.github.io/issues/18#issuecomment-945710718, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB3YCV6K2G7YYHLM6JVOXFTUHQGSFANCNFSM4VZ2ROFA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

craine commented 2 years ago

fastai : 2.5.2 fastcore : 1.3.26 timm : 0.4.12