Skip to content

Ensure states in replay buffer are stored as uint8 to reduce CPU memory.#7

Merged
whtoo merged 1 commit intomainfrom
fix/cpu-memory-dtype
Jun 21, 2025
Merged

Ensure states in replay buffer are stored as uint8 to reduce CPU memory.#7
whtoo merged 1 commit intomainfrom
fix/cpu-memory-dtype

Conversation

@whtoo
Copy link
Copy Markdown
Owner

@whtoo whtoo commented Jun 21, 2025

This change addresses a hypothesis that states might be stored with a larger data type (e.g., float32) in the replay buffer, contributing to high CPU memory usage.

Modifies RainbowAgent.store_experience to:

  • Check the dtype of state and next_state.
  • Convert them to np.uint8 if they are not already, before adding to the n-step buffer and subsequently the main replay buffer.

This change addresses a hypothesis that states might be stored with a larger data type (e.g., float32) in the replay buffer, contributing to high CPU memory usage.

Modifies `RainbowAgent.store_experience` to:
- Check the dtype of state and next_state.
- Convert them to `np.uint8` if they are not already, before adding to the n-step buffer and subsequently the main replay buffer.
@whtoo whtoo merged commit 87ad7d9 into main Jun 21, 2025
1 check failed
@whtoo whtoo deleted the fix/cpu-memory-dtype branch June 21, 2025 06:34
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