Skip to content

Pokemon consolidation#79

Draft
SamBoasman wants to merge 34 commits intomainfrom
pokemon-consolidation
Draft

Pokemon consolidation#79
SamBoasman wants to merge 34 commits intomainfrom
pokemon-consolidation

Conversation

@SamBoasman
Copy link
Contributor

@SamBoasman SamBoasman commented Mar 6, 2025

Adds

  • Support for algorithms that don't require normalized actions
  • Reward overlay feature for video recordings
  • Additional action, reward and episode_reward data recording
  • Shell scripts for different algorithm executions
  • Support for discrete
  • Custom Pokemon docker file

RUN pip3 install -r requirements.txt

WORKDIR /root
RUN git clone https://github.com/PKWadsy/cares_pokemon_configs.git cares_rl_configs
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can probably pull from google drive with some reconfiguration.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea, we should be putting ROMs on github

pydantic==1.10.13
torch==2.3.1
pyboy==2.2.1
pyboy==2.2.2
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test if v2.5.1 is usable.

return self.env.reset()

def step(self, action: int) -> tuple:
# debug-log logging.info("Logging109")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove with logging import.

"""

import logging
import os
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possible removal?

Comment on lines +19 to +20
WORKDIR /workspace/cares_reinforcement_learning
RUN git checkout -t origin/action-info-logging
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the base docker for everything should be off the release versions

RUN pip3 install -r requirements.txt

WORKDIR /root
RUN git clone https://github.com/PKWadsy/cares_pokemon_configs.git cares_rl_configs
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea, we should be putting ROMs on github

Comment on lines +24 to +27
@abc.abstractmethod
def action_as_string(self, action):
raise NotImplemented("Override this method")

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this required?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is not implemented for all the other tasks?

Remove this at this level

Comment on lines +182 to +192
# Horrible hack so I don't have to change all the algorithms
select_action_from_policy = agent.select_action_from_policy

if "info" in inspect.signature(select_action_from_policy).parameters:
normalised_action = select_action_from_policy(
state, noise_scale=noise_scale, info=step_data
)
else:
normalised_action = select_action_from_policy(
state, noise_scale=noise_scale
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this entire folder

Comment on lines +32 to +33
domain: Optional[str] = ""
display: Optional[int] = 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove the redundant Optional

Comment on lines +259 to +282
record.stop_video()
video_dir = os.path.join(record.directory, "videos")
data_dir = os.path.join(record.directory, "data")

run_csv = os.path.join(data_dir, f"episode_{episode_num}.csv")
pd.DataFrame(run_data_rows).to_csv(run_csv, index=False)

if episode_reward > highest_reward:

highest_reward = episode_reward

new_record_video = os.path.join(
video_dir, f"new_record_episode_{episode_num+1}.mp4"
)
training_video = os.path.join(video_dir, "temp_train_video.mp4")

logging.info(
f"New highest reward of {episode_reward}. Saving video and run data..."
)

try:
os.rename(training_video, new_record_video)
except:
logging.error("An error renaming the video occured :/")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope

Comment on lines -173 to -183
if (total_step_counter + 1) % number_steps_per_evaluation == 0:
logging.info("*************--Evaluation Loop--*************")
evaluate_policy_network(
env_eval,
agent,
train_config,
record=record,
total_steps=total_step_counter,
normalisation=normalisation,
)
logging.info("--------------------------------------------")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope - this does not get removed

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete every single change made to policy loop - not happening

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💀

@beardyFace beardyFace marked this pull request as draft March 6, 2025 03:03
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.

3 participants