Giter VIP home page Giter VIP logo

Comments (9)

KodairaTomonori avatar KodairaTomonori commented on August 25, 2024 5

'30k-clean.model' is 'spm_model_file', not 'vocab_file'.
The code changes are:

diff --git a/albert/run_classifier_with_tfhub.py b/albert/run_classifier_with_tfhub.py
index 92fef74..26f4339 100644                                                         
--- a/albert/run_classifier_with_tfhub.py                                             
+++ b/albert/run_classifier_with_tfhub.py                                             
@@ -156,6 +156,7 @@ def create_tokenizer_from_hub_module(albert_hub_module_handle):   
     with tf.Session() as sess:                                                       
       vocab_file, do_lower_case = sess.run([tokenization_info["vocab_file"],         
                                             tokenization_info["do_lower_case"]])     
+    FLAGS.spm_model_file = vocab_file                                                
   return tokenization.FullTokenizer(                                                 
       vocab_file=vocab_file, do_lower_case=do_lower_case,                            
       spm_model_file=FLAGS.spm_model_file)                                           

from albert.

eaplatanios avatar eaplatanios commented on August 25, 2024 1

I'm not sure what the python script is doing but the vocabulary is not simply a text file. It's a SentencePiece model file (which is basically a protobuf-serialized file) and must be deserialized using either protobuf directly or the SentencePiece python API.

from albert.

mnsrmov avatar mnsrmov commented on August 25, 2024 1

Upgrade your tensorflow to at least 1.15.

from albert.

LysandreJik avatar LysandreJik commented on August 25, 2024

I am getting the same errors on all the available TF hub models.

from albert.

PavelKovalets avatar PavelKovalets commented on August 25, 2024

Seems like this happens because of '\n' lines in vocab file, similar case described here. But it is not clear how to handle this, maybe the files are corrupted?

from albert.

YujiOshima avatar YujiOshima commented on August 25, 2024

Thanks @eaplatanios @KodairaTomonori .
I have resolved Index out of Range error but I got another error like below.

LookupError: No gradient defined for operation 'module_apply_tokens/bert/encoder/transformer/group_0_23/layer_23/inner_group_0/LayerNorm_1/batchnorm/add_1' (op type: AddV2)

Do you have any ideas? Thanks!

from albert.

chiragsanghvi10 avatar chiragsanghvi10 commented on August 25, 2024

Thanks @eaplatanios @KodairaTomonori .
I have resolved Index out of Range error but I got another error like below.

LookupError: No gradient defined for operation 'module_apply_tokens/bert/encoder/transformer/group_0_23/layer_23/inner_group_0/LayerNorm_1/batchnorm/add_1' (op type: AddV2)

Do you have any ideas? Thanks!

@YujiOshima Hi, I am still facing the same issue, can you help me with how did you resolve the issue?

from albert.

mnsrmov avatar mnsrmov commented on August 25, 2024

Thanks @eaplatanios @KodairaTomonori .
I have resolved Index out of Range error but I got another error like below.

LookupError: No gradient defined for operation 'module_apply_tokens/bert/encoder/transformer/group_0_23/layer_23/inner_group_0/LayerNorm_1/batchnorm/add_1' (op type: AddV2)

Do you have any ideas? Thanks!

@YujiOshima Hi, I am still facing the same issue, can you help me with how did you resolve the issue?

For version one, if you use the latest tensorflow 1 it'll fix both problems. However, I have not found a sensible solution for version 2 yet.

from albert.

0x0539 avatar 0x0539 commented on August 25, 2024

We have fixed the issue with the v2 ALBERT modules on TF-Hub
We also updated the README.md with some details about --spm_model_file
Please let us know if you have other issues!

from albert.

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.