apple / ml-cvnets

CVNets: A library for training computer vision networks
https://apple.github.io/ml-cvnets
Other
1.76k stars 225 forks source link

Not possible to test ByteFormer #80

Closed zangobot closed 11 months ago

zangobot commented 1 year ago

Hello!

I'm trying to run some tests (not training) with the pretrained models, by using the instructions on the README. However, this:

cvnets-eval --common.config-file examples/byteformer/imagenet_jpeg_q100/conv_kernel_size=8.yaml --model.classification.pretrained examples/byteformer/imagenet_jpeg_q100/imagenet_jpeg_q100_k8_w128.pt

gives this error:

Traceback (most recent call last):
  File "/PATH/miniconda3/envs/cvnets/bin/cvnets-eval", line 5, in <module>
    from main_eval import main_worker
ModuleNotFoundError: No module named 'main_eval'

So, I tried by launching the script myself (python main_eval.py with same params as above), but it tells me that FileNotFoundError: [Errno 2] No such file or directory: '/mnt/imagenet/validation'

I would just like to load the model (through the get_model function) but it is very hard to navigate between all the needed parameters (and some seems to be missing, like "model.classification.byteformer.dropout" or "model.classification.byteformer.norm_layer" to name a few.

Thank you in advance!

darwinharianto commented 1 year ago

Hi, I was having the same problem

ModuleNotFoundError: No module named 'main_eval'

this just means you have to export PYTHONPATH=. if you are at root

FileNotFoundError: [Errno 2] No such file or directory: '/mnt/imagenet/validation'

this is the dataset location, I believe you have to download the dataset first and change this path

zangobot commented 1 year ago

I assumed that downloading imagenet would have been a solution, I just wished a lighter way to test the model without all the imagenet infrastructure (maybe it is possible through the get_model function in the code?

This would be really helpful for future testing!

darwinharianto commented 1 year ago

I copied some part of the script to run sample on few segmentation models here. hope it can help

or

https://github.com/apple/ml-cvnets/issues/69#issuecomment-1449366188 here someone make a simple script to load and save model

zangobot commented 1 year ago

Thank you so much! I will try this soon!

mchorton commented 11 months ago

I assumed that downloading imagenet would have been a solution, I just wished a lighter way to test the model without all the imagenet infrastructure (maybe it is possible through the get_model function in the code?

This would be really helpful for future testing!

@zangobot you can see an example of how to load the model without downloading imagenet here: tests/models/classification/test_byteformer.py

you will need to modify the file a bit to load the pretrained weights, but that shows you an example of how to build the model