Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I can't use mlagents_trainer_plugin dqn in 3DBall and Match3 unity env(btw,a2c is work) #6095

Closed
RangRun opened this issue Apr 2, 2024 · 2 comments
Labels
bug Issue describes a potential bug in ml-agents. stale Issues that have been idle for a while. Automatically closed by a bot if idle for too long.

Comments

@RangRun
Copy link

RangRun commented Apr 2, 2024

Describe the bug
3DBall env,It seems that there is an incompatibility issue with the shape when obtaining the action due to some torch version reasons

  • shell
mlagents-learn dqn_basic.yaml --env="3DBall" --run-id=3DBall-dqn 
  • config.yaml
    behaviors:
    3DBall:
    trainer_type: dqn
    hyperparameters:
    learning_rate: 0.0003
    learning_rate_schedule: constant
    batch_size: 64
    buffer_size: 50000
    tau: 0.005
    steps_per_update: 10.0
    save_replay_buffer: false
    exploration_schedule: linear
    exploration_initial_eps: 0.8
    exploration_final_eps: 0.05
    network_settings:
    normalize: false
    hidden_units: 20
    num_layers: 2
    vis_encode_type: simple
    reward_signals:
    extrinsic:
    gamma: 0.99
    strength: 1.0
    keep_checkpoints: 5
    max_steps: 500000
    time_horizon: 10
    summary_freq: 1000

  • envs
    Version information:
    ml-agents: 1.0.0,
    ml-agents-envs: 1.0.0,
    Communicator API: 1.5.0,
    PyTorch: 2.2.1

  • error
    in get_greedy_action
    return torch.argmax(all_q.sum(dim=0), dim=1, keepdim=True)
    IndexError: Dimension out of range (expected to be in range of [-1, 0], but got 1)

Match3 env,It seems like Match3VectorObs is only receiving 2 inputs instead of the expected 4 inputs. Additionally, I have a question: why is Match3VectorObs in Unity for 4 agents, but env.behavior_specs["Match3VectorObs?team=0"].observation_specs only retrieves two?

  • shell
mlagents-learn dqn_basic.yaml --env="Match3" --run-id=Match3-dqn 
  • config.yaml
    default_settings:
    trainer_type: dqn
    hyperparameters:
    learning_rate: 0.0003
    learning_rate_schedule: constant
    batch_size: 64
    buffer_size: 50000
    tau: 0.005
    steps_per_update: 10.0
    save_replay_buffer: false
    exploration_schedule: linear
    exploration_initial_eps: 0.8
    exploration_final_eps: 0.05
    network_settings:
    normalize: false
    hidden_units: 20
    num_layers: 2
    vis_encode_type: match3
    reward_signals:
    extrinsic:
    gamma: 0.99
    strength: 1.0
    keep_checkpoints: 5
    max_steps: 500000
    time_horizon: 10
    summary_freq: 1000

  • envs
    Version information:
    ml-agents: 1.0.0,
    ml-agents-envs: 1.0.0,
    Communicator API: 1.5.0,
    PyTorch: 2.2.1

  • error
    line 374, in _assert_worker_can_restart
    raise exception
    mlagents_envs.exception.UnityActionException: The behavior Match3VectorObs?team=0 needs a continuous input of dimension (4, 0) for (, ) but received input of dimension (2, 0)

@RangRun RangRun added the bug Issue describes a potential bug in ml-agents. label Apr 2, 2024
Copy link

github-actions bot commented May 2, 2024

This issue is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale Issues that have been idle for a while. Automatically closed by a bot if idle for too long. label May 2, 2024
Copy link

This issue was closed because it has been inactive for 14 days since being marked as stale. Please open a new issue for related bugs.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue describes a potential bug in ml-agents. stale Issues that have been idle for a while. Automatically closed by a bot if idle for too long.
Projects
None yet
Development

No branches or pull requests

1 participant