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
ModelZoo
ResNet50_tensorflow
Commits
bb124157
Commit
bb124157
authored
Mar 10, 2021
by
stephenwu
Browse files
Merge branch 'master' of
https://github.com/tensorflow/models
into RTESuperGLUE
parents
2e9bb539
0edeb7f6
Changes
386
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
61 additions
and
49 deletions
+61
-49
official/nlp/xlnet/preprocess_squad_data.py
official/nlp/xlnet/preprocess_squad_data.py
+3
-3
official/nlp/xlnet/preprocess_utils.py
official/nlp/xlnet/preprocess_utils.py
+5
-5
official/nlp/xlnet/run_classifier.py
official/nlp/xlnet/run_classifier.py
+2
-2
official/nlp/xlnet/run_pretrain.py
official/nlp/xlnet/run_pretrain.py
+2
-2
official/nlp/xlnet/run_squad.py
official/nlp/xlnet/run_squad.py
+2
-2
official/nlp/xlnet/squad_utils.py
official/nlp/xlnet/squad_utils.py
+3
-3
official/nlp/xlnet/training_utils.py
official/nlp/xlnet/training_utils.py
+6
-7
official/nlp/xlnet/xlnet_config.py
official/nlp/xlnet/xlnet_config.py
+2
-2
official/nlp/xlnet/xlnet_modeling.py
official/nlp/xlnet/xlnet_modeling.py
+2
-2
official/recommendation/__init__.py
official/recommendation/__init__.py
+14
-0
official/recommendation/constants.py
official/recommendation/constants.py
+2
-2
official/recommendation/create_ncf_data.py
official/recommendation/create_ncf_data.py
+2
-2
official/recommendation/data_pipeline.py
official/recommendation/data_pipeline.py
+2
-2
official/recommendation/data_preprocessing.py
official/recommendation/data_preprocessing.py
+2
-2
official/recommendation/data_test.py
official/recommendation/data_test.py
+2
-2
official/recommendation/movielens.py
official/recommendation/movielens.py
+2
-2
official/recommendation/ncf_common.py
official/recommendation/ncf_common.py
+2
-3
official/recommendation/ncf_input_pipeline.py
official/recommendation/ncf_input_pipeline.py
+2
-2
official/recommendation/ncf_keras_main.py
official/recommendation/ncf_keras_main.py
+2
-2
official/recommendation/ncf_test.py
official/recommendation/ncf_test.py
+2
-2
No files found.
official/nlp/xlnet/preprocess_squad_data.py
View file @
bb124157
# coding=utf-8
# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
# Copyright 2021 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
...
...
@@ -12,7 +11,8 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
# coding=utf-8
"""Script to pre-process SQUAD data into tfrecords."""
import
os
...
...
official/nlp/xlnet/preprocess_utils.py
View file @
bb124157
# coding=utf-8
# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
# Copyright 2021 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
...
...
@@ -12,7 +11,8 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
# coding=utf-8
"""Utilities for pre-processing."""
import
unicodedata
...
...
@@ -36,7 +36,7 @@ def printable_text(text):
elif
six
.
PY2
:
if
isinstance
(
text
,
str
):
return
text
elif
isinstance
(
text
,
unicode
):
elif
isinstance
(
text
,
unicode
):
# pylint: disable=undefined-variable
return
text
.
encode
(
'utf-8'
)
else
:
raise
ValueError
(
'Unsupported string type: %s'
%
(
type
(
text
)))
...
...
@@ -81,7 +81,7 @@ def encode_pieces(sp_model, text, return_unicode=True, sample=False):
"""Encodes pieces."""
# return_unicode is used only for py2
if
six
.
PY2
and
isinstance
(
text
,
unicode
):
if
six
.
PY2
and
isinstance
(
text
,
unicode
):
# pylint: disable=undefined-variable
text
=
text
.
encode
(
'utf-8'
)
if
not
sample
:
...
...
official/nlp/xlnet/run_classifier.py
View file @
bb124157
# Copyright 201
9
The TensorFlow Authors. All Rights Reserved.
# Copyright 20
2
1 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
...
...
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""XLNet classification finetuning runner in tf2.0."""
import
functools
...
...
official/nlp/xlnet/run_pretrain.py
View file @
bb124157
# Copyright 201
9
The TensorFlow Authors. All Rights Reserved.
# Copyright 20
2
1 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
...
...
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""XLNet pretraining runner in tf2.0."""
import
functools
...
...
official/nlp/xlnet/run_squad.py
View file @
bb124157
# Copyright 201
9
The TensorFlow Authors. All Rights Reserved.
# Copyright 20
2
1 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
...
...
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""XLNet SQUAD finetuning runner in tf2.0."""
import
functools
...
...
official/nlp/xlnet/squad_utils.py
View file @
bb124157
# Copyright 201
9
The TensorFlow Authors. All Rights Reserved.
# Copyright 20
2
1 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
...
...
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
# coding=utf-8
"""Utilities used in SQUAD task."""
from
__future__
import
absolute_import
...
...
@@ -656,7 +656,7 @@ def convert_examples_to_features(examples, sp_model, max_seq_length, doc_stride,
assert
tok_start_position
<=
tok_end_position
def
_piece_to_id
(
x
):
if
six
.
PY2
and
isinstance
(
x
,
unicode
):
if
six
.
PY2
and
isinstance
(
x
,
unicode
):
# pylint: disable=undefined-variable
x
=
x
.
encode
(
"utf-8"
)
return
sp_model
.
PieceToId
(
x
)
...
...
official/nlp/xlnet/training_utils.py
View file @
bb124157
# Copyright 201
9
The TensorFlow Authors. All Rights Reserved.
# Copyright 20
2
1 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
...
...
@@ -11,22 +11,21 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""XLNet training utils."""
import
os
import
re
from
typing
import
Any
,
Callable
,
Dict
,
Optional
,
Text
from
absl
import
logging
# pytype: disable=attribute-error
# pylint: disable=g-bare-generic,unused-import
import
tensorflow
as
tf
from
typing
import
Any
,
Callable
,
Dict
,
Text
,
Optional
from
official.nlp.bert
import
model_training_utils
from
official.nlp.xlnet
import
data_utils
from
official.nlp.xlnet
import
xlnet_modeling
as
modeling
# pytype: disable=attribute-error
# pylint: disable=g-bare-generic,unused-import
_MIN_SUMMARY_STEPS
=
10
...
...
official/nlp/xlnet/xlnet_config.py
View file @
bb124157
# Copyright 201
9
The TensorFlow Authors. All Rights Reserved.
# Copyright 20
2
1 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
...
...
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Utility functions used in XLNet model."""
import
json
...
...
official/nlp/xlnet/xlnet_modeling.py
View file @
bb124157
# Copyright 201
9
The TensorFlow Authors. All Rights Reserved.
# Copyright 20
2
1 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
...
...
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Keras layers of XLNet model in TF 2.0."""
import
copy
...
...
official/recommendation/__init__.py
View file @
bb124157
# Copyright 2021 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
official/recommendation/constants.py
View file @
bb124157
# Copyright 201
8
The TensorFlow Authors. All Rights Reserved.
# Copyright 20
2
1 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
...
...
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Central location for NCF specific values."""
import
sys
...
...
official/recommendation/create_ncf_data.py
View file @
bb124157
# Copyright 201
9
The TensorFlow Authors. All Rights Reserved.
# Copyright 20
2
1 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
...
...
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Binary to generate training/evaluation dataset for NCF model."""
import
json
...
...
official/recommendation/data_pipeline.py
View file @
bb124157
# Copyright 201
8
The TensorFlow Authors. All Rights Reserved.
# Copyright 20
2
1 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
...
...
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Asynchronous data producer for the NCF pipeline."""
from
__future__
import
absolute_import
...
...
official/recommendation/data_preprocessing.py
View file @
bb124157
# Copyright 201
8
The TensorFlow Authors. All Rights Reserved.
# Copyright 20
2
1 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
...
...
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Preprocess dataset and construct any necessary artifacts."""
from
__future__
import
absolute_import
...
...
official/recommendation/data_test.py
View file @
bb124157
# Copyright 201
8
The TensorFlow Authors. All Rights Reserved.
# Copyright 20
2
1 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
...
...
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Test NCF data pipeline."""
from
__future__
import
absolute_import
...
...
official/recommendation/movielens.py
View file @
bb124157
# Copyright 201
8
The TensorFlow Authors. All Rights Reserved.
# Copyright 20
2
1 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
...
...
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Download and extract the MovieLens dataset from GroupLens website.
Download the dataset, and perform basic preprocessing.
...
...
official/recommendation/ncf_common.py
View file @
bb124157
# Copyright 201
8
The TensorFlow Authors. All Rights Reserved.
# Copyright 20
2
1 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
...
...
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Common functionalities used by both Keras and Estimator implementations."""
from
__future__
import
absolute_import
...
...
@@ -32,7 +32,6 @@ from official.recommendation import data_pipeline
from
official.recommendation
import
data_preprocessing
from
official.recommendation
import
movielens
from
official.utils.flags
import
core
as
flags_core
from
official.utils.misc
import
keras_utils
FLAGS
=
flags
.
FLAGS
...
...
official/recommendation/ncf_input_pipeline.py
View file @
bb124157
# Copyright 201
9
The TensorFlow Authors. All Rights Reserved.
# Copyright 20
2
1 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
...
...
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""NCF model input pipeline."""
import
functools
...
...
official/recommendation/ncf_keras_main.py
View file @
bb124157
# Copyright 201
8
The TensorFlow Authors. All Rights Reserved.
# Copyright 20
2
1 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
...
...
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""NCF framework to train and evaluate the NeuMF model.
The NeuMF model assembles both MF and MLP models under the NCF framework. Check
...
...
official/recommendation/ncf_test.py
View file @
bb124157
# Copyright 201
8
The TensorFlow Authors. All Rights Reserved.
# Copyright 20
2
1 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
...
...
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Tests NCF."""
from
__future__
import
absolute_import
...
...
Prev
1
…
11
12
13
14
15
16
17
18
19
20
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