diff --git a/python/paddle/fluid/contrib/slim/nas/light_nas_strategy.py b/python/paddle/fluid/contrib/slim/nas/light_nas_strategy.py index 7f44510bd582cd503b230645fa02100d1a003819..380c93d8812f408110f6a1f8b1ea0dffc11f718d 100644 --- a/python/paddle/fluid/contrib/slim/nas/light_nas_strategy.py +++ b/python/paddle/fluid/contrib/slim/nas/light_nas_strategy.py @@ -82,15 +82,7 @@ class LightNASStrategy(Strategy): self._server_ip = self._get_host_ip() def _get_host_ip(self): - - try: - s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) - s.connect(('8.8.8.8', 80)) - ip = s.getsockname()[0] - finally: - s.close() - - return ip + return socket.gethostbyname(socket.gethostname()) def on_compression_begin(self, context): self._current_tokens = context.search_space.init_tokens()