-
Notifications
You must be signed in to change notification settings - Fork 1
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
Oddities with this system. #2
Comments
Hi SoftwareGuy, Let me say how much I appreciate your comments, my Instructions are lacking/ not existent.
final notes, I run this on a 32 core server with 16gb of ram, I want every ounce of speed I can get so I usually put /tmp on a ram disk so the emulator stores key presses from lua console as fast as possible, if you have an ssd this is probably not necessary, I say this because I have never had an issue with ram.(there are totally memory leaks in either my code/emulator/graphics things??? because after several days of training you computer will need to be rebooted no question) |
Thanks for the reply! Let me shoot back some replies 😄 I believe I did use your latest release. I had to do some modifications to the script though (I think). I think /tmp is mounted as tmpfs in memory, but I'm not sure about that. I think the console output needs a bit of a revamp too. While saving and loading seems to be okay, there's no output in the console that would indicate that said activity has occurred (unless you get the "child specie X genome Y was born" texts). Within safe_file and load_file I added a simple It might also be worth catching any exceptions that might occur during operation. An operation did throw in the towel once or twice and the script literally caught fire and I had to run good 'ol As for memory leaks, I'm not 100% sure but I noticed that if you have two FCEUX instances running at the same time sometimes they fight each other for frame rate and you'll get things like 1 FPS while python scripts in the background spawn and do things. I am not completely sure why there are multiple forked (?) processes. Running with one instance and 200 population seems to be fine. |
Alright, so I took a look and I was using upstream's environment, instead of yours. Whoops. What an easier way of installing the mario environment would be to just symlink your |
I adjusted the resolution to fit 12 instances of the game on my screen at once, you can adjust theses settings in nes_env.py line 51 and it should look like this when I had used gym_pull at the time it was not deprecated. A symlink is fine, I prefer gym_pull but install how ever you like. If you are running more than one instance of the game and fighting for resources than you need more resources. |
Brilliant - I changed the scale back to 1 respectively. The I noticed that when Mario dies, the "Distance" as it's called seems to increase a lot before it actually stops. Is this going to be refined? I don't think it's valid to have the distance increase a lot after Mario falls into a pit, if you know what I mean, unless the game actually keeps him moving after locking the camera where he died. If SethBling's code does it though, then i guess you're emulating his code behavior and my argument is void. You can easily replicate this behavior by getting 'walkers' that walk right constantly and then fall into a pit. If the game doesn't reset it, the distance usually increases from 100 to 300 (not sure if it's random or if it's determined by something) and then stops. Another feature request I'd like to submit is a Generation Count on the TK UI, so I can leave this running for a day and come back to check on what generation it's up to. Maybe also auto-save on generation, so that we don't suffer from data loss. At the moment it seems my species are learning how to walk, no jumpers or the ones that just keep pressing A yet. |
there is code in the emulator script that identifies when mario falls beneath the screen, but I think I broke it, yeah I know bad me... I do need a high score as well as generation counter, maybe I can get this done this weekend and get a new release out. |
Do you mind if I cloned and started submitting pull requests? I could contribute things that I find might be beneficial for people who want to kick start the AI, and also tidy up the CLI output a bit. |
That would make me so happy I’m not sure you would believe it, I started a new job and haven’t had time/ been motivated to clean up the interface. |
Alright. It'll give me something to do while I'm idle between my real life job commitments. |
Got the latest commit, and loaded my pool data into the new version. The graph was instantly updated to what the network was before I shut down the box. Started the run again and while it immediately reset at World 1-1 (probably because it had no training data?), the new run is "intelligent". This is a big improvement over Sethbling's code, because his save/load system breaks unless you use a certain version of Bizhawk. |
Hmm, okay after a generation is complete and it goes onto the next one, a window titled <tk 2> appears and shows what seems to be button press graph. However, soon after it does that, this error popped up in the console:
Looks like it's just a typo in the name? |
for some reason one parent has a mutationRate called 'connectionCostRate' and the other does not. this is something I was testing and is now disabled by default, I am not sure if the build you initially had even had this in it. I suspect that you are using a old save file where this was not implemented at all if you really want I can write some code to validate a connectionCostRate so old save files work but I would rather you just do another run... you should have been able to run many hundreds of generations at this point? I would have thought you should have reached some cap on your runs score at this point, where the entire population has reached some local maximum and no improvement happens at that point, is that not the case? have you tried any of the openai enviroments in main.py? |
I was using a old pool data file from the version that I had modded before your latest commits. That's probably why it was erroring. I am currently running a "fresh batch". As there's no generation counter I have no idea how many where made. I didn't continuously have this running either all the time - sometimes I'd need to reboot the machine it was running on, so I'd save, reboot, and then rerun the python script. I'll keep an eye on and see if this new batch throws the towel when it tries to make a new generation. |
I also need a graph of the score, average score per percentile.. I've been lazy :( |
Ah, I think mine was close to 100. I got to a stage that they wouldn't progress on 5-3, the Marios would just bonk themselves under a platform and die. Still wondering why the game is resetting all the time on World 1-1... I might look into the environment file, because I do want it to try the first level - at the moment it really seems fixated in World X-3 where X is usually either 3, 5 or 6. Would be really nice if we could implement a "linear" mode, where we specify the levels to learn in order. So the AI has to work out how to beat 1-1 before going onto 1-2 and so on. This was also a problem on SethBlings because it would time out before the next level loaded. I don't know if there's any RAM addresses in the emulator that we could watch that are non-zero when a level is completed, though. Probably is, I'd need to look at the disassembly or learn some NES-fu with a memory monitor in an emulator. |
Although some levels are possibly going to be impossible to beat as I've seen upstream comments say - some of the castles would have to be omitted because it would get stuck at the puzzles that reset part of the level if you do it wrong. |
I have your build set to play some specifics! crap I didnt meant to do that! |
would like me to instruct you how to select levels or would like a release that plays all 32 levels (is slower)? |
Probably the former, if that's alright with you? |
a note on playing linearly, you can not play this way, a better method is to play all levels on one run and take an average score of this. playing linearly means that NNs can have greedy strategies that only do well on the initial level. In short the most optimal way to rate a NN would be to place mario in every possible situation of the game, this would be the most accurate possible score but would take an unreasonable amount of time to progress. In the future I would like to be able to select what levels are being played from the gui, since no one else was using this code to my knowledge I didn't really have a good reason to implement this over editing the JobTrainer function on line 108, where range(32) is all levels and for example [0,5,10,16] would play levels 1,6,11 and 17. also a new a release has been posted. |
Got the latest release. Noticed that some of the children that "do nothing" and stay put now score 256 instead of just 40? I also left it running overnight and no errors occurred when generations were completed, and a new one was spawned. It is definitely slower for each run, but the odd child will adventure into the unknown and usually get some good score before getting goomba'd. If I can migrate this setup to a low-power system (ARM? Atom Quad-core?) I might set up a stream showcasing this AI system. However, one question - I'm using Ubuntu MATE and I'm not sure what you use for your linux (looks Ubuntu), but do you know any way to make the windows not overlap each other? Right now I have to manually drag the FCEUX windows away from each other, because they'll spawn one, then a second later, the second one spawns on top of the other. |
I do know a way! but im a bit surprised that this doesnt all ready work for you..
|
Compiz apparently doesn't like my nVidia GPU. It makes the screen super blurry and that makes my eyes hurt. Apparently I cannot load anymore - I saved the run data as "pooldata2.pool" and click "Start Run" with the default 2 jobs and 300 population. Nothing happens. Waited a while. Still nothing. No FCEUX instances, but I do get the plot in the window appear when loaded. However, I do get the "[file] loaded..." text that appears when the file loads. It seems to also spawn the children correctly. |
no you shouldnt have any issues with your save file |
what gpu are you using? |
GPU is a nVidia GeForce GTX 750 Ti. I just pulled the latest commit to my machine, ran |
I tested an old save file and had no issues, does it run when not using a save file? |
Turns out that Ubuntu must have fucked around with something. I rebooted the machine and booted up MoreIO and everything started correctly this time around. As a bonus, the first species wandered right, got up to the first item box on World 1-1 and stopped. |
I hope you are enjoying the program :) |
Hmm, okay so on my test box I got a error after letting it run for about 3 or 4 days straight that said "MemoryError". Seems to be that the AI's memory grew to the extent that my 32-bit ARM development board couldn't address more virtual memory (does that even make sense?) even though I had about 600MB free. FCEUX instances were "frozen" due to the script probably breaking the pipe that feeds them instructions. I'll look into implementing a auto-save feature, like what SethBling's code originally did. Each generation it saves the pool as "autosave_genX.pool" so that if something like this occurs, it's easier to recover than lose 4 days of AI training.... last save I did was on the 18th January... |
Greetings,
I thought I'd provide some information on how it's going so far after I had to piece together a lot of stuff from various upstream issue tickets and whatnot to even get the thing running.
I will keep adding my findings in this thread as I evaluate it, however for a linux-powered variant of a learning AI, you're doing great work. Keep it up.
The text was updated successfully, but these errors were encountered: