Skip to content

[ppfleetx] Remove reference of third lib 'six' #869

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Nov 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion codestyle/docstring_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.
"""DocstringChecker is used to check python doc string's style."""

import six
import astroid

from pylint.checkers import BaseChecker, utils
Expand Down
11 changes: 5 additions & 6 deletions ppfleetx/core/engine/eager_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,9 @@ def _train_one_epoch(self,
train_step_start = get_timestamp()
train_losses = []

if self._lr_scheduler is not None and self._lr_scheduler_mode == 'step':
self._lr_scheduler.step()

self._optimizer.clear_grad()

if self._run_mode == 'step' and not skip_first:
Expand Down Expand Up @@ -485,9 +488,6 @@ def _optim_update_params(self):
else:
self._optimizer.step()

if self._lr_scheduler is not None and self._lr_scheduler_mode == 'step':
self._lr_scheduler.step()

@paddle.no_grad()
def evaluate(self, epoch=1, valid_data_loader=None):
"""
Expand Down Expand Up @@ -724,12 +724,11 @@ def inference(self, data):
tensorrt_config = None
if 'TensorRT' in self._inference_configs:
tensorrt_config = TensorRTConfig(
**self._inference_configs['TensorRT'])
**self._inference_configs['TensorRT'])

self._inference_engine = InferenceEngine(
self._inference_configs['model_dir'],
self._inference_configs['mp_degree'],
tensorrt_config)
self._inference_configs['mp_degree'], tensorrt_config)

return self._inference_engine.predict(data)

Expand Down
9 changes: 2 additions & 7 deletions ppfleetx/data/transforms/preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
from __future__ import unicode_literals

from functools import partial
import six
import math
import random
import cv2
Expand Down Expand Up @@ -46,12 +45,8 @@ def __init__(self, to_rgb=True, channel_first=False):
self.channel_first = channel_first

def __call__(self, img):
if six.PY2:
assert type(img) is str and len(
img) > 0, "invalid input 'img' in DecodeImage"
else:
assert type(img) is bytes and len(
img) > 0, "invalid input 'img' in DecodeImage"
assert type(img) is bytes and len(
img) > 0, "invalid input 'img' in DecodeImage"
data = np.frombuffer(img, dtype='uint8')
img = cv2.imdecode(data, 1)
if self.to_rgb:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import io
import copy
import logging
import six
import json

import paddle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import io
import copy
import logging
import six
import json

import paddle
Expand Down