New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error encountered during player.ladder() #306
Comments
Hey @akashsara, Thanks for opening this issue. If you want to test a trained model on the ladder, I would recommend not inheriting from the gym player, but from the base player class. |
Do you mean Edit: Looking at the code for the player above, this would mean that I would need to inherit from the base player class and reimplement an |
Hey @akashsara, |
Thank you, I'll try that! |
So it seems like there's a number of significant changes with the new version. I'm following I'm asking since due to some circumstances I'm running my code elsewhere and that machine has some issues haha. So I'd prefer being able to just install the latest version and run my code vs setting up some hacky bits in the meantime. |
Hey @MatteoH2O1999,
If I set
If I set it to False the script just finishes running almost instantly. I'm monitoring the account on Showdown and it doesn't start any battles or anything.
|
Hi @akashsara, Regarding your first question, the problem is you are not actually using the environment. To use it you should have something like
if you wish to implement |
Ah I see. Apologies for the misunderstanding. Thank you for clarifying. It's working now! I should note that there is something a little weird still going on. I get this error everytime I run it, even though battles do seem to be starting and the agent I have seems to be playing: On the challenges part - are there any plans to implement it/something similar on EnvPlayer for the time being? Or is it not on the roadmap? I'll take a crack it either way, but just wanted to know. |
As a temporary workaround use |
Regarding the challenges part the famous "it's a feature not a bug" applies because accept challenges and send challenges should have the same effect: once you await them, the battle completes. This is impossible to implement by default as it would mean linking poke-env to a specific ML library |
@akashsara yeah I need to push a new release - i will take care of it this week. from poke_env.player.baselines import class RandomPlayer(Player)
class TrainedModelPlayer(RandomPlayer):
def choose_move(self, battle):
state = embed_battle(battle)
with torch.no_grad():
predictions = model(state)
action_mask = SimpleRLPlayer.action_masks()
action = np.argmax(predictions + action_mask)
return SimpleRLPlayer._action_to_move(action, battle) where |
@MatteoH2O1999 Thanks! Does this mean there are no plans to have a method to battle against the bot in a custom battle at all? (Apart from the method Haris mentioned above) @hsahovic Got it, thank you. That should work for me. |
@akashsara,
|
Ooh that works out for me. Thanks a lot @MatteoH2O1999 |
So as an update for anyone running into this thread later on, for speed reasons I would recommend using the general API like Haris mentioned. The approach Matteo suggested works pretty well for self-play but in terms of pure speed, the general API is much, much, much faster. From my own rough benchmarking, the general API works out to be 3-4 times as fast. @hsahovic maybe we could include this somewhere in the documentation? I expected it to be faster but not this fast. |
Hi,
I was testing a model I trained on Pokemon Showdown (code snippet below) when I ran into this issue. I'm able to challenge the bot to a battle and play against it perfectly well but when I do
player.ladder(100)
it errors out after completing a single battle.Model code:
Script:
The text was updated successfully, but these errors were encountered: