Closed getnamo closed 6 years ago
threads possible with https://github.com/getnamo/UnrealEnginePython#threading-experimental and _thread but its currently breaks our encapsulation loading.
They also only are able to run tensorflow once, the graph seems to get corrupted or nil referenced otherwise.
Performance however is excellent and shows great promise of being able to train networks while in play.
Log wrapping possible using e.g.
class Logwrapper(object):
def __init__(self):
self.terminal = sys.stdout
def write(self, message):
ue.log(message)
def flush(self):
ue.log("")
and
sys.stdout = Logwrapper()
sys.stderr = Logwrapper()
pip install from python on background thread appears to be working, need to add pip dependency json file to plugins and auto-resolve on editor start, or add a command/button to resolve dependencies
pip auto dependency resolution works. Plugins now simply call e.g.
FUnrealEnginePythonModule::Get().AddPythonDependentPlugin("TensorFlow");
In their StartupModule() to both add their Content/Scripts to the python system path and auto resolves the upymodule.json found in that folder
Tensorflow example upymodule.json:
{
"name" : "tensorflow-ue4",
"pythonModules": {
"tensorflow": "0.12.1"
}
}
callback api works now with
ue.run_on_gt(function, <optional>args)
which schedules a callback to come back on the game thread. Also added convenience threading functions through upythread.py
import upythread as ut
ut.run_on_bt(function, <optional>callback)
which wraps threading->thread into a one function fire and forget.
with TF 1.0.0 release, it is time to link up the API to the blueprint layer (basic for now, later: fine control BP).
TensorFlowComponent is now fully encapsulated with very basic API:
Variables: -TensorFlowModule (name of your python script module with train and runJsonInput) -Multithreaded Training toggle -Verbose log toggle -Train on begin play toggle
Functions: -Train -TensorInput
Callback Events: -OnTraining Complete -OnResults
Test another TF model with this setup and push first release.
Critically we will need a way to save/load the model before non-proof of concept scripts should be tested.
drag and drop isn't working as expected yet, a bit more work required.
https://github.com/getnamo/tensorflow-ue4/releases/tag/0.1.2-pre seems to be a working drag and drop release, cleanup first mnist example and release them as a package along with early documentation
Two more issues should be fixed before closing this issue: -https://github.com/getnamo/tensorflow-ue4-examples/issues/7 -https://github.com/getnamo/tensorflow-ue4-examples/issues/8
Need to wrap up documentation. TF basics -> beginner mnist in a video.
Released. Videos will come when qlearning example is ready.
Todo:
Current focus: cleanup and fixes