Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
ce50305e
Unverified
Commit
ce50305e
authored
Dec 22, 2019
by
Aymeric Augustin
Committed by
GitHub
Dec 22, 2019
Browse files
Merge pull request #2270 from aaugustin/remove-python-2
Remove support for Python 2
parents
b6ea0f43
1a948d70
Changes
155
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
10 additions
and
38 deletions
+10
-38
src/transformers/modeling_roberta.py
src/transformers/modeling_roberta.py
+0
-1
src/transformers/modeling_t5.py
src/transformers/modeling_t5.py
+0
-1
src/transformers/modeling_tf_albert.py
src/transformers/modeling_tf_albert.py
+3
-8
src/transformers/modeling_tf_auto.py
src/transformers/modeling_tf_auto.py
+0
-1
src/transformers/modeling_tf_bert.py
src/transformers/modeling_tf_bert.py
+2
-8
src/transformers/modeling_tf_ctrl.py
src/transformers/modeling_tf_ctrl.py
+0
-1
src/transformers/modeling_tf_distilbert.py
src/transformers/modeling_tf_distilbert.py
+1
-1
src/transformers/modeling_tf_gpt2.py
src/transformers/modeling_tf_gpt2.py
+0
-1
src/transformers/modeling_tf_openai.py
src/transformers/modeling_tf_openai.py
+0
-1
src/transformers/modeling_tf_pytorch_utils.py
src/transformers/modeling_tf_pytorch_utils.py
+0
-1
src/transformers/modeling_tf_roberta.py
src/transformers/modeling_tf_roberta.py
+0
-1
src/transformers/modeling_tf_t5.py
src/transformers/modeling_tf_t5.py
+0
-1
src/transformers/modeling_tf_transfo_xl.py
src/transformers/modeling_tf_transfo_xl.py
+0
-1
src/transformers/modeling_tf_utils.py
src/transformers/modeling_tf_utils.py
+0
-1
src/transformers/modeling_tf_xlm.py
src/transformers/modeling_tf_xlm.py
+1
-1
src/transformers/modeling_tf_xlnet.py
src/transformers/modeling_tf_xlnet.py
+2
-5
src/transformers/modeling_transfo_xl.py
src/transformers/modeling_transfo_xl.py
+0
-1
src/transformers/modeling_utils.py
src/transformers/modeling_utils.py
+0
-1
src/transformers/modeling_xlm.py
src/transformers/modeling_xlm.py
+1
-1
src/transformers/modeling_xlm_roberta.py
src/transformers/modeling_xlm_roberta.py
+0
-1
No files found.
src/transformers/modeling_roberta.py
View file @
ce50305e
...
@@ -15,7 +15,6 @@
...
@@ -15,7 +15,6 @@
# limitations under the License.
# limitations under the License.
"""PyTorch RoBERTa model. """
"""PyTorch RoBERTa model. """
from
__future__
import
absolute_import
,
division
,
print_function
,
unicode_literals
import
logging
import
logging
...
...
src/transformers/modeling_t5.py
View file @
ce50305e
...
@@ -14,7 +14,6 @@
...
@@ -14,7 +14,6 @@
# limitations under the License.
# limitations under the License.
""" PyTorch T5 model. """
""" PyTorch T5 model. """
from
__future__
import
absolute_import
,
division
,
print_function
,
unicode_literals
import
copy
import
copy
import
itertools
import
itertools
...
...
src/transformers/modeling_tf_albert.py
View file @
ce50305e
...
@@ -14,10 +14,9 @@
...
@@ -14,10 +14,9 @@
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
""" TF 2.0 ALBERT model. """
""" TF 2.0 ALBERT model. """
from
__future__
import
absolute_import
,
division
,
print_function
,
unicode_literals
import
logging
import
logging
import
sys
import
tensorflow
as
tf
import
tensorflow
as
tf
...
@@ -311,9 +310,7 @@ class TFAlbertLayer(tf.keras.layers.Layer):
...
@@ -311,9 +310,7 @@ class TFAlbertLayer(tf.keras.layers.Layer):
config
.
intermediate_size
,
kernel_initializer
=
get_initializer
(
config
.
initializer_range
),
name
=
"ffn"
config
.
intermediate_size
,
kernel_initializer
=
get_initializer
(
config
.
initializer_range
),
name
=
"ffn"
)
)
if
isinstance
(
config
.
hidden_act
,
str
)
or
(
if
isinstance
(
config
.
hidden_act
,
str
):
sys
.
version_info
[
0
]
==
2
and
isinstance
(
config
.
hidden_act
,
unicode
)
# noqa: F821
):
self
.
activation
=
ACT2FN
[
config
.
hidden_act
]
self
.
activation
=
ACT2FN
[
config
.
hidden_act
]
else
:
else
:
self
.
activation
=
config
.
hidden_act
self
.
activation
=
config
.
hidden_act
...
@@ -454,9 +451,7 @@ class TFAlbertMLMHead(tf.keras.layers.Layer):
...
@@ -454,9 +451,7 @@ class TFAlbertMLMHead(tf.keras.layers.Layer):
self
.
dense
=
tf
.
keras
.
layers
.
Dense
(
self
.
dense
=
tf
.
keras
.
layers
.
Dense
(
config
.
embedding_size
,
kernel_initializer
=
get_initializer
(
config
.
initializer_range
),
name
=
"dense"
config
.
embedding_size
,
kernel_initializer
=
get_initializer
(
config
.
initializer_range
),
name
=
"dense"
)
)
if
isinstance
(
config
.
hidden_act
,
str
)
or
(
if
isinstance
(
config
.
hidden_act
,
str
):
sys
.
version_info
[
0
]
==
2
and
isinstance
(
config
.
hidden_act
,
unicode
)
# noqa: F821
):
self
.
activation
=
ACT2FN
[
config
.
hidden_act
]
self
.
activation
=
ACT2FN
[
config
.
hidden_act
]
else
:
else
:
self
.
activation
=
config
.
hidden_act
self
.
activation
=
config
.
hidden_act
...
...
src/transformers/modeling_tf_auto.py
View file @
ce50305e
...
@@ -14,7 +14,6 @@
...
@@ -14,7 +14,6 @@
# limitations under the License.
# limitations under the License.
""" Auto Model class. """
""" Auto Model class. """
from
__future__
import
absolute_import
,
division
,
print_function
,
unicode_literals
import
logging
import
logging
...
...
src/transformers/modeling_tf_bert.py
View file @
ce50305e
...
@@ -15,10 +15,8 @@
...
@@ -15,10 +15,8 @@
# limitations under the License.
# limitations under the License.
""" TF 2.0 BERT model. """
""" TF 2.0 BERT model. """
from
__future__
import
absolute_import
,
division
,
print_function
,
unicode_literals
import
logging
import
logging
import
sys
import
numpy
as
np
import
numpy
as
np
import
tensorflow
as
tf
import
tensorflow
as
tf
...
@@ -311,9 +309,7 @@ class TFBertIntermediate(tf.keras.layers.Layer):
...
@@ -311,9 +309,7 @@ class TFBertIntermediate(tf.keras.layers.Layer):
self
.
dense
=
tf
.
keras
.
layers
.
Dense
(
self
.
dense
=
tf
.
keras
.
layers
.
Dense
(
config
.
intermediate_size
,
kernel_initializer
=
get_initializer
(
config
.
initializer_range
),
name
=
"dense"
config
.
intermediate_size
,
kernel_initializer
=
get_initializer
(
config
.
initializer_range
),
name
=
"dense"
)
)
if
isinstance
(
config
.
hidden_act
,
str
)
or
(
if
isinstance
(
config
.
hidden_act
,
str
):
sys
.
version_info
[
0
]
==
2
and
isinstance
(
config
.
hidden_act
,
unicode
)
# noqa: F821
):
self
.
intermediate_act_fn
=
ACT2FN
[
config
.
hidden_act
]
self
.
intermediate_act_fn
=
ACT2FN
[
config
.
hidden_act
]
else
:
else
:
self
.
intermediate_act_fn
=
config
.
hidden_act
self
.
intermediate_act_fn
=
config
.
hidden_act
...
@@ -418,9 +414,7 @@ class TFBertPredictionHeadTransform(tf.keras.layers.Layer):
...
@@ -418,9 +414,7 @@ class TFBertPredictionHeadTransform(tf.keras.layers.Layer):
self
.
dense
=
tf
.
keras
.
layers
.
Dense
(
self
.
dense
=
tf
.
keras
.
layers
.
Dense
(
config
.
hidden_size
,
kernel_initializer
=
get_initializer
(
config
.
initializer_range
),
name
=
"dense"
config
.
hidden_size
,
kernel_initializer
=
get_initializer
(
config
.
initializer_range
),
name
=
"dense"
)
)
if
isinstance
(
config
.
hidden_act
,
str
)
or
(
if
isinstance
(
config
.
hidden_act
,
str
):
sys
.
version_info
[
0
]
==
2
and
isinstance
(
config
.
hidden_act
,
unicode
)
# noqa: F821
):
self
.
transform_act_fn
=
ACT2FN
[
config
.
hidden_act
]
self
.
transform_act_fn
=
ACT2FN
[
config
.
hidden_act
]
else
:
else
:
self
.
transform_act_fn
=
config
.
hidden_act
self
.
transform_act_fn
=
config
.
hidden_act
...
...
src/transformers/modeling_tf_ctrl.py
View file @
ce50305e
...
@@ -15,7 +15,6 @@
...
@@ -15,7 +15,6 @@
# limitations under the License.
# limitations under the License.
""" TF 2.0 CTRL model."""
""" TF 2.0 CTRL model."""
from
__future__
import
absolute_import
,
division
,
print_function
,
unicode_literals
import
logging
import
logging
...
...
src/transformers/modeling_tf_distilbert.py
View file @
ce50305e
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
# limitations under the License.
# limitations under the License.
""" TF 2.0 DistilBERT model
""" TF 2.0 DistilBERT model
"""
"""
from
__future__
import
absolute_import
,
division
,
print_function
,
unicode_literals
import
logging
import
logging
import
math
import
math
...
...
src/transformers/modeling_tf_gpt2.py
View file @
ce50305e
...
@@ -15,7 +15,6 @@
...
@@ -15,7 +15,6 @@
# limitations under the License.
# limitations under the License.
""" TF 2.0 OpenAI GPT-2 model. """
""" TF 2.0 OpenAI GPT-2 model. """
from
__future__
import
absolute_import
,
division
,
print_function
,
unicode_literals
import
logging
import
logging
...
...
src/transformers/modeling_tf_openai.py
View file @
ce50305e
...
@@ -15,7 +15,6 @@
...
@@ -15,7 +15,6 @@
# limitations under the License.
# limitations under the License.
""" TF 2.0 OpenAI GPT model."""
""" TF 2.0 OpenAI GPT model."""
from
__future__
import
absolute_import
,
division
,
print_function
,
unicode_literals
import
logging
import
logging
...
...
src/transformers/modeling_tf_pytorch_utils.py
View file @
ce50305e
...
@@ -15,7 +15,6 @@
...
@@ -15,7 +15,6 @@
# limitations under the License.
# limitations under the License.
""" PyTorch - TF 2.0 general utilities."""
""" PyTorch - TF 2.0 general utilities."""
from
__future__
import
absolute_import
,
division
,
print_function
,
unicode_literals
import
logging
import
logging
import
os
import
os
...
...
src/transformers/modeling_tf_roberta.py
View file @
ce50305e
...
@@ -15,7 +15,6 @@
...
@@ -15,7 +15,6 @@
# limitations under the License.
# limitations under the License.
""" TF 2.0 RoBERTa model. """
""" TF 2.0 RoBERTa model. """
from
__future__
import
absolute_import
,
division
,
print_function
,
unicode_literals
import
logging
import
logging
...
...
src/transformers/modeling_tf_t5.py
View file @
ce50305e
...
@@ -15,7 +15,6 @@
...
@@ -15,7 +15,6 @@
# limitations under the License.
# limitations under the License.
""" TF 2.0 T5 model. """
""" TF 2.0 T5 model. """
from
__future__
import
absolute_import
,
division
,
print_function
,
unicode_literals
import
copy
import
copy
import
itertools
import
itertools
...
...
src/transformers/modeling_tf_transfo_xl.py
View file @
ce50305e
...
@@ -16,7 +16,6 @@
...
@@ -16,7 +16,6 @@
""" TF 2.0 Transformer XL model.
""" TF 2.0 Transformer XL model.
"""
"""
from
__future__
import
absolute_import
,
division
,
print_function
,
unicode_literals
import
logging
import
logging
...
...
src/transformers/modeling_tf_utils.py
View file @
ce50305e
...
@@ -15,7 +15,6 @@
...
@@ -15,7 +15,6 @@
# limitations under the License.
# limitations under the License.
"""TF general model utils."""
"""TF general model utils."""
from
__future__
import
absolute_import
,
division
,
print_function
,
unicode_literals
import
logging
import
logging
import
os
import
os
...
...
src/transformers/modeling_tf_xlm.py
View file @
ce50305e
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
# limitations under the License.
# limitations under the License.
""" TF 2.0 XLM model.
""" TF 2.0 XLM model.
"""
"""
from
__future__
import
absolute_import
,
division
,
print_function
,
unicode_literals
import
itertools
import
itertools
import
logging
import
logging
...
...
src/transformers/modeling_tf_xlnet.py
View file @
ce50305e
...
@@ -15,10 +15,9 @@
...
@@ -15,10 +15,9 @@
# limitations under the License.
# limitations under the License.
""" TF 2.0 XLNet model.
""" TF 2.0 XLNet model.
"""
"""
from
__future__
import
absolute_import
,
division
,
print_function
,
unicode_literals
import
logging
import
logging
import
sys
import
numpy
as
np
import
numpy
as
np
import
tensorflow
as
tf
import
tensorflow
as
tf
...
@@ -290,9 +289,7 @@ class TFXLNetFeedForward(tf.keras.layers.Layer):
...
@@ -290,9 +289,7 @@ class TFXLNetFeedForward(tf.keras.layers.Layer):
config
.
d_model
,
kernel_initializer
=
get_initializer
(
config
.
initializer_range
),
name
=
"layer_2"
config
.
d_model
,
kernel_initializer
=
get_initializer
(
config
.
initializer_range
),
name
=
"layer_2"
)
)
self
.
dropout
=
tf
.
keras
.
layers
.
Dropout
(
config
.
dropout
)
self
.
dropout
=
tf
.
keras
.
layers
.
Dropout
(
config
.
dropout
)
if
isinstance
(
config
.
ff_activation
,
str
)
or
(
if
isinstance
(
config
.
ff_activation
,
str
):
sys
.
version_info
[
0
]
==
2
and
isinstance
(
config
.
ff_activation
,
unicode
)
# noqa: F821
):
self
.
activation_function
=
ACT2FN
[
config
.
ff_activation
]
self
.
activation_function
=
ACT2FN
[
config
.
ff_activation
]
else
:
else
:
self
.
activation_function
=
config
.
ff_activation
self
.
activation_function
=
config
.
ff_activation
...
...
src/transformers/modeling_transfo_xl.py
View file @
ce50305e
...
@@ -18,7 +18,6 @@
...
@@ -18,7 +18,6 @@
In particular https://github.com/kimiyoung/transformer-xl/blob/master/pytorch/mem_transformer.py
In particular https://github.com/kimiyoung/transformer-xl/blob/master/pytorch/mem_transformer.py
"""
"""
from
__future__
import
absolute_import
,
division
,
print_function
,
unicode_literals
import
logging
import
logging
...
...
src/transformers/modeling_utils.py
View file @
ce50305e
...
@@ -15,7 +15,6 @@
...
@@ -15,7 +15,6 @@
# limitations under the License.
# limitations under the License.
"""PyTorch BERT model."""
"""PyTorch BERT model."""
from
__future__
import
absolute_import
,
division
,
print_function
,
unicode_literals
import
logging
import
logging
import
os
import
os
...
...
src/transformers/modeling_xlm.py
View file @
ce50305e
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
# limitations under the License.
# limitations under the License.
""" PyTorch XLM model.
""" PyTorch XLM model.
"""
"""
from
__future__
import
absolute_import
,
division
,
print_function
,
unicode_literals
import
itertools
import
itertools
import
logging
import
logging
...
...
src/transformers/modeling_xlm_roberta.py
View file @
ce50305e
...
@@ -15,7 +15,6 @@
...
@@ -15,7 +15,6 @@
# limitations under the License.
# limitations under the License.
"""PyTorch XLM-RoBERTa model. """
"""PyTorch XLM-RoBERTa model. """
from
__future__
import
absolute_import
,
division
,
print_function
,
unicode_literals
import
logging
import
logging
...
...
Prev
1
2
3
4
5
6
7
8
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment