patrickloeber / snake-ai-pytorch

MIT License
600 stars 389 forks source link

Model isn't loaded from file #8

Open JS-E opened 2 years ago

JS-E commented 2 years ago

Love what you've done with the python snake stuff, but i've noticed if you run the ai again, it doesn't use what it's already learnt and start from there again. Is there an easy way to get this implemented? I'm not great at python but i'd be happy to give it a go if i'm pointed in the right direction?

joeyadelman commented 2 years ago

I had this same question, just commenting to see if an answer is ever provided

Vansh404 commented 2 years ago

You can save what the AI has learned in a folder somewhere and reuse that contents when train() begins again.

flaviolsousa commented 1 year ago

I made a code entirely based on this repository. It includes this functionality. Maybe it helps: https://github.com/flaviolsousa/ping-pong-ia/blob/main/classes/model/model.py

Dev-Mehta commented 1 year ago

I made a code entirely based on this repository. It includes this functionality. Maybe it helps: https://github.com/flaviolsousa/ping-pong-ia/blob/main/classes/model/model.py

I tried by loading state dict but still it performs poorly (starts learning from scratch everytime its ran)

Zrsion commented 1 year ago

I made a code entirely based on this repository. It includes this functionality. Maybe it helps: https://github.com/flaviolsousa/ping-pong-ia/blob/main/classes/model/model.py

I tried by loading state dict but still it performs poorly (starts learning from scratch everytime its ran)

you can delete "if random.randint(0, 200) < self.epsilon" in agent.py.