Skip to content

Commit 723f40d

Browse files
csummerseafacebook-github-bot
authored andcommitted
video model test workflow on CPU (pytorch#13203)
Summary: Pull Request resolved: pytorch#13203 Minor changes in the test workflow to run the model on CPUs Reviewed By: stephenyan1231 Differential Revision: D9925797 fbshipit-source-id: b7b1fb2658ab68b1ffc2b1f7b314958ea4732b32
1 parent dae7616 commit 723f40d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

caffe2/python/data_parallel_model.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -907,7 +907,7 @@ def GetCheckpointParams(model):
907907
return first_gpu_blobs.union(iteration_blobs)
908908

909909

910-
def FinalizeAfterCheckpoint(model, blobs=None):
910+
def FinalizeAfterCheckpoint(model, blobs=None, cpu_mode=False):
911911
'''
912912
This function should be called after loading parameters from a
913913
checkpoint / initial parameters file.
@@ -936,12 +936,14 @@ def FinalizeAfterCheckpoint(model, blobs=None):
936936
model._device_grouped_blobs[name] = grouped
937937

938938
model._checkpoint_net = core.Net("checkpoint_sync_net")
939-
model._checkpoint_net.RunAllOnGPU()
939+
if not cpu_mode:
940+
model._checkpoint_net.RunAllOnGPU()
940941

941942
checkpoint_init_net = None
942943
if (model._rendezvous is not None and model._rendezvous['num_shards'] > 1):
943944
checkpoint_init_net = core.Net("checkpoint_init_net")
944-
checkpoint_init_net.RunAllOnGPU()
945+
if not cpu_mode:
946+
checkpoint_init_net.RunAllOnGPU()
945947

946948
_SyncAllParams(
947949
devices,

0 commit comments

Comments
 (0)