-
Notifications
You must be signed in to change notification settings - Fork 159
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
TypeError while running DocProduct/docproduct/prediction.py #8
Comments
Can you sent a link to the colab notebook you're using? |
I'm running on my system... i have all pretrained models ... File "", line 1, in File "/home/bhuvanesh/anaconda3/envs/stark/lib/python3.6/site-packages/spyder_kernels/customize/spydercustomize.py", line 668, in runfile File "/home/bhuvanesh/anaconda3/envs/stark/lib/python3.6/site-packages/spyder_kernels/customize/spydercustomize.py", line 108, in execfile File "/home/bhuvanesh/Documents/pystuff/Medical_dr_source/DocProduct/docproduct/predictor.py", line 314, in File "/home/bhuvanesh/Documents/pystuff/Medical_dr_source/DocProduct/docproduct/predictor.py", line 273, in init File "/home/bhuvanesh/Documents/pystuff/Medical_dr_source/DocProduct/docproduct/predictor.py", line 76, in init File "/home/bhuvanesh/Documents/pystuff/Medical_dr_source/DocProduct/docproduct/models.py", line 87, in init File "/home/bhuvanesh/Documents/pystuff/Medical_dr_source/DocProduct/keras_bert/loader.py", line 72, in load_model_weights_from_checkpoint File "/home/bhuvanesh/anaconda3/envs/stark/lib/python3.6/site-packages/tensorflow/python/keras/engine/base_layer.py", line 1462, in set_weights ValueError: You called |
"i think this word emebeddings is missing can i get the link of it" It's a little tricky to diagnose the exact issue. Could you post the code you are using? |
can I use keras_bert from "https://github.com/CyberZHG/keras-bert" ? |
https://github.com/CyberZHG/keras-bert#download-pretrained-checkpoints |
Problem is all rep. on gpt estimator or keras_bert doesn't support tf 1.9 it's tf 2.0 and i'm using anaconda and they didn't update to tf 2.0 it's still 1.9. Yesterday i had to write gpt2 estimator for tf 1.9. |
Ah, interesting. I believe TF 2.0 is still in beta, so it may be a while before Anaconda is updated to 2.0. This code is in TF 2.0 because we submitted it to a TF 2.0 hackathon. |
In [48]: loader In [49]: loader('bert/embeddings/word_embeddings') In [50]: model.get_layer(name='Embedding-Token').set_weights([ File "", line 2, in File "/home/bhuvanesh/anaconda3/envs/stark/lib/python3.6/site-packages/tensorflow/python/keras/engine/base_layer.py", line 1462, in set_weights ValueError: You called |
Could you include the code you used? It's difficult to diagnose from just the error message. |
pretrained_path = "...../DocProduct/BioBertFolder/biobert_v1.0_pubmed_pmc/" here i'm getting error |
in this code https://github.com/re-search/DocProduct/blob/master/keras_bert/loader.py
|
I'm still not sure how to exactly reproduce the error from this info. Can you give a link to the colab notebook which reproduces this error? If the error you are receiving is fully reproduced, then I can figure out where the error is coming from and possibly offer a fix. |
colab link : from docproduct.predictor import RetreiveQADoc pretrained_path = 'BioBertFolder/biobert_v1.0_pubmed_pmc/' doc = RetreiveQADoc(pretrained_path=pretrained_path, |
That notebook doesn't seem to have an error in it. Did you mean to send a different notebook? |
No the thing is I cloned the git and downloaded same pre-trained models and
all are same but it doesn't run in my system... I need to do some
variations in the future but for now I'm unable to get this working... I'm
getting the error in loader.py script inside keras_bert folder I donno why
those lines to load the pretrained models which i downloaded are not
working...
…On Fri 12 Jul, 2019, 10:09 PM Santosh Gupta, ***@***.***> wrote:
Can you sent a link to the colab notebook you're using?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#8?email_source=notifications&email_token=AIUNWZOOXF64O6CCMP4MMJ3P7CXTTA5CNFSM4ICNEK2KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZ2IMAA#issuecomment-510952960>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AIUNWZME5LUNZHNVPGWQOU3P7CXTTANCNFSM4ICNEK2A>
.
|
Ah so the issue is not with the code, but with your system? You tried running the identical code both in colab and on your system, but the code works in colab, and not with your system? |
Yeahh but the error seems to have nothing to do with the system cuz i
personally checked whether individual modules work or not... I'm using
Tensorflow 1.9 which by default doesn't support eager execution but shld
enable with TF.enable_eager_execution()
…On Thu 18 Jul, 2019, 12:48 AM Santosh Gupta, ***@***.***> wrote:
Ah so the issue is not with the code, but with your system?
You tried running the identical code both in colab and on your system, but
the code works in colab, and not with your system?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#8?email_source=notifications&email_token=AIUNWZL7NG3QDUFWO54K3HDP75WBBA5CNFSM4ICNEK2KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2GJ26I#issuecomment-512531833>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AIUNWZPBXWY2VVOS2TNGY2DP75WBBANCNFSM4ICNEK2A>
.
|
I think I figured out your issue. You're using Tensorflow 1.9. We didn't develop this in Tensorflow 1.x, we did it in Tensorflow 2.0 alpha. |
Ok let me create a different environment for tf 2.0 alpha and see how it's
gonna work. If still any issues I'll contact you... thqs for your help
…On Thu 18 Jul, 2019, 12:56 AM Santosh Gupta, ***@***.***> wrote:
I think I figured out your issue. You're using Tensorflow 1.9. We didn't
develop this in Tensorflow 1.x, we did it in Tensorflow 2.0 alpha.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#8?email_source=notifications&email_token=AIUNWZNZCQOSMCOQYPGKXXTP75W6DA5CNFSM4ICNEK2KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2GKPWY#issuecomment-512534491>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AIUNWZP3PKHACRS26FJ2ZG3P75W6DANCNFSM4ICNEK2A>
.
|
File "predictor.py", line 314, in
gen = GenerateQADoc()
File "predictor.py", line 273, in init
load_pretrain=False
File "predictor.py", line 85, in init
self.predict(questions=question, answers=answer, dataset=False)
File "predictor.py", line 154, in predict
model_outputs = self.model(model_inputs)
File "/home/bhuvanesh/anaconda3/envs/stark/lib/python3.6/site-packages/tensorflow/python/keras/engine/base_layer.py", line 703, in call
outputs = self.call(inputs, *args, **kwargs)
File "/home/bhuvanesh/Documents/pystuff/Medical_dr_source/DocProduct/docproduct/models.py", line 114, in call
(inputs['q_input_ids'], inputs['q_segment_ids'], inputs['q_input_masks']))[self.layer_ind]
File "/home/bhuvanesh/anaconda3/envs/stark/lib/python3.6/site-packages/tensorflow/python/keras/engine/base_layer.py", line 703, in call
outputs = self.call(inputs, *args, **kwargs)
File "/home/bhuvanesh/Documents/pystuff/Medical_dr_source/DocProduct/docproduct/bert.py", line 169, in call
trainable=self.trainable)
File "/home/bhuvanesh/Documents/pystuff/Medical_dr_source/DocProduct/docproduct/bert.py", line 141, in _wrap_layer
build_output = build_func(input_layer)
File "/home/bhuvanesh/anaconda3/envs/stark/lib/python3.6/site-packages/tensorflow/python/keras/engine/base_layer.py", line 696, in call
self.build(input_shapes)
File "/home/bhuvanesh/Documents/pystuff/Medical_dr_source/DocProduct/keras_bert/keras_multi_head/multi_head_attention.py", line 94, in build
name='%s_Wq' % self.name,
File "/home/bhuvanesh/anaconda3/envs/stark/lib/python3.6/site-packages/tensorflow/python/keras/engine/base_layer.py", line 534, in add_weight
use_resource=use_resource)
File "/home/bhuvanesh/anaconda3/envs/stark/lib/python3.6/site-packages/tensorflow/python/training/checkpointable/base.py", line 497, in _add_variable_with_custom_getter
**kwargs_for_getter)
File "/home/bhuvanesh/anaconda3/envs/stark/lib/python3.6/site-packages/tensorflow/python/keras/engine/base_layer.py", line 1873, in make_variable
use_resource=use_resource)
File "/home/bhuvanesh/anaconda3/envs/stark/lib/python3.6/site-packages/tensorflow/python/ops/variable_scope.py", line 2234, in variable
use_resource=use_resource)
File "/home/bhuvanesh/anaconda3/envs/stark/lib/python3.6/site-packages/tensorflow/python/ops/variable_scope.py", line 2224, in
previous_getter = lambda **kwargs: default_variable_creator(None, **kwargs)
File "/home/bhuvanesh/anaconda3/envs/stark/lib/python3.6/site-packages/tensorflow/python/ops/variable_scope.py", line 2196, in default_variable_creator
constraint=constraint)
File "/home/bhuvanesh/anaconda3/envs/stark/lib/python3.6/site-packages/tensorflow/python/ops/resource_variable_ops.py", line 312, in init
constraint=constraint)
File "/home/bhuvanesh/anaconda3/envs/stark/lib/python3.6/site-packages/tensorflow/python/ops/resource_variable_ops.py", line 417, in _init_from_args
initial_value(), name="initial_value", dtype=dtype)
File "/home/bhuvanesh/anaconda3/envs/stark/lib/python3.6/site-packages/tensorflow/python/keras/engine/base_layer.py", line 1860, in
shape, dtype=dtype, partition_info=partition_info)
File "/home/bhuvanesh/anaconda3/envs/stark/lib/python3.6/site-packages/tensorflow/python/ops/init_ops.py", line 468, in call
scale /= max(1., (fan_in + fan_out) / 2.)
TypeError: unsupported operand type(s) for /: 'Dimension' and 'float'
The text was updated successfully, but these errors were encountered: