Hello, I’m getting the following error message:
start java frontend failed: (<class ‘NotADirectoryError’>, NotADirectoryError(20, ‘Not a directory’), <traceback object at 0x7f972aa7ad20>) , while trying to start the torchserve serve on AWS EC2, using the following command:
torchserve --start --model-store model_store --models densenet161=densenet161.mar
W hat am I doing wrong?
Thanks
2 Likes
Based on the error message a directory doesn’t exist. I guess model_store
might be the one, so make sure you’ve created it before executing torchserve
.
1 Like
Thanks for the respones.
These are the steps I used.
Step 1
mkdir torchserve-examples
cd torchserve-examples
git clone https://github.com/pytorch/serve.git
Step 2
wget https://download.pytorch.org/models/densenet161-8d451a50.pth
Step 3
*torch-model-archiver --model-name densenet161 *
*–version 1.0 --model-file serve/examples/image_classifier/densenet_161/model.py *
*–serialized-file densenet161-8d451a50.pth *
*–extra-files serve/examples/image_classifier/index_to_name.json *
–handler image_classifier
Step 4
mkdir model_store
mv densenet161.mar model_store/
torchserve --start --model-store model_store --models densenet161=densenet161.mar
Step 1 to 3 executed well. Just the last command in step 4 gives me issues.
This is first time I’m using AWS for a project like this. I really don’t know what I’m wrong.
What should I do please.
2 Likes
Hi, I am facing a similar problem. The model_store directory is created but I get:
start java frontend failed: (<class 'NotADirectoryError'>, NotADirectoryError(20, 'Not a directory'), <traceback object at 0x7feaf4cafb40>)
The NotADirectoryError
suggests that the used path isn’t pointing to a valid directory, so you could check it first via e.g. os.path.isdir(PATH)
.
I still have the same problem as @garner1 and @AllenAkhaumere . It seems like the problem has not been solved yet.
espoirMur
(Espoir Murhabazi)
February 24, 2023, 3:24pm
7
Same problem here. I have the model_store folder installed.
espoirMur
(Espoir Murhabazi)
February 24, 2023, 3:42pm
8
In more context, when I add call the command with a folder that does not exists, I get the following error:
--model-store directory not found: model_server.
But when I call the command with a folder that exists and contains the file, the error is different.
start java frontend failed: (<class ‘NotADirectoryError’>, NotADirectoryError(20, ‘Not a directory’), <traceback object at 0x10bab05c0>)
espoirMur
(Espoir Murhabazi)
February 24, 2023, 4:54pm
9
Seem to be a permission issue, I tried to run the command with sudo and got it solved.
Thanks to ChatGPT.