sbl1996 / ygo-agent

AI-driven Yu-Gi-Oh! bot using deep reinforcement learning and LLMs
Other
74 stars 6 forks source link

Custom Cards #6

Closed zedja123 closed 4 months ago

zedja123 commented 4 months ago

Any way to use custom cards with this?

zedja123 commented 4 months ago

Also having a problem when executing it:

python -u eval.py --env-id "YGOPro-v0" --deck ../assets/deck/ --num_episodes 32 --strategy random --lang chinese --num_envs 16 Traceback (most recent call last): File "C:\Users\Miguel\Desktop\YUGIOH IA\ygo-agent\scripts\eval.py", line 104, in deck = init_ygopro(args.env_id, args.lang, args.deck, args.code_list_file) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Miguel\Desktop\YUGIOH IA\ygo-agent\scripts\ygoai\utils.py", line 44, in init_ygopro from ygoenv.ygopro import init_module ModuleNotFoundError: No module named 'ygoenv.ygopro'

sbl1996 commented 4 months ago

Any way to use custom cards with this?

Yes, custom cards can be used with this project. Here's how it works:

As for supporting new cards or decks specifically in YGO-Agent, I'm currently working on documentation to explain this process. I'll be adding this information to the README in the coming days.

zedja123 commented 4 months ago

Thanks for the fast response and hard work on this! I haven't come to make it work yet but I'm really excited for it. Could you try to solve the error on the second message?

sbl1996 commented 4 months ago

Also having a problem when executing it:

python -u eval.py --env-id "YGOPro-v0" --deck ../assets/deck/ --num_episodes 32 --strategy random --lang chinese --num_envs 16 Traceback (most recent call last): File "C:\Users\Miguel\Desktop\YUGIOH IA\ygo-agent\scripts\eval.py", line 104, in deck = init_ygopro(args.env_id, args.lang, args.deck, args.code_list_file) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Miguel\Desktop\YUGIOH IA\ygo-agent\scripts\ygoai\utils.py", line 44, in init_ygopro from ygoenv.ygopro import init_module ModuleNotFoundError: No module named 'ygoenv.ygopro'

Thank you for reporting this issue. Let me clarify a few points and provide some troubleshooting steps:

zedja123 commented 4 months ago

On wsl2 I'm facing a Segmentation Fault error, any thoughts on this?

zedja123 commented 4 months ago

Also did pip install -e ygoenv on ygo-agent and got this error when executing same command:

Traceback (most recent call last): File "C:\Users\Miguel\Desktop\YUGIOH IA\ygo-agent\scripts\eval.py", line 104, in deck = init_ygopro(args.env_id, args.lang, args.deck, args.code_list_file) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Miguel\Desktop\YUGIOH IA\ygo-agent\scripts\ygoai\utils.py", line 44, in init_ygopro from ygoenv.ygopro import init_module File "c:\users\miguel\desktop\yugioh ia\ygo-agent\ygoenv\ygoenv\ygopro__init__.py", line 3, in from .ygopro_ygoenv import ( ModuleNotFoundError: No module named 'ygoenv.ygopro.ygopro_ygoenv'

sbl1996 commented 4 months ago

On wsl2 I'm facing a Segmentation Fault error, any thoughts on this?

The segmentation fault error you're experiencing is due to a version mismatch with ygopro-core. I've just pushed a fix to address this. Here are the steps to resolve the issue:

  1. First, pull the latest commit from the stable branch.
  2. Then, follow these steps to rebuild the project: a. Delete the xmake cache: rm -rf ~/.xmake b. Navigate to the project directory and rebuild: xmake f -y -c && xmake b -r ygopro_ygoenv
  3. Switch to the correct ygopro-scripts version: cd ygopro-scripts && git checkout 44eff41f
  4. Navigate to ygo-agent/scripts and ensure the script directory is linked correctly.
  5. Try python -u eval.py --env-id "YGOPro-v0" --deck ../assets/deck/ --num_episodes 32 --strategy random --lang chinese --num_envs 16

If you encounter any further issues or need additional clarification, please don't hesitate to ask.

zedja123 commented 4 months ago

I'm still getting Segmentation Fault error after rebuilding and redoing building process in another folder

sbl1996 commented 4 months ago

I'm still getting Segmentation Fault error after rebuilding and redoing building process in another folder

Make sure you run python -u eval.py in the scripts directory and the scripts/script is a soft link of ygopro-scripts, and try again.

zedja123 commented 4 months ago

Did that but still, same Segmentation Fault error

sbl1996 commented 4 months ago

Did that but still, same Segmentation Fault error

It's strange. Could you please join this Discord channel (https://discord.gg/KHh4WD4B)? It would be easier for us to have a more detailed conversation to solve this problem.

zedja123 commented 4 months ago

Sure! Joining now.

sbl1996 commented 4 months ago

The issue arises due to a compatibility conflict between pybind11 v2.11 and numpy v2.0. Solved by upgrading pybind11 to 2.13 or downgrading numpy. ygo-agent uses pybind11 v2.13 as the default now.