-
Notifications
You must be signed in to change notification settings - Fork 11
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
DenseNeuralNetwork #86
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The best would be to use this .keras
file (can be updated later on when everything is converged) rather than the config.json
, model.weights.h5
and metadata.json
. Is it possible to make a function that reads a .keras
file in dnn.py
and return a DNN object.
Did you check your code ?
|
Yes, I did it was working perfectly there.....
…On Thu, 4 Jul, 2024, 18:17 Jerome Kieffer, ***@***.***> wrote:
Did you check your code ?
In [9]: import freesas.resources
In [10]: freesas.resources.resource_filename("keras_models/Rg+Dmax.keras")
Out[10]: '/home/kieffer/.venv/py311/lib/python3.11/site-packages/freesas/resources/keras_models/Rg+Dmax.keras'
In [11]: k=freesas.resources.resource_filename("keras_models/Rg+Dmax.keras")
In [12]: freesas.dnn.KerasDNN(k)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[12], line 1
----> 1 freesas.dnn.KerasDNN(k)
File ~/.venv/py311/lib/python3.11/site-packages/freesas/dnn.py:154, in KerasDNN.__init__(self, keras_file)
153 def __init__(self, keras_file):
--> 154 config, weights = parse_keras_file(keras_file)
155 self.dnn = DNN(*[DenseLayer(weights[2*i], weights[2*i+1], a) for i,a in enumerate(config[1])])
File ~/.venv/py311/lib/python3.11/site-packages/freesas/dnn.py:146, in parse_keras_file(keras_file)
144 with zipfile.ZipFile(keras_file, 'r') as z:
145 with z.open('config.json') as config_file:
--> 146 config = parse_config(config_file)
147 with z.open('model.weights.h5') as weights_file:
148 weights = load_weights(weights_file, config[0])
File ~/.venv/py311/lib/python3.11/site-packages/freesas/dnn.py:31, in parse_config(config_path)
30 def parse_config(config_path):
---> 31 with open(config_path, 'r') as f:
32 config = json.load(f)
34 layer_dims = []
TypeError: expected str, bytes or os.PathLike object, not ZipExtFile
—
Reply to this email directly, view it on GitHub
<#86 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/BHAURYIOYSXCKMISTHDAYJDZKVYQBAVCNFSM6AAAAABKB5SXSSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMBZGMYDEMJRGU>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
It should almost be OK for the json part. I will have a look. For the hdf5 side, I foresee some issues, one should probably go via |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
to predict Rg and Dmax