falken icon indicating copy to clipboard operation
falken copied to clipboard

Hello Falken demo does not launch AI evaluation

Open DrunkReaperMatt opened this issue 3 years ago • 9 comments

I built the demo from source and ran it. i cannot seem to train the AI with prolonged play and when i start the evaluation process, the console gets flooded with this error: image

i don't know how this came to be, but i built the project as listed in the readmes.

DrunkReaperMatt avatar Nov 12 '21 21:11 DrunkReaperMatt

Do all tests pass? None of the source files have been modified at all?

hmoraldo avatar Nov 15 '21 16:11 hmoraldo

what tests? how to run tests?

source files have not been modified

DrunkReaperMatt avatar Nov 15 '21 16:11 DrunkReaperMatt

You can run tests using python3 service/run_tests.py

I guess we never mentioned in our docs.

But if you haven't modified source code, probably doesn't make sense to run them.

hinasakazaki avatar Nov 15 '21 17:11 hinasakazaki

Which demo are you running? cpp/hello_falken/?

So you move the agent, and then try changing control, and the agent doesn't move? or what does it do?

If the agent never acts when changing control, I would debug that problem before moving to the evaluation issue.

hmoraldo avatar Nov 16 '21 04:11 hmoraldo

i can move the agent and complete the objectives. once i start an evaluation session, those are the messages that pop up

DrunkReaperMatt avatar Nov 16 '21 13:11 DrunkReaperMatt

All demos have a key that allow you to switch between controlling the game yourself and letting the agent play. Before starting an evaluation session it is important to verify that works.

hmoraldo avatar Nov 16 '21 16:11 hmoraldo

what kind of key? the api key?

i can control the ship, complete the objective a few times and then press space to activate the evaluation session.

then those messages keep popping up

DrunkReaperMatt avatar Nov 17 '21 16:11 DrunkReaperMatt

I am having the same issue, any help would be appreciated. I am running tensorflow 2.10. Test gave me this error

`ERROR: test_min_train_examples (learner.learner_test.LearnerTest) learner.learner_test.LearnerTest.test_min_train_examples

Traceback (most recent call last): File "C:\Users\magnu\miniconda3\envs\py3-TF2.10\lib\unittest\mock.py", line 1369, in patched return func(*newargs, **newkeywargs) File "C:\Projects\Falken\service\learner\learner_test.py", line 612, in test_min_train_examples learner.process_assignment_until( File "C:\Projects\Falken\service\learner\learner.py", line 177, in process_assignment_until s, m = next(assignment_generator) File "C:\Projects\Falken\service\learner\learner.py", line 292, in _process_assignment_incrementally raise e File "C:\Projects\Falken\service\learner\learner.py", line 270, in _process_assignment_incrementally for y in proc.process(): File "C:\Projects\Falken\service\learner\assignment_processor.py", line 718, in process for status, metadata in self._process_step(fetcher): File "C:\Projects\Falken\service\learner\assignment_processor.py", line 669, in _process_step saved_model_id = self._save_and_evaluate_policy(exporter) File "C:\Projects\Falken\service\learner\assignment_processor.py", line 507, in _save_and_evaluate_policy exporter.export_model(tmp_checkpoint_path, evals, self._stats, model_id, File "C:\Projects\Falken\service\learner\model_exporter.py", line 136, in export_model self._export_model(model_export_task) File "C:\Projects\Falken\service\learner\model_exporter.py", line 201, in _export_model export_brain.convert_model_to_tflite(tmp_model_path, tf_lite_path) File "C:\Projects\Falken\service\learner\brains\continuous_imitation_brain.py", line 730, in convert_model_to_tflite f.write(saved_model_to_tflite_model.convert(saved_model_path, ['action'])) File "C:\Projects\Falken\service\learner\brains\saved_model_to_tflite_model.py", line 65, in convert return _patch_tflite_model(converter.convert(), main_graph) File "C:\Projects\Falken\service\learner\brains\saved_model_to_tflite_model.py", line 101, in _patch_tflite_model builder.Finish(lite_model.Pack(builder), File "C:\Projects\Falken\service\generated_flatbuffers\tflite\Model.py", line 322, in Pack operatorCodes = builder.EndVector(len(self.operatorCodes)) TypeError: Builder.EndVector() takes 1 positional argument but 2 were given`

bookmagnus avatar Jan 02 '23 16:01 bookmagnus

@bookmagnus The service requires older versions of the Python dependencies (and their respective dependencies), but they are not pinned in service/common/pip_installer.py. So, it installs the latest versions from PyPi.

After giving up to solve the version hell by hand, I found a working solution: https://github.com/astrofrog/pypi-timemachine

Steps on my Linux system (Ubuntu 20.04 LTS):

  1. Install and run PyPI time machine in a virtual env:
$ python3 -m venv venv_tm
$ source venv_tm/bin/activate
(venv_tm)$ pip install pypi-timemachine
(venv_tm)$ pypi-timemachine --port 5000 2021-06-30
Starting pypi-timemachine server at http://localhost:5000
  1. Patch service/common/pip_installer.py to use the time machine (and allow installation inside a virtual env). Here's the diff:
diff --git a/service/common/pip_installer.py b/service/common/pip_installer.py
index 4296565..8e82d44 100644
--- a/service/common/pip_installer.py
+++ b/service/common/pip_installer.py
@@ -67,7 +67,7 @@ _REQUIRED_PYTHON_MODULES = [
     ModuleInfo(pip_module_name='flufl.lock', import_module_name='flufl.lock'),
 ]
 
-_PIP_INSTALL_ARGS = [sys.executable, '-m', 'pip', 'install', '--user']
+_PIP_INSTALL_ARGS = [sys.executable, '-m', 'pip', 'install', '--index-url', 'http://localhost:5000']
 # Cache of installed modules populated by _module_installed().
 _INSTALLED_MODULE_LIST = []
  1. Install and run the Falken service in another virtual env:
$ python3 -m venv venv
$ source venv/bin/activate
(venv)$ python service/launcher.py --project_ids falken_test --generate_sdk_config

scotty007 avatar May 23 '23 09:05 scotty007