Coder Social home page Coder Social logo

ValueError: Variable chars/_char_embeddings already exists, disallowed. Did you mean to set reuse=True in VarScope? Originally defined at ner_model about sequence_tagging HOT 4 CLOSED

guillaumegenthial avatar guillaumegenthial commented on July 17, 2024
ValueError: Variable chars/_char_embeddings already exists, disallowed. Did you mean to set reuse=True in VarScope? Originally defined at ner_model

from sequence_tagging.

Comments (4)

AutometricsInfi avatar AutometricsInfi commented on July 17, 2024

This issue is coming when we try to load second model with different word,char,tag files when first model is already loaded.

Also getting below error
File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1562, in restore
{self.saver_def.filename_tensor_name: save_path})
File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 907, in run
run_metadata_ptr)
File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1144, in _run
feed_dict_tensor, options, run_metadata)
File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1372, in _do_run
options, run_metadata)
File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1391, in _do_call
raise type(e)(node_def, op, message)

tensorflow.python.framework.errors_impl.InvalidArgumentError: Assign requires shapes of both tensors to match. lhs shape= [1839,300] rhs shape= [1633,300]
[[Node: save/Assign_38 = Assign[T=DT_FLOAT, _class=["loc:@words/_word_embeddings"], use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/cpu:0"](words/_word_embeddings, save/RestoreV2_38)]]

when trying to load multiple models. Even save_path for different models are correct and used different config files to load words,chars, tags files. But any model which is getting loaded considering words,tags,chars generated from last training session build_data.py script because of which above error is thrown from tensorflow.

Need help to understand this behavior and solution for the same.

from sequence_tagging.

YogeshSakpal avatar YogeshSakpal commented on July 17, 2024

I am also facing the same issue. Could you please guide on below?

ValueError: Variable words/_word_embeddings already exists, disallowed. Did you mean to set reuse=True or reuse=tf.AUTO_REUSE in VarScope? Originally defined at:

File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py", line 1717, in init
self._traceback = tf_stack.extract_stack()
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py", line 3155, in create_op
op_def=op_def)
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\util\deprecation.py", line 454, in new_func
return func(*args, **kwargs)

from sequence_tagging.

guillaumegenthial avatar guillaumegenthial commented on July 17, 2024

If you change the size of your vocab etc. the shapes of your tensor change, and thus when you reload, you have shape mismatch!

from sequence_tagging.

adamchuai avatar adamchuai commented on July 17, 2024

If you change the size of your vocab etc. the shapes of your tensor change, and thus when you reload, you have shape mismatch!

Excuse me, but could you please explain more specifically about changing the size of vocab etc? And how does it cause the error? I am also facing the same problem, but I dont think I have changed anything. Thank you so much!

from sequence_tagging.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.