allenai / unified-io-2

Apache License 2.0
572 stars 27 forks source link

SyntaxError when running demo.ipynb (seems like an error rise from gin) #15

Open Sutongtong233 opened 8 months ago

Sutongtong233 commented 8 months ago

Hi, I am really interested in your work. I have some problems when running the demo.ipynb: when running block 2 in the notebook, # Load model and parameters, there is an error:

{
    "name": "SyntaxError",
    "message": "Expected '='. (base.gin, line 4)
  In file \"t5x/examples/unified_io/t5_1_1/xl.gin\", line 5
    include 't5x/examples/unified_io/t5_1_1/base.gin'  # imports vocab, optimizer and model.
  In file \"t5x/examples/unified_io/t5_1_1/xxl.gin\", line 5
    include 't5x/examples/unified_io/t5_1_1/xl.gin'  # imports vocab, optimizer and model.",
    "stack": "Traceback (most recent call last):

  File /opt/conda/envs/unifiedIO/lib/python3.9/site-packages/IPython/core/interactiveshell.py:3550 in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)

  Cell In[12], line 13
    model = uio_utils.get_model(MODEL_TYPE, dtype=\"bfloat16\" if supports_bfloat16 else \"float32\")

  File /mnt/workspace/tongtong.stt/unisd_baselines/unified-io-2/t5x/examples/unified_io/utils.py:51 in get_model
    gin.parse_config_files_and_bindings(

  File /opt/conda/envs/unifiedIO/lib/python3.9/site-packages/gin/config.py:1470 in parse_config_files_and_bindings
    parse_config_file(config_file, skip_unknown)

  File /opt/conda/envs/unifiedIO/lib/python3.9/site-packages/gin/config.py:1436 in parse_config_file
    parse_config(f, skip_unknown=skip_unknown)

  File /opt/conda/envs/unifiedIO/lib/python3.9/site-packages/gin/config.py:1377 in parse_config
    parse_config_file(statement.filename, skip_unknown)

  File /opt/conda/envs/unifiedIO/lib/python3.9/contextlib.py:135 in __exit__
    self.gen.throw(type, value, traceback)

  File /opt/conda/envs/unifiedIO/lib/python3.9/site-packages/gin/utils.py:67 in try_with_location
    augment_exception_message_and_reraise(exception, _format_location(location))

  File /opt/conda/envs/unifiedIO/lib/python3.9/site-packages/gin/utils.py:48 in augment_exception_message_and_reraise
    six.raise_from(proxy.with_traceback(exception.__traceback__), None)

  File <string>:3 in raise_from

  File /opt/conda/envs/unifiedIO/lib/python3.9/site-packages/gin/utils.py:65 in try_with_location
    yield

  File /opt/conda/envs/unifiedIO/lib/python3.9/site-packages/gin/config.py:1377 in parse_config
    parse_config_file(statement.filename, skip_unknown)

  File /opt/conda/envs/unifiedIO/lib/python3.9/site-packages/gin/config.py:1436 in parse_config_file
    parse_config(f, skip_unknown=skip_unknown)

  File /opt/conda/envs/unifiedIO/lib/python3.9/site-packages/gin/config.py:1377 in parse_config
    parse_config_file(statement.filename, skip_unknown)

  File /opt/conda/envs/unifiedIO/lib/python3.9/contextlib.py:135 in __exit__
    self.gen.throw(type, value, traceback)

  File /opt/conda/envs/unifiedIO/lib/python3.9/site-packages/gin/utils.py:67 in try_with_location
    augment_exception_message_and_reraise(exception, _format_location(location))

  File /opt/conda/envs/unifiedIO/lib/python3.9/site-packages/gin/utils.py:48 in augment_exception_message_and_reraise
    six.raise_from(proxy.with_traceback(exception.__traceback__), None)

  File <string>:3 in raise_from

  File /opt/conda/envs/unifiedIO/lib/python3.9/site-packages/gin/utils.py:65 in try_with_location
    yield

  File /opt/conda/envs/unifiedIO/lib/python3.9/site-packages/gin/config.py:1377 in parse_config
    parse_config_file(statement.filename, skip_unknown)

  File /opt/conda/envs/unifiedIO/lib/python3.9/site-packages/gin/config.py:1436 in parse_config_file
    parse_config(f, skip_unknown=skip_unknown)

  File /opt/conda/envs/unifiedIO/lib/python3.9/site-packages/gin/config.py:1352 in parse_config
    for statement in parser:

  File /opt/conda/envs/unifiedIO/lib/python3.9/site-packages/gin/config_parser.py:172 in __next__
    return self.next()

  File /opt/conda/envs/unifiedIO/lib/python3.9/site-packages/gin/config_parser.py:175 in next
    statement = self.parse_statement()

  File /opt/conda/envs/unifiedIO/lib/python3.9/site-packages/gin/config_parser.py:206 in parse_statement
    self._raise_syntax_error(\"Expected '='.\")

  File /opt/conda/envs/unifiedIO/lib/python3.9/site-packages/gin/config_parser.py:267 in _raise_syntax_error
    raise SyntaxError(msg, location)

  File <string>
SyntaxError
"
}

Seems like an error rise from gin module. gin module is not necessary for inference. Is there any more concise code? Thanks