What exactly am I supposed to upload?

When I try to upload an algo I get the: Your algo failed to upload. Please upload the correct Zipped Asset. Click outside of this message to dismiss, so I was curious, what exactly am I supposed to upload? python-algo zipped or it’s contents zipped? So far I have tried both but get the same error.

Python-algo should be the correct folder. Did you happen to delete some of the contents? It needs the run.sh file.

nope there is a run.ps1 and a run.sh file, is there a file size limit? I am just now realizing that I am hitting almost half a gig maybe that’s the issue and it just doesn’t specify the error? also I know that it’s the correct folder I was just asking if I zip it in a way that you see the run.sh file when you first open the zip or you see the folder when you first open the zip?

Yep, that’s it. I hit issues uploading at 35 mB, I’m sure 500 is bound to break it.

Oh wow thanks. That means I cant use tensorflow because it’s a 400mb package on its own

You can, actually! Well, sort of. I explained in this post about my machine learning attempt how to get a Keras neural net with a Tensorflow backend up and running on the live servers (it adds quite a few mB to your algo, but even with all my other code I can stay below 30 mB).

I’m guessing you’ll run into 1 of two scenarios with this:

a) You’re trying to have your algo learn from match to match and improve over time. This is more or less unsupported, as you won’t be able to change the state of your algo between matches. AFAIK your algo as you originally submitted it gets played each match, so any changes you write in a match don’t get saved.

b) You have a trained neural net that you just want to forward propagate on. This is much more feasible, and can be accomplished with the methods in the link I provided.

We’re hoping that dependencies for Python algos get added eventually, but that might be a while. You may notice that there’s a workaround to get a) working, but I’m guessing that workaround will be removed more or less when dependencies are added. The workaround would also probably take just as long to get working as the method in the first link, but has the downside of being less “sustainable.”

Yes, I just need it to feed forward and I’ve actually looked into all the topics you’ve linked the problem is that repo is for an old keras version and python 2 I’ll probably have to work on porting it

If you’re interested in some fun work :), you can write your own feed-forward implementation after exporting the weights from the tensorflow model. This is exactly what I did when I was doing my ML work. It is possible to export the weights in JSON format and you can then load them, and run the forward pass yourself.

Whether you want to tackle this is up to you, but it essentially just becomes vector-matrix multiplication and you’re done. The real challenge becomes speed (depending on your network size, mine were quite large) and so I wrote that part in C++. If you’d like to know more about it I’d be happy to go into more detail.

1 Like

@Isaac’s method is probably the best, although I distinctly remember spending very little time updating the library compared to plugging it back into Python. The only Keras version issue I’m aware of is the line 30 issue I gave a direct fix for in the original post. A more fringe issue is replacing all the cout’s with cerr’s, because using cout will disrupt the game engine and crash your algo with completely unrelated error messages.

If I get the time this weekend I’ll probably go ahead and fork the repo and publish an updated version.

1 Like

@Isaac yes, it wouldn’t be difficult for me to just write my own feed forward network, especially considering that the one I made is just a basic fully connected network but anything I can make wont be nearly as fast as tensorflow is

@Ryan_Draves I’m fairly certain it wouldn’t be much work I was just trying to get tensorflow working I’ll probably end up porting that library when I get home

Thanks to both of you for your help!

@Ryan_Draves there was the line 30 fix but also just add tensorflow.keras to the import and adding parentheses to the print statements and it worked flawlessly, Thank you!

EDIT: I am a bit confused how exactly did you return your outputs from the function? c++ won’t return an array, only a pointer

I had quite a bit of difficulty with that. Not sure if I could even point out a resource; it was one of those where you’re ten tabs deep into StackOverflow trying various solutions.

I do now that you can return an array. Arrays are just fancy pointers*, anyways, so returning pointers is exactly how you return an array.

I’ll probably include the interfacing in the repo fork if/when I make it.

*yeah yeah yeah I’m sure I’m wrong