bi-att-flow
bi-att-flow copied to clipboard
_linear() got an unexpected keyword argument 'bias_start'
Excuse me, I got a TypeError:_linear() got an unexpected keyword argument 'bias_start' please help me ~
I meet the same problem when I try to use tensorflow==1.3.0. The problem is saved when I change it to the version guided. Good luck!
Unfortunately, this repo only supports tf 0.11 which had another definition of _linear. It's location and definition has since changed. I tried a lot to port it to 1.3 but to no avail. Did you find any solution? @st474ddr @WangJiuniu
@aneesh-joshi , maybe you can give my branch Tf1.8 a try, I was able to run it last month.
Hey @Vimos Thanks for replying. I ran your repo. However, I get the following error:
Traceback (most recent call last):
File "/home/aneeshyjoshi/miniconda3/envs/gensim_env/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/home/aneeshyjoshi/miniconda3/envs/gensim_env/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/aneeshyjoshi/bi-att-flow/basic/cli.py", line 5, in <module>
from basic.main import main as m
File "/home/aneeshyjoshi/bi-att-flow/basic/main.py", line 14, in <module>
from basic.model import get_multi_gpu_models
File "/home/aneeshyjoshi/bi-att-flow/basic/model.py", line 10, in <module>
from my.tensorflow.nn import softsel, get_logits, highway_network, multi_conv1d
File "/home/aneeshyjoshi/bi-att-flow/my/tensorflow/nn.py", line 1, in <module>
from tensorflow.python.ops.rnn_cell import _linear
ImportError: cannot import name '_linear'
It's the same problem I faced while porting. I couldn't find any replacement for the _linear
function. Even the old copied definition of _linear
doesn't seem to solve it.
But you were able to run it. Am I missing something?
@aneesh-joshi , try the tf1.8 branch, not the master branch.
@Vimos Thanks a lot! (Like you said, I forgot to change branches) It's working.
Maybe you could make a PR to the original repo. It will be useful for everybody. Also, did you make any ChangeLog with the changes (any functionality you had to give up on for the newer version). I am reading the diff, but a shorted log would be easier.
@aneesh-joshi Glad that it's helping!
The official repo has a dev
branch which contains modifications to be compatible with >Tf1.0
. Although I pulled their code, there are still some conflicts among different versions of TF. Since the repo is not actively maintained, I am not quite sure which branch to make the PR.
In nn.py:
replace
from tensorflow.python.ops.rnn_cell_impl import _linear
with
from tensorflow.contrib.rnn.python.ops.core_rnn_cell import _linear
replace
flat_out = _linear(flat_args, output_size, bias, bias_start=bias_start, scope=scope
with
with tf.variable_scope(scope or 'Linear'): flat_out = _linear(flat_args, output_size, bias, bias_initializer=tf.constant_initializer(bias_start))
You can refer to the code to read the _linear() function.