Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
Examples
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
High Performance Computing
Examples
Commits
d046cc6e
Commit
d046cc6e
authored
7 months ago
by
Jannis Klinkenberg
Browse files
Options
Downloads
Patches
Plain Diff
fixed native tensorflow version
parent
7ecfb8bb
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
tensorflow/cifar10_distributed/train_model.py
+7
-8
7 additions, 8 deletions
tensorflow/cifar10_distributed/train_model.py
with
7 additions
and
8 deletions
tensorflow/cifar10_distributed/train_model.py
+
7
−
8
View file @
d046cc6e
...
...
@@ -66,19 +66,15 @@ def load_dataset(args):
n_train
,
n_test
=
x_train
.
shape
[
0
],
x_test
.
shape
[
0
]
resize_size
=
224
# use bigger images with ResNet
# disable any automatic data sharding in TensorFlow as we handle that manually here
# options = tf.data.Options()
# options.experimental_distribute.auto_shard_policy = tf.data.experimental.AutoShardPolicy.OFF
# Generating input pipelines
ds_train
=
(
tf
.
data
.
Dataset
.
from_tensor_slices
((
x_train
,
y_train
))
.
map
(
lambda
image
,
label
:
(
tf
.
image
.
resize
(
image
,
[
resize_size
,
resize_size
]),
label
))
.
shuffle
(
n_train
)
# .shard(num_shards=args.world_size, index=args.world_rank)
.
cache
().
batch
(
args
.
global_batch_size
).
prefetch
(
tf
.
data
.
AUTOTUNE
)
#.with_options(options)
.
shuffle
(
n_train
)
.
cache
().
batch
(
args
.
global_batch_size
).
prefetch
(
tf
.
data
.
AUTOTUNE
)
)
ds_test
=
(
tf
.
data
.
Dataset
.
from_tensor_slices
((
x_test
,
y_test
))
.
map
(
lambda
image
,
label
:
(
tf
.
image
.
resize
(
image
,
[
resize_size
,
resize_size
]),
label
))
.
shuffle
(
n_test
).
cache
().
batch
(
args
.
global_batch_size
).
prefetch
(
tf
.
data
.
AUTOTUNE
)
#.with_options(options)
.
shuffle
(
n_test
).
cache
().
batch
(
args
.
global_batch_size
).
prefetch
(
tf
.
data
.
AUTOTUNE
)
)
# get updated shapes
...
...
@@ -107,7 +103,7 @@ def setup(args):
print
(
""
)
sys
.
stdout
.
flush
()
tf
.
config
.
set_visible_devices
(
gpu_devices
[
args
.
local_rank
],
"
GPU
"
)
tf
.
config
.
set_visible_devices
(
gpu_devices
[
0
],
"
GPU
"
)
tf
.
keras
.
backend
.
clear_session
()
tf
.
config
.
optimizer
.
set_jit
(
True
)
...
...
@@ -118,6 +114,9 @@ def setup(args):
)
)
print
(
"
MultiWorkerMirroredStrategy.num_replicas_in_sync
"
,
strategy
.
num_replicas_in_sync
)
print
(
"
MultiWorkerMirroredStrategy.worker_index
"
,
strategy
.
cluster_resolver
.
task_id
)
return
strategy
def
main
():
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment