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

Error: AttributeError: 'TensorFlowComponent' object has no attribute 'tfapi' #62

Open
youngbin-song opened this issue Jan 18, 2021 · 4 comments

Comments

@youngbin-song
Copy link

youngbin-song commented Jan 18, 2021

Hi, I just started using this plugin for one of my project but I'm having difficulty in what's going wrong with my setup. I'm currently using UE 4.23 and have two separate projects for the GPU and CPU version of your plugin (same content and everything).

While the GPU version of the project seems to work fine, I encounter the error

`LogPython: Test2 input passed: {"id":"BP_Agents3","distanceToTarget":503.25839233398438,"bearingToTarget":-178.17808532714844,"distanceToNearestAgent":788.39898681640625,"bearingToNearestAgent":91.817146301269531,"agentOrientation":{"pitch":0,"yaw":0,"roll":0},"object":"BP_Agents_C'/Game/DSO_AISwarm/Maps/UEDPIE_0_TestingGround1.TestingGround1:PersistentLevel
.BP_Agents3'"}
LogPython: Error: 'TensorFlowComponent' object has no attribute 'tfapi'
LogPython: Error: Traceback (most recent call last):
LogPython: Error:   File "D:\Unreal Projects\Tensorflow_CPU\Plugins\tensorflow-ue4\Content\Scripts\TensorFlowComponent.py", line 109, in json_input
    self.json_input_blocking(args)

LogPython: Error:   File "D:\Unreal Projects\Tensorflow_CPU\Plugins\tensorflow-ue4\Content\Scripts\TensorFlowComponent.py", line 114, in json_input_blocking
    resultJson = self.tfapi.onJsonInput(json.loads(args))
LogPython: Error: AttributeError: 'TensorFlowComponent' object has no attribute 'tfapi'`

in the CPU version.

Just as a clarification, I am able to run the example projects which you've provided without any error. I'm not exactly sure what I'm doing wrong when running this project. Any point to the correct direction would be appreciated.

@getnamo
Copy link
Owner

getnamo commented Jan 20, 2021

It's possible that the current master branch doesn't contain TensorFlowComponent.py due to change to ml-remote (this change: 27637fb#diff-47bd29075f8b8019f0beec6d86beda7c9bf67aaf05053dcbe0b3bcb63968517f). If you're using the older version, try to copy the TensorFlowComponent.py script to the plugin content/scripts folder.

@youngbin-song
Copy link
Author

Thank you for the response. I got it to work but I'm not sure what I might say is correct. It turns there was something wrong with my Python code which generated the error.

@getnamo
Copy link
Owner

getnamo commented Jan 27, 2021

Interesting, if you find out what it was later, let us know here so we can have the instructions others who may do the same.

@youngbin-song
Copy link
Author

This is just my hypothesis but whenever there were errors like syntax, spacing, indexing errors, the output log in UE4 would just print that 'TensorflowComponent' object has no attribute 'tfapi'. As a fix, I just made sure that there were no errors in the python code and it worked fine for me.

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

No branches or pull requests

2 participants