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
7c824435
Commit
7c824435
authored
Apr 01, 2022
by
Reed Wanderman-Milne
Committed by
A. Unique TensorFlower
Apr 01, 2022
Browse files
Internal change
PiperOrigin-RevId: 438897452
parent
f5b4dc60
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
1 deletion
+12
-1
official/core/config_definitions.py
official/core/config_definitions.py
+5
-0
official/core/input_reader.py
official/core/input_reader.py
+3
-1
official/vision/configs/experiments/image_classification/imagenet_resnet50_gpu.yaml
...periments/image_classification/imagenet_resnet50_gpu.yaml
+4
-0
No files found.
official/core/config_definitions.py
View file @
7c824435
...
...
@@ -76,6 +76,10 @@ class DataConfig(base_config.Config):
features. The main use case is to skip the image/video decoding for better
performance.
seed: An optional seed to use for deterministic shuffling/preprocessing.
prefetch_buffer_size: An int specifying the buffer size of prefetch
datasets. If None, the buffer size is autotuned. Specifying this is useful
in case autotuning uses up too much memory by making the buffer size too
high.
"""
input_path
:
Union
[
Sequence
[
str
],
str
,
base_config
.
Config
]
=
""
tfds_name
:
str
=
""
...
...
@@ -96,6 +100,7 @@ class DataConfig(base_config.Config):
tfds_as_supervised
:
bool
=
False
tfds_skip_decoding_feature
:
str
=
""
seed
:
Optional
[
int
]
=
None
prefetch_buffer_size
:
Optional
[
int
]
=
None
@
dataclasses
.
dataclass
...
...
official/core/input_reader.py
View file @
7c824435
...
...
@@ -292,6 +292,8 @@ class InputReader:
self
.
_transform_and_batch_fn
=
transform_and_batch_fn
self
.
_postprocess_fn
=
postprocess_fn
self
.
_seed
=
params
.
seed
self
.
_prefetch_buffer_size
=
(
params
.
prefetch_buffer_size
or
tf
.
data
.
experimental
.
AUTOTUNE
)
# When tf.data service is enabled, each data service worker should get
# different random seeds. Thus, we set `seed` to None.
...
...
@@ -505,4 +507,4 @@ class InputReader:
options
=
tf
.
data
.
Options
()
options
.
experimental_deterministic
=
self
.
_deterministic
dataset
=
dataset
.
with_options
(
options
)
return
dataset
.
prefetch
(
tf
.
data
.
experimental
.
AUTOTUNE
)
return
dataset
.
prefetch
(
self
.
_prefetch_buffer_size
)
official/vision/configs/experiments/image_classification/imagenet_resnet50_gpu.yaml
View file @
7c824435
...
...
@@ -19,12 +19,16 @@ task:
is_training
:
true
global_batch_size
:
2048
dtype
:
'
float16'
# Autotuning the prefetch buffer size causes OOMs, so set it to a reasonable
# static value: 32. See b/218880025.
prefetch_buffer_size
:
32
validation_data
:
input_path
:
'
imagenet-2012-tfrecord/valid*'
is_training
:
false
global_batch_size
:
2048
dtype
:
'
float16'
drop_remainder
:
false
prefetch_buffer_size
:
32
trainer
:
train_steps
:
56160
validation_steps
:
25
...
...
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