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

_linear() got an unexpected keyword argument 'bias_start' #93

Open
st474ddr opened this issue Jun 12, 2018 · 8 comments
Open

_linear() got an unexpected keyword argument 'bias_start' #93

st474ddr opened this issue Jun 12, 2018 · 8 comments

Comments

@st474ddr
Copy link

Excuse me,
I got a TypeError:_linear() got an unexpected keyword argument 'bias_start'
please help me ~

@WangJiuniu
Copy link

WangJiuniu commented Jul 17, 2018

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!

@aneesh-joshi
Copy link

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

@Vimos
Copy link

Vimos commented Jul 28, 2018

@aneesh-joshi , maybe you can give my branch Tf1.8 a try, I was able to run it last month.

@aneesh-joshi
Copy link

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?

@Vimos
Copy link

Vimos commented Jul 29, 2018

@aneesh-joshi , try the tf1.8 branch, not the master branch.

@aneesh-joshi
Copy link

@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.

@Vimos
Copy link

Vimos commented Jul 30, 2018

@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.

@JaneShenYY
Copy link

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.

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

No branches or pull requests

5 participants