未验证 提交 501b11de 编写于 作者: L LielinJiang 提交者: GitHub

Delete incorrect warning message (#30196) (#30262)

* fix warning and no grad
上级 d839761e
...@@ -621,6 +621,7 @@ class DynamicGraphAdapter(object): ...@@ -621,6 +621,7 @@ class DynamicGraphAdapter(object):
self._input_info = None self._input_info = None
if self._nranks > 1: if self._nranks > 1:
dist.init_parallel_env()
stradegy = fluid.dygraph.parallel.ParallelStrategy() stradegy = fluid.dygraph.parallel.ParallelStrategy()
stradegy.nranks = ParallelEnv().nranks stradegy.nranks = ParallelEnv().nranks
stradegy.local_rank = ParallelEnv().local_rank stradegy.local_rank = ParallelEnv().local_rank
...@@ -888,7 +889,6 @@ class Model(object): ...@@ -888,7 +889,6 @@ class Model(object):
# init backend # init backend
if fluid.in_dygraph_mode(): if fluid.in_dygraph_mode():
dist.init_parallel_env()
self._adapter = DynamicGraphAdapter(self) self._adapter = DynamicGraphAdapter(self)
else: else:
self._adapter = StaticGraphAdapter(self) self._adapter = StaticGraphAdapter(self)
...@@ -943,6 +943,7 @@ class Model(object): ...@@ -943,6 +943,7 @@ class Model(object):
self._update_inputs() self._update_inputs()
return loss return loss
@paddle.no_grad()
def eval_batch(self, inputs, labels=None): def eval_batch(self, inputs, labels=None):
""" """
Run one evaluating step on a batch of data. Run one evaluating step on a batch of data.
...@@ -994,6 +995,7 @@ class Model(object): ...@@ -994,6 +995,7 @@ class Model(object):
self._update_inputs() self._update_inputs()
return loss return loss
@paddle.no_grad()
def predict_batch(self, inputs): def predict_batch(self, inputs):
""" """
Run one predicting step on a batch of data. Run one predicting step on a batch of data.
......
...@@ -61,7 +61,6 @@ class TestDistTraning(unittest.TestCase): ...@@ -61,7 +61,6 @@ class TestDistTraning(unittest.TestCase):
def test_static_multiple_gpus(self): def test_static_multiple_gpus(self):
device = set_device('gpu') device = set_device('gpu')
fluid.enable_dygraph(device)
im_shape = (-1, 1, 28, 28) im_shape = (-1, 1, 28, 28)
batch_size = 128 batch_size = 128
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册