Skip to content
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

unable to load pool files #16

Open
QuickMythril opened this issue Feb 14, 2020 · 15 comments
Open

unable to load pool files #16

QuickMythril opened this issue Feb 14, 2020 · 15 comments

Comments

@QuickMythril
Copy link

when loading any .pool file i get two different errors:

  • Loading pool from C:\genetic\BizHawk-2.4\Lua\SNES\neat-mario\pool\temp.pool
  • NLua.Exceptions.LuaScriptException: [string "main"]:921: 'for' limit must be a number

or (for a file i manually saved):

  • Loading pool from C:\genetic\BizHawk-2.4\Lua\SNES\neat-mario\pool\BackupDP1.state.pool
  • NLua.Exceptions.LuaScriptException: [string "main"]:929: table index is nil
@KayWayJay
Copy link

Same problem here.

I'm wondering if the backslash ("") is causing some trouble? Because it should appear as a forward slash.

@BaconBoi95
Copy link

Try the version on my fork, I think I managed to fix it (I dunno, I had some similar problems so I made some changes)

@mudkip989
Copy link

same issue, but with bacon boi version, we need fix maybe asap

@BaconBoi95
Copy link

Hmm, I'm going to look at that when i have some time

@BaconBoi95
Copy link

found the problem, just need to solve it. its trying to load from mam91's downloads folder, which of course, isn't on your computer. just gotta tweak the search path

@mudkip989
Copy link

i have done that, i realized it was saying
"C:/Users/User/Documents/mario/BizHawk-2.4/Lua\SNES\neat-mario\pool\DP1.state.pool
Loading pool from C:/Users/User/Documents/mario/BizHawk-2.4/Lua\SNES\neat-mario\pool\DP1.state.pool
NLua.Exceptions.LuaScriptException: [string "main"]:929: table index is nil
NLua.Exceptions.LuaScriptException: [string "main"]:726: attempt to index field 'neurons' (a nil value)"
looks to be a nueron issue? it does this every time. I believe the first line is the saving. the rest is loading the save.

@mudkip989
Copy link

mudkip989 commented Apr 3, 2020

note: i dont know lua, but i might be able to find it. looking for the issue rn. For anyone looking for a fix, please be patient. it seems to be checking for a value in an array or table(dont know what it is called here) at a spot where one would not be located, hence "nil" or nonexistent. If i find it, i will post here again with fix.

note2: i dont know what im doing. i dont understand this stuff, tried using text finder, found "neuron" but too many. my brain hurts. i give up.

@mudkip989
Copy link

mudkip989 commented Apr 4, 2020

so i came back to this problem, and have narrowed it down. making smol changes and undoing them has brought me here for some reason.

for g=1,numGenomes do
local genome = newGenome()
table.insert(species.genomes, genome)
genome.fitness = file:read("*number")
genome.maxneuron = file:read("*number")
local line = file:read("*line")
while line ~= "done" do

                            genome.mutationRates[line] = file:read("*number")
                            line = file:read("*line")
                    end
                    local numGenes = file:read("*number")
                    for n=1,numGenes do

                            local gene = newGene()
                            local enabled
  						
  						local geneStr = file:read("*line")
  						local geneArr = mysplit(geneStr)
  						gene.into = tonumber(geneArr[1])
  						gene.out = tonumber(geneArr[2])
  						gene.weight = tonumber(geneArr[3])
  						gene.innovation = tonumber(geneArr[4])
  						enabled = tonumber(geneArr[5])


                            if enabled == 0 then
                                    gene.enabled = false
                            else
                                    gene.enabled = true
                            end
                            
  						table.insert(genome.genes, gene)
                    end

the first line is line 921 in the mario-neat.config. Now here is the issue i have now.

NLua.Exceptions.LuaScriptException: [string "main"]:921: 'for' limit must be a number

this only happens when i try to load a saved pool. Is there any way i can fix this?

note:don't know what github is trying to do, so i made it a quote.

@BaconBoi95
Copy link

are you able to upload this to a fork so that you I can take a closer look at it

@mudkip989
Copy link

copied the folder over into my fork as "neat-mario-from-me".I change the population, but that had no effect on the issue.

@BaconBoi95
Copy link

BaconBoi95 commented Apr 8, 2020

Made it to line 1046
just add ".\\" to the requires
"config" would become ".\\config"

@mudkip989
Copy link

didnt seem to fix the problem here. I still think it has to do with the for loop and the variable it is using.

@Tqualizer
Copy link

Reverted some of the code back to SethBling's version and I think I've fixed it! It was not loading the correct numbers from the geneStr (lines 938-944) so I replaced it with
gene.into, gene.out, gene.weight, gene.innovation, enabled = file:read("*number", "*number", "*number", "*number", "*number")
Tested it and it now loads the previously trained models as expected.

@mudkip989
Copy link

That works. Problem solved.

Reverted some of the code back to SethBling's version and I think I've fixed it! It was not loading the correct numbers from the geneStr (lines 938-944) so I replaced it with
gene.into, gene.out, gene.weight, gene.innovation, enabled = file:read("*number", "*number", "*number", "*number", "*number")
Tested it and it now loads the previously trained models as expected.

@mudkip989
Copy link

so, now there is another issue:
NLua.Exceptions.LuaException: unprotected error in call to Lua API (0) at NLua.Lua.PanicCallback(IntPtr luaState) at lua_error(lua_State* ) at NLua.ObjectTranslator.throwError(IntPtr luaState, Object e) at NLua.Lua.SetPendingException(Exception e) at NLua.LuaMethodWrapper.call(IntPtr luaState) at NLua.MetaFunctions.runFunctionDelegate(IntPtr luaState) at lua_resume(lua_State* , Int32 ) at BizHawk.Client.EmuHawk.EmuLuaLibrary.ResumeScript(LuaFile lf) at BizHawk.Client.EmuHawk.LuaConsole.<>c__DisplayClass57_1.<ResumeScripts>b__1() at BizHawk.Client.Common.LuaSandbox.Sandbox(Action callback, Action exceptionCallback)

lasted 1 week with previous fix. any help?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants