Skip to content
This repository has been archived by the owner on Feb 17, 2024. It is now read-only.

AttributeError: 'NoneType' object has no attribute 'vocab_size' #37

Open
shangyusu opened this issue Dec 14, 2020 · 3 comments
Open

AttributeError: 'NoneType' object has no attribute 'vocab_size' #37

shangyusu opened this issue Dec 14, 2020 · 3 comments

Comments

@shangyusu
Copy link

Hi,

I am trying to decode some texts with a finetuned mT5 model, the command looks like the following. The reason of my using test.gin was because when using operative gin file, there would be a mismatching error on line adafactor_decay_rate_pow.offset = 0, so I commented that line.

python -m t5.models.mesh_transformer_main \
--tpu="${TPU_NAME}" \
--gcp_project="${PROJECT}" \
  --tpu_zone="${ZONE}" \
  --model_dir="${MODEL_DIR}" \
  --gin_file="${MODEL_DIR}/test.gin" \
  --gin_file="infer.gin" \
  --gin_file="sample_decode.gin" \
  --gin_param="input_filename = '${INPUT_FILE}'"\
  --gin_param="output_filename = '/tmp/outputs.txt'"\
  --gin_param="utils.tpu_mesh_shape.tpu_topology = '${TPU_SIZE}'"\
  --gin_param="infer_checkpoint_step = 1003000"

And the error was:

Traceback (most recent call last):
  File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.7/dist-packages/t5/models/mesh_transformer_main.py", line 264, in <module>
    console_entry_point()
  File "/usr/local/lib/python3.7/dist-packages/t5/models/mesh_transformer_main.py", line 261, in console_entry_point
    app.run(main)
  File "/usr/local/lib/python3.7/dist-packages/absl/app.py", line 300, in run
    _run_main(main, args)
  File "/usr/local/lib/python3.7/dist-packages/absl/app.py", line 251, in _run_main
    sys.exit(main(argv))
  File "/usr/local/lib/python3.7/dist-packages/t5/models/mesh_transformer_main.py", line 255, in main
    model_dir=FLAGS.model_dir)
  File "/usr/local/lib/python3.7/dist-packages/gin/config.py", line 1078, in gin_wrapper
    utils.augment_exception_message_and_reraise(e, err_str)
  File "/usr/local/lib/python3.7/dist-packages/gin/utils.py", line 49, in augment_exception_message_and_reraise
    six.raise_from(proxy.with_traceback(exception.__traceback__), None)
  File "<string>", line 3, in raise_from
  File "/usr/local/lib/python3.7/dist-packages/gin/config.py", line 1055, in gin_wrapper
    return fn(*new_args, **new_kwargs)
  File "/usr/local/lib/python3.7/dist-packages/mesh_tensorflow/transformer/utils.py", line 2292, in run
    mesh_devices=mesh_devices)
  File "/usr/local/lib/python3.7/dist-packages/mesh_tensorflow/transformer/utils.py", line 1526, in get_estimator
    input_vocab_size=inputs_vocabulary(vocabulary).vocab_size,
AttributeError: 'NoneType' object has no attribute 'vocab_size'
  In call to configurable 'run' (<function run at 0x7fc3f511bbf8>)

I have tried adding the following params but none of them worked.

--module_import="multilingual_t5.tasks" 
--gin_location_prefix="multilingual_t5/gin/" 
--gin_param="tsv_dataset_fn.vocabulary = SentencePieceVocabulary()"
--gin_param="SentencePieceVocabulary.sentencepiece_model_file = 'gs://t5-data/vocabs/mc4.250000.100extra/sentencepiece.model'"

Do you have idea on this one?
Any help would be appreciated, thanks!

@shangyusu
Copy link
Author

Is there any way I can import the vocabulary of a predefined mixture or load the model 'gs://t5-data/vocabs/mc4.250000.100extra/sentencepiece.model'?

@adarob
Copy link
Contributor

adarob commented Dec 14, 2020 via email

@sumanthd17
Copy link

hi @adarob facing the same issue. I'm using t5 (0.7.1) but somehow the imports are not working

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

No branches or pull requests

3 participants