Hi,
i have AI surrogate model (to predict data from pre train AI model) inside dynamo script. he script run good inside dynamo. but if i run the script from genrative design tools it not run.
genrative design run with out stop
eq.dyn (18.6 KB)
AI surrogate model
1 Like
Try running just one solution that you know works, like the example you’ve shown. This will tell us whether you’re just having issues with invalid results or the code is not running at all in the GD environment. If it’s an issue with the code, then you’ll want to check to make sure python isn’t referencing anything that may not be available to GD.
1 Like
thank you @Nick_Boyts
i test and it’s not run
here is the python code i use only tensorflow and keras.
python cod used only for predict data from AI model
My goal is using GD as a optimiser and i used AI model to get a data for optimisation faster instead i use FEM solver.
# force to reload module
if "tensorflow" in sys.modules:
del sys.modules["tensorflow"]
import numpy as np
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
from tensorflow.python.client import device_lib
from tensorflow.keras.models import load_model
model=load_model(IN[0])
x = np.array([[pt[0], pt[1]] for pt in IN[1]], dtype=np.float32)
arr=np.array(model.predict(x), dtype=np.float32)
List=arr.tolist()
# convert bool to integer
OUT = model.predict(x).tolist()
I’m afraid my knowledge here is limited, but it might be that numpy
and/or tensorflow
are not available to the GD environment.
1 Like
That’s not to say that you can’t load those libraries, I don’t know, but it may just be a different process in order to retain access to them.
1 Like
You have tried it in jupyter notebook outside Dynamo environment yet ?
1 Like
Hi @chuongmep
i will test it in jupter. and give you a feedback but It work perfect at dynamo. the problem when i run it by GD.
I test in jupter and it work good.
Still i can not call pre trained AI model when i use GD
Does the AI model make use of multiple threads when run in Dynamo? If so Generative Design will fail to work with it as it needs all work to happen on a single thread at this time.
FYI @LilliSmith
2 Likes
You mean a global optimizer processing or custom keras optimizer like adam, rmsprop, etc… ?
Run it in the Dynamo sandbox context and see how much of your processor is utilized. Should cap a bit over 1/(number of threads on your system)
, if it’s more then that, you’ve got multi threading in play.
FWIW most AI systems I know of utilize multiple cores concurrently.
1 Like