-
Notifications
You must be signed in to change notification settings - Fork 41
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
How to use SendRawInputGraphCallback ? #5
Comments
Thanks for the support and for helping ironing out the bugs in this early ml-remote prototype :) FLatentAction is really about receiving data in blueprint graphs, it resumes a blueprint latent function.
I quickly looked at the current plugin API and it seems to be blueprint biased in this early prototype. I went ahead and added native lambda callback variants via overloading the Basically just add an appropriate lambda as the second parameter and it will use the lamba variant e.g. //Let's say you want to send some raw data
TArray<float> InputData;
//... fill
MLComponent->SendRawInput(InputData, [this](TArray<float>& ResultData)
{
//Now we got our results back, do something with them here
}, TEXT("on_float_array_input")); That said you can also use the |
My man this is incredible! I am currently on baby duty but will pull latest
and try out in a few hours.
Thanks so much! I wish I could send you a Xmas present or something!
…On Wed, Apr 15, 2020 at 2:33 AM Jan Kaniewski ***@***.***> wrote:
FLatentAction is really about receiving data in blueprint graphs, it
resumes a blueprint latent function.
<https://camo.githubusercontent.com/72754dd079dd531338d85c9e36e0e83d9369be3d/68747470733a2f2f692e696d6775722e636f6d2f576a6d464c41752e706e67>
*e.g. this graph callback function, notice you draw off the result as if
it was a normal function, but this will be called in a latent manner and
can only exist in event graphs.*
I quickly looked at the current API and it seems to be blueprint biased in
this early prototype. I went ahead and added native lambda callback
variants via overloading the SendRawInput/SendStringInput. Pull latest
master to get the changes and check out
https://github.com/getnamo/machine-learning-remote-ue4/blob/master/README.md#c-api
for instructions on using lambda callback variants.
That said you can also use the SendRawInput and bind to the
OnRawInputResult multicast delegate.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#5 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEVVN5YGZHMQETM4MMCK6ILRMVIK3ANCNFSM4MH3VUPQ>
.
|
Okay, this is great. I hate to pester but I am still having one issue which is that I can't seem to get the lambda callbacks to get called? Taking an example from the updated readme I am trying to test out just sending a string and printing returned string. In UE4 project
And then in hello.py (the script that RemoteMLComponent successfully runs) I have
When I play this the server's console prints out "got some data". The log at localhost:8080 prints "The Sent Data". However, the UE_LOG only shows the first warning "UE_LOG WORKS", it does not log anything like "SendStringInput Callback Was Called" or "sending some string-like stuff back" Do I need to explicitly call the callback function from the python side? Thanks again |
Pull latest on https://github.com/getnamo/ml-remote-server as well, I believe I updated custom functions to work the same way as native on_json_input and on_float_array_input (commit: getnamo/ml-remote-server@36d6267). Let me know if that fixes it |
Hey thanks, Unfortunately I was already on latest commit: getnamo/ml-remote-server@36d6267, but the problem persists. Also, if I don't use a custom function, and instead use on_float_array_input I get the same behavior (server receives the input floats and prints them out but the callback doesn't get called) So I changed line 68 in server.py to
and
but now running into some other complaints that looks related to this
Edited to add some more context For context, here's the code in ue4
Here's the functions in hello.py
Here's what the server prints
|
Ok I'll have a look to see if I can't replicate this bug in C++ later today, thanks for the detailed info. |
Haven't had the time to replicate yet, but can you confirm the blueprint version of callback is working for you first (in e.g. a blueprint not a c++ file)? It would help narrow down if it's the current state of both parts or just the new c++ lambdas giving problems |
Yeah will definitely try the blueprint version. Sorry it might take me a
minute I'm still new to ue4.
…On Thu, Apr 16, 2020 at 7:39 PM Jan Kaniewski ***@***.***> wrote:
Haven't had the time to replicate yet, but can you confirm the blueprint
variant is working for you first?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#5 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEVVN5Z6DKCLWR5WJGQ7DKLRM6JLRANCNFSM4MH3VUPQ>
.
|
Okay so I tried the blueprint version with the latest release. Here's how my blueprint script looks The machine learning remote component is setup to run hello.py, which I modified to print "the blueprint version is running" on setup. Here's the server output connect 45a76c9b1c264f0cb1391c37d51ccc90 here's a snippet of hello.py
So it appears either I'm doing something incorrectly or in the current blueprint version it's not calling the on_float_array_input function. Thanks! Edited: whoops When I try to call a different custom function like on_test_string I get the following. First here's the blueprint
Okay so it looks like the same behavior as c++ to me. The function on_test_string is getting called but the returned value isn't getting printed in the log. Nothing is getting printed to the unreal engine log, the localhost:8080 or the game screen. |
That's strange behavior, I'll try to find some time to run an example both in BP and C++ to confirm. I did have the BP variant working in my tests a few days ago, so I wonder what could be the difference in setup. |
Okay thanks. Like I said I’m new to ue4 so there could be something obvious
I’m missing.
Also in case it’s relevant: I’m on Windows 10, VS2017, ue4.24.3
I opened up a blank third person shooter template, adjusted the build.cs
file, added the plugins folder, attached a machine learning remote
component to the character and that’s it.
…On Mon, Apr 20, 2020 at 1:28 AM Jan Kaniewski ***@***.***> wrote:
That's strange behavior, I'll try to find some time to run an example both
in BP and C++ to confirm. I did have the BP variant working in my tests a
few days ago, so I wonder what could be the difference in setup.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#5 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEVVN52ITZBRXUDZZ6STSMTRNPMQ3ANCNFSM4MH3VUPQ>
.
|
More updates. Sorry to spam. I got SendSIOJsonInput to work in blueprints with the result data successfully printed to game screen I had to change line 57 of server.py to if It looks like it's only the custom functions, send float array, and send string that are broken. Since the JSON is working I will probably use this to communicate state and actions back and forth. Thanks! |
Good afternoon, thanks again for your work here and I just bought the socketio client from the marketplace for a little support.
I've managed to get this almost fully working for what I'm trying to do, just a little unclear on how to use the function SendRawInputGraphCallback in MachineLearningRemoteComponent.h.
For context, what I'm trying to do is send an array of floats (state and reward) to the server (for a q learning agent to process) and then receive an array of floats (actions) in order to try some reinforcement learning.
I'm able to send floats to the server
My server receives these floats every tick, and can e.g. write them to log.
This all works successfully. Receiving a response from the server though has me confused. I can try
I would like to get to the point where the on screen debug message prints e.g.
9.0
I literally can't find any documentation on what sort of struct FLatentActionInfo should be -- google just sends me back to your repos.
Again, thanks so much in advance!
The text was updated successfully, but these errors were encountered: