> ## Documentation Index
> Fetch the complete documentation index at: https://docs.coreweave.com/llms.txt
> Use this file to discover all available pages before exploring further.

> Intégrez W&B à OpenAI Gym pour suivre vos expériences d’apprentissage par renforcement et enregistrer des vidéos des performances de chaque épisode.

# OpenAI Gym

<Note>
  "The team that has been maintaining Gym since 2021 has moved all future development to [Gymnasium](https://github.com/Farama-Foundation/Gymnasium), a drop in replacement for Gym (import gymnasium as gym), and Gym will not be receiving any future updates." ([Source](https://github.com/openai/gym#the-team-that-has-been-maintaining-gym-since-2021-has-moved-all-future-development-to-gymnasium-a-drop-in-replacement-for-gym-import-gymnasium-as-gym-and-gym-will-not-be-receiving-any-future-updates-please-switch-over-to-gymnasium-as-soon-as-youre-able-to-do-so-if-youd-like-to-read-more-about-the-story-behind-this-switch-please-check-out-this-blog-post))

  Gym n’étant plus maintenu, essayez plutôt l’intégration avec Gymnasium.
</Note>

Cette page explique comment utiliser W\&B avec [OpenAI Gym](https://github.com/openai/gym) pour capturer automatiquement des vidéos de vos environnements d’apprentissage par renforcement. Vous pouvez ensuite examiner le comportement de l’agent en regard des métriques de votre expérience dans W\&B.

Si vous utilisez OpenAI Gym, W\&B consigne automatiquement les vidéos de votre environnement générées par `gym.wrappers.Monitor`. Pour activer cette fonctionnalité, définissez l’argument nommé `monitor_gym` de [`wandb.init()`](/fr/products/wandb/ref/python/functions/init) sur `True`, ou appelez `wandb.gym.monitor()`.

L’intégration gym est légère. Elle [examine le nom du fichier vidéo](https://github.com/wandb/wandb/blob/master/wandb/integration/gym/__init__.py#L15) journalisé depuis `gym` et nomme la vidéo d’après celui-ci, ou utilise `"videos"` par défaut si aucune correspondance n’est trouvée. Pour un contrôle plus fin, vous pouvez [journaliser une vidéo](/fr/products/wandb/track/log/media) manuellement.

L’[OpenRL Benchmark](https://wandb.me/openrl-benchmark-report) de [CleanRL](https://github.com/vwxyzjn/cleanrl) utilise cette intégration pour ses exemples OpenAI Gym. Vous y trouverez du code source (y compris [le code utilisé pour certains runs](https://forge.coreweave.com/wandb/cleanrl/cleanrl.benchmark/runs/2jrqfugg/code?workspace=user-costa-huang)) montrant comment utiliser gym avec W\&B.

<Frame>
  <img src="https://mintcdn.com/coreweave-dbfa0e8d/3Dv_sw2eg8feUJlx/products/wandb/_media/open_ai_report_example.png?fit=max&auto=format&n=3Dv_sw2eg8feUJlx&q=85&s=ae0ce3cdf2081211ac8cce80c68a1900" alt="Tableau de bord OpenAI Gym" width="1048" height="815" data-path="products/wandb/_media/open_ai_report_example.png" />
</Frame>


## Related topics

- [OpenAI](/fr/products/wandb/weave/guides/integrations/openai.md)
