microsoft / ELL

Embedded Learning Library
https://microsoft.github.io/ELL
Other
2.29k stars 294 forks source link

error Importing a model from Open Neural Network in vgg.py file #257

Open MoonSunBeen opened 3 years ago

MoonSunBeen commented 3 years ago

Hello I have problem building CNTK environment

I've checked download pytorch download torchvision environment path

my environment is window10

(py36) C:\Git\ELL\mytest\testcntk>python test.py Traceback (most recent call last): File "test.py", line 6, in <module> import vgg File "C:\Git\ELL\mytest\testcntk\vgg.py", line 3, in <module> from .utils import load_state_dict_from_url ImportError: attempted relative import with no known parent package

The error message is above in miniconda3 prompt.

How can I fix problem from .utils import load_state_dict_from_url?

lovettchris commented 3 years ago

CNTK is an older Microsoft training framework. Are you planning to use CNTK or are you planning on using Pytorch? If you are using Pytorch you do not need CNTK to work. You can build ELL without support for CNTK and then the test will skip it. Simply pass -D CNTK=OFF on the cmake command line. If you really are planning to use CNTK and you are building ell with -D CNTK=ON, can you tell me if this test passes for you?

c:\git\ELL\build>ctest . --build-config release -R cntk

Where did you get the vgg.py file? I'm familiar with this pytorch version:

https://github.com/pytorch/vision/raw/master/torchvision/models/vgg.py

As described in our importing tutorial. But this is not a CNTK model. That tutorial has 3 independent (unrelated) sections, the first shows importing CNTK, the second a Darknet model, and the third an ONNX model (vgg.py). Using ONNX requires building ELL using cmake option -D ONNX=ON.