Skip to content

Jules - RL 2 Tests#18

Draft
s2t2 wants to merge 1 commit intocopybara_pushfrom
jules-rl2-tests
Draft

Jules - RL 2 Tests#18
s2t2 wants to merge 1 commit intocopybara_pushfrom
jules-rl2-tests

Conversation

@s2t2
Copy link
Owner

@s2t2 s2t2 commented Jun 19, 2025

This commit introduces unit tests for parts of the reinforcement learning code added in PR google#98.

Here's a summary of what I did:

  1. I reviewed PR Reinforcement Learning Module, Part 2 google/sbsim#98, analyzing changes related to new RL scripts (eval, gin generation), TD3/DDPG agents, and visualization.
  2. I fetched the code from PR Reinforcement Learning Module, Part 2 google/sbsim#98.
  3. I attempted to run the RL scripts:
    • generate_gin_config_files.py ran successfully.
    • train.py failed with a TypeError in tf_agents.policies.policy_saver.PolicySaver, which prevented training and a full evaluation of eval.py. This indicates an issue with the TF-Agents setup or its usage in the PR.
  4. I created unit tests for:
    • smart_control/reinforcement_learning/scripts/generate_gin_config_files.py: These tests cover reading the base configuration, substituting parameters, and generating output files.
    • smart_control/reinforcement_learning/visualization/trajectory_plotter.py: These tests cover the plotting methods for actions, rewards, and cumulative rewards, including how timestamps and empty data are handled.

The tests for these two modules pass. I didn't pursue further testing of agent-specific code or environment wrappers due to the blocking issue with train.py and the TF-Agents environment.

This commit introduces unit tests for parts of the reinforcement learning
code added in PR google#98.

Here's a summary of what I did:
1. I reviewed PR google#98, analyzing changes related to new RL scripts (eval, gin generation), TD3/DDPG agents, and visualization.
2. I fetched the code from PR google#98.
3. I attempted to run the RL scripts:
    - `generate_gin_config_files.py` ran successfully.
    - `train.py` failed with a `TypeError` in `tf_agents.policies.policy_saver.PolicySaver`, which prevented training and a full evaluation of `eval.py`. This indicates an issue with the TF-Agents setup or its usage in the PR.
4. I created unit tests for:
    - `smart_control/reinforcement_learning/scripts/generate_gin_config_files.py`: These tests cover reading the base configuration, substituting parameters, and generating output files.
    - `smart_control/reinforcement_learning/visualization/trajectory_plotter.py`: These tests cover the plotting methods for actions, rewards, and cumulative rewards, including how timestamps and empty data are handled.

The tests for these two modules pass. I didn't pursue further testing of agent-specific code or environment wrappers due to the blocking issue with `train.py` and the TF-Agents environment.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant