serve icon indicating copy to clipboard operation
serve copied to clipboard

Error in loading model in Windows os

Open DPeled opened this issue 2 years ago • 4 comments

I've noticed that there is an error in the code: https://github.com/pytorch/serve/blob/a4d5090e114cdbeddf5077a817a8cd02d129159e/ts/model_loader.py#L92

There is an attempt to read the MANIFEST.json file, and there is use of the / charecter which used as a seperator in the Linux os, and in Windows there is use of the back-slash \, so this line creates always an invalid path so the loader does not find the manifest file.

I would change it to use the function os.path.join (which already in use) to write something like this:

manifest_file = os.path.join(model_dir, "MAR-INF", "MANIFEST.json") 

I'm not changing this by myself in a PR beacause I don't know if there is another lines in the code which this error occurs.

DPeled avatar Jun 14 '22 16:06 DPeled

@DPeled Thanks for pointing out the bug. Would you like to send out the fix as a PR?

maaquib avatar Jun 14 '22 17:06 maaquib

@maaquib I can, but waht if there is more errors like this? in another PR?

DPeled avatar Jun 14 '22 17:06 DPeled

You are right. I did a quick search and found a few more 1 2 3 4 5 6 If you'd like to contribute, feel free to send a PR

maaquib avatar Jun 14 '22 17:06 maaquib

I'm on it

DPeled avatar Jun 14 '22 17:06 DPeled