dimikout3 / MarsExplorer

59 stars 6 forks source link

Was this configured on MacOS? #5

Closed t-woodw closed 2 years ago

t-woodw commented 2 years ago

I'm trying to get this set up and working in Ubuntu 20.04.4 LTS.

I've managed to get everything to work so far with the test and manual control after some effort (needing to install Gym in the conda env, issues with the system path not registering the GeneralExplorationPolicy directory, and some other issues I was able to resolve with some dependencies that weren't installing properly which I think mostly came down to not having cmake installed).

After the above, I was having some PATH issues (I have the GEP conda env activated and I am in the GeneralExplorationPolicy base directory), where I had to replace directory paths in the test.py and manual.py files from "../img/mars.jpg" with explicit directory listings like "mars-explorer/img/mars.jpg". Anyway, that was a simple fix, but now I'm running into the same issue while trying to work with runner.py, where I needed to explicitly list the sub directory of the trainner.json file in the runner.py file (under default).

But now I'm getting this error:

Traceback (most recent call last):
  File "trainners/runner.py", line 60, in <module>
    trainner = getTrainner(args)
  File "/home/theuser/GeneralExplorationPolicy/trainners/utils.py", line 51, in getTrainner
    config = getConfig(args)
  File "/home/theuser/GeneralExplorationPolicy/trainners/utils.py", line 43, in getConfig
    config = agentConfig(config, args)
  File "/home/theuser/GeneralExplorationPolicy/trainners/utils.py", line 27, in agentConfig
    for param, value in conf_json["run"][args.run]["agent_conf"].items():
KeyError: 'run' 

Edit: After some follow up, I see there's a trainnerV2.json which I passed as an argument in command line, however that leads to this error seen below:

Traceback (most recent call last):
  File "trainners/runner.py", line 60, in <module>
    trainner = getTrainner(args)
  File "/home/theuser/GeneralExplorationPolicy/trainners/utils.py", line 52, in getTrainner
    config = getConfig(args)
  File "/home/theuser/GeneralExplorationPolicy/trainners/utils.py", line 44, in getConfig
    config = agentConfig(config, args)
  File "/home/theuser/GeneralExplorationPolicy/trainners/utils.py", line 28, in agentConfig
    for param, value in conf_json["run"][args.run]["agent_conf"].items():
KeyError: 'No-Provided'

Not sure what I'm missing here. Is this another potential pathing issue, or am I missing something else?

t-woodw commented 2 years ago

Ok, so I've gotten the trainer to work (it's currently training with no issues, anyway).

I had to specify the paths at command line with some additional passed arguments. This is what I used (using GeneralExplorationPolicy as base directory): $ python trainners/runner.py -c trainners/trainnerV2.json -r Level-1 Additionally, in the utils.py file, I had to uncomment lines 18-21, as they are necessary for Ray:

    # config['model']['dim'] = 21
    # config['model']['conv_filters'] = [ [8, [3, 3], 2],
    #                                     [16, [2, 2], 2],
    #                                     [512, [6, 6], 1]]

Note: leaving the 18-21 commented lead to this error: ValueError: No default configuration for obs shape [21, 21, 1], you must specify conv_filters manually as a model option. Default configurations are only available for inputs of shape [42, 42, K] and [84, 84, K]. You may alternatively want to use a custom model or preprocessor.

dimikout3 commented 2 years ago

So did you manage to solve the issue @t-woodw ?

t-woodw commented 2 years ago

So did you manage to solve the issue @t-woodw ?

It seems I've been able to get everything to work on my system so far. I trained a PPO model using the runner.py methodology you've included. It seems everything worked out, and I have all the checkpoints associated with the training in my ~/ray_results directory.

This is my first time using Ray (and I'm a novice at Open AI besides). How do I go about testing the model I trained? Is there a way to see it in action visually?

t-woodw commented 1 year ago

Hello, I can try, but I have limited time to help due to work. There was a pile of things for which I had to create work arounds to get everything working.

eridon commented 1 year ago

Hello, I can try, but I have limited time to help due to work. There was a pile of things for which I had to create work arounds to get everything working.

Thank you for replying, I have made all the corrections you suggested on this thread. Did you ever come across a gymnasium error which required you to adjust the code to gymnasium standards?

t-woodw commented 1 year ago

I didn’t need to do any of that, but I was meticulous in making sure I had all the correct dependencies and their versions. There were definitely a few things I had to alter in the code to get some things working, though. I think I mostly documented them all in this thread and the other thread you posted in.

What issue are you coming across currently?

On Tue, Apr 11, 2023 at 6:42 AM eridon @.***> wrote:

Hello, I can try, but I have limited time to help due to work. There was a pile of things for which I had to create work arounds to get everything working.

Thank you for replying, I have made all the corrections you suggested on this thread. Did you ever come across a gymnasium error which required you to adjust the code to gymnasium standards?

— Reply to this email directly, view it on GitHub https://github.com/dimikout3/MarsExplorer/issues/5#issuecomment-1503092795, or unsubscribe https://github.com/notifications/unsubscribe-auth/AZGIQ36ZLKZOLLIXZKQLOKTXAUYRFANCNFSM6AAAAAARMTL6HM . You are receiving this because you were mentioned.Message ID: @.***>

t-woodw commented 1 year ago

Ok, so it looks like you do not have the correct versions of Ray and/or Gym, which leads me to wonder if you have the correct versions of all the other dependancies (which even if you went through and updated the way the MarsExplorer code base works with Gym and Ray, you might still need to unravel how all the other dependencies are interacting if even possible).

My recommendation is to delete your current Conda environment and start over from scratch, making sure you have all of the correct versions (you’ll also need to add cmake, before you install from the wheel they include or you’ll get installation errors if I remember correctly).

mmyyen commented 1 year ago

Ok, so I've gotten the trainer to work (it's currently training with no issues, anyway).

I had to specify the paths at command line with some additional passed arguments. This is what I used (using GeneralExplorationPolicy as base directory): $ python trainners/runner.py -c trainners/trainnerV2.json -r Level-1 Additionally, in the utils.py file, I had to uncomment lines 18-21, as they are necessary for Ray:

    # config['model']['dim'] = 21
    # config['model']['conv_filters'] = [ [8, [3, 3], 2],
    #                                     [16, [2, 2], 2],
    #                                     [512, [6, 6], 1]]

Note: leaving the 18-21 commented lead to this error: ValueError: No default configuration for obs shape [21, 21, 1], you must specify conv_filters manually as a model option. Default configurations are only available for inputs of shape [42, 42, K] and [84, 84, K]. You may alternatively want to use a custom model or preprocessor.

sorry to interrupt you, when I input $ python trainners/runner.py -c trainners/trainnerV2.json -r Level-1 in Ubuntu, it always come out the error '''ValueError: ('Observation ({}) outside given space ({})!', array([[[0.6],''', is this the problem of versions of Ray and/or Gym?