PerfectDou

repository·main·Indexed 42 days ago

https://github.com/netease-games-ai-lab-guangzhou/perfectdou

A state-of-the-art DouDizhu AI system utilizing perfect information distillation. The repository provides pretrained models and an evaluation pipeline to compare agents against baselines such as DouZero and RLCard. It includes tools for generating evaluation data via generate_eval_data.py and running agent matches via evaluate.py.

Tokens
733
Snippets
3
Records
5
Agent score
4%

What's inside PerfectDou

  1. Important limitations and availability

    main

    Users should be aware of the following regarding the current repository state:

    • Training Code: The training code is not available because it was developed on a distributed system.
    • Shared Libraries: Modules for calculating left hands and feature engineering are provided as compiled shared libraries (*.so files). The implementation details for these are described in the original paper.
    • Provided Assets: The repository currently only includes the pretrained models and the evaluation code.
  2. Reference: Available agents for evaluation

    main

    When using the evaluate.py script, you can specify the following agent types using their respective keywords:

    • random: Agents that play uniformly at random.
    • rlcard: The rule-based agent from the RLCard framework.
    • douzero: The ADP (Average Difference Points) version from DouZero.
    • perfectdou: The PerfectDou agent (specifically the 2.5e9 frames version).
    • Model Path: You can also provide a direct file path to a pre-trained model file.
  3. Run agent evaluation with evaluate.py

    main

    Use evaluate.py to run self-play or competitive matches between different agents using the generated evaluation data. The evaluation environment and methods are compatible with DouZero.

    Arguments:

    • --landlord: The agent playing as the Landlord. Options: random, rlcard, douzero, perfectdou, or a direct path to a pre-trained model.
    • --landlord_up: The agent playing as LandlordUp (the player before the Landlord). Options: random, rlcard, douzero, perfectdou, or a path to a model.
    • --landlord_down: The agent playing as LandlordDown (the player after the Landlord). Options: random, rlcard, douzero, perfectdou, or a path to a model.
    • --eval_data: The path to the pickle file containing the evaluation data generated in Step 1.
    • --num_workers: The number of subprocesses to use for evaluation.

    Example: Evaluate PerfectDou as Landlord against DouZero agents:

    python3 evaluate.py --landlord perfectdou --landlord_up douzero --landlord_down douzero
  4. Generate evaluation data with generate_eval_data.py

    main

    Use generate_eval_data.py to create the pickled data required for the evaluation pipeline. This script generates random games to serve as the dataset for testing agents.

    Arguments:

    • --output: Path where the pickled data will be saved.
    • --num_games: Number of random games to generate (default: 10000).
    python3 generate_eval_data.py