Error: Error: Invalid URI "undefined/api/models" and trainning numbers failed

30 views
Skip to first unread message

jun ma

unread,
May 5, 2022, 4:51:58 AM5/5/22
to Machine Learning for Kids
hi,
 when I run locally, I copy the templates of “Titanic survivors” ,and after I trained,it shows that:
Current model status: Failed

and then I try delete this model, it says:Invalid URI "undefined/api/models"
like this:
error.png
 
after all, I try train a new numbers model, it failed either.
do you konw  how to solve this problem?
thank you.

Dale Lane

unread,
May 5, 2022, 4:56:06 AM5/5/22
to Machine Learning for Kids
The service used for numbers models is identified by an environment variable at  

The "undefined" bit means that environment variable wasn't defined, so the API call wasn't made to a valid numbers service.

Kind regards

D

jun ma

unread,
May 5, 2022, 5:31:01 AM5/5/22
to Machine Learning for Kids
So how can I  change this code for my local running.
I tried change  " https://taxinomitis-numbers-service.mybluemix.net  "  to  "localhost", but it doesn't work.

Dale Lane

unread,
May 5, 2022, 5:33:05 AM5/5/22
to Machine Learning for Kids
You need to run the numbers service yourself and then set the environment variable to the URL for where you are hosting the service.

localhost is fine but it'll presumably be on a different port

Kind regards

D

jun ma

unread,
May 5, 2022, 8:37:40 PM5/5/22
to Machine Learning for Kids
Hi,Dale,
I made the following changes according to your tips:
first,I run the ml4k-numbers-service locally, as " docker run --name  ml4k-numbers -e VERIFY_USER=numbers-service-username  -e VERIFY_PASSWORD=numbers-service-password -p 127.0.0.1:8000:8000 -d dalelane/mlforkids-numbers:14 "  and get the log as below:
[05/May/2022:15:19:46] ENGINE Bus STARTING
[05/May/2022:15:19:46] ENGINE Started monitor thread 'Autoreloader'.
[05/May/2022:15:19:46] ENGINE Serving on http://0.0.0.0:8000
[05/May/2022:15:19:46] ENGINE Bus STARTED

I think it means the service work well.

second, I change the "manifest-template.yml" as :

NUMBERS_SERVICE: http://127.0.0.1:8000
NUMBERS_SERVICE_USER: numbers-service-username
NUMBERS_SERVICE_PASS: numbers-service-password

and the run " npm  run start" again, but I trained the numbers model failed again and got the same error again when I tried to  delete the model.

A certain step should be wrong, but which step is it?

jun ma

unread,
May 5, 2022, 8:44:44 PM5/5/22
to Machine Learning for Kids
by the way , I rebuild the project as "npm run build_notest" after I changed the " manifest-template.yml  "

Dale Lane

unread,
May 6, 2022, 3:24:52 AM5/6/22
to Machine Learning for Kids
manifest.yml files are how to provide environment variables when you are running an application in Cloud Foundry. But if you're just running it on a laptop, then you need to provide the environment variables directly (e.g. using "export" in your shell)

jun ma

unread,
May 6, 2022, 5:32:26 AM5/6/22
to Machine Learning for Kids
oh,my god,  It works well now~~~yeah~
thank you, Dale
Reply all
Reply to author
Forward
0 new messages