Skip to content
This repository was archived by the owner on Jul 7, 2023. It is now read-only.
This repository was archived by the owner on Jul 7, 2023. It is now read-only.

tutorial fails with latest release 1.1.2 because of wrong encoding for python3 #187

@fac2003

Description

@fac2003

Running the tutorial with python3, I get:

Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.5/bin/t2t-datagen", line 41, in
from tensor2tensor.data_generators import all_problems # pylint: disable=unused-import
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/tensor2tensor/data_generators/all_problems.py", line 22, in
from tensor2tensor.data_generators import algorithmic
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/tensor2tensor/data_generators/algorithmic.py", line 27, in
from tensor2tensor.data_generators import generator_utils as utils
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/tensor2tensor/data_generators/generator_utils.py", line 35, in
from tensor2tensor.data_generators import text_encoder
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/tensor2tensor/data_generators/text_encoder.py", line 56
_UNESCAPE_REGEX = re.compile(ur"\u|\\|\([0-9]+);")

This can be fixed by removing the u in front of the regexp. Python3 does not support it.

Note that there is another spot with the same problem:

from tensor2tensor.data_generators import text_encoder

File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/tensor2tensor/data_generators/text_encoder.py", line 222
c if c in alphabet and c != u"\n" else ur"%d;" % ord(c)

Remove u in front of ur"%d will solve this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions