Skip to content

Commit

Permalink
Changes isort profile to black, to be fully compatible and adds 'pkg'…
Browse files Browse the repository at this point in the history
… dir for black and flake8 (#2413)

* Chnage the isort profile to black, and add pkg dir for black and flake8

Signed-off-by: Ignas Baranauskas <[email protected]>

* Fix the formating

Signed-off-by: Ignas Baranauskas <[email protected]>

* Fix flake8 lint issues

Signed-off-by: Ignas Baranauskas <[email protected]>

---------

Signed-off-by: Ignas Baranauskas <[email protected]>
  • Loading branch information
Ygnas authored Aug 22, 2024
1 parent 4964d04 commit 0e2ba6e
Show file tree
Hide file tree
Showing 47 changed files with 1,122 additions and 727 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ repos:
hooks:
- id: isort
name: isort
entry: isort --profile google
entry: isort --profile black
- repo: https://github.com/psf/black
rev: 24.2.0
hooks:
- id: black
files: (sdk|examples)/.*
files: (sdk|examples|pkg)/.*
- repo: https://github.com/pycqa/flake8
rev: 7.1.1
hooks:
- id: flake8
files: (sdk|examples)/.*
files: (sdk|examples|pkg)/.*
exclude: |
(?x)^(
.*zz_generated.deepcopy.*|
Expand Down
2 changes: 1 addition & 1 deletion cmd/earlystopping/medianstop/v1beta1/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from concurrent import futures
import logging
import time
from concurrent import futures

import grpc

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
# limitations under the License.

import argparse
from logging import getLogger
from logging import INFO
from logging import StreamHandler
from logging import INFO, StreamHandler, getLogger

import api_pb2
import api_pb2_grpc
Expand Down
2 changes: 1 addition & 1 deletion cmd/suggestion/hyperband/v1beta1/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from concurrent import futures
import time
from concurrent import futures

import grpc

Expand Down
2 changes: 1 addition & 1 deletion cmd/suggestion/hyperopt/v1beta1/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from concurrent import futures
import time
from concurrent import futures

import grpc

Expand Down
2 changes: 1 addition & 1 deletion cmd/suggestion/nas/darts/v1beta1/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from concurrent import futures
import time
from concurrent import futures

import grpc

Expand Down
2 changes: 1 addition & 1 deletion cmd/suggestion/nas/enas/v1beta1/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from concurrent import futures
import time
from concurrent import futures

import grpc

Expand Down
2 changes: 1 addition & 1 deletion cmd/suggestion/optuna/v1beta1/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from concurrent import futures
import time
from concurrent import futures

import grpc

Expand Down
2 changes: 1 addition & 1 deletion cmd/suggestion/pbt/v1beta1/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from concurrent import futures
import time
from concurrent import futures

import grpc

Expand Down
2 changes: 1 addition & 1 deletion cmd/suggestion/skopt/v1beta1/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from concurrent import futures
import time
from concurrent import futures

import grpc

Expand Down
22 changes: 12 additions & 10 deletions examples/v1beta1/kubeflow-pipelines/mpi-job-horovod.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,19 @@
# https://www.kubeflow.org/docs/components/training/mpi/

import kfp
from kfp import components
import kfp.dsl as dsl
from kubeflow.katib import ApiClient
from kubeflow.katib import V1beta1AlgorithmSetting
from kubeflow.katib import V1beta1AlgorithmSpec
from kubeflow.katib import V1beta1ExperimentSpec
from kubeflow.katib import V1beta1FeasibleSpace
from kubeflow.katib import V1beta1ObjectiveSpec
from kubeflow.katib import V1beta1ParameterSpec
from kubeflow.katib import V1beta1TrialParameterSpec
from kubeflow.katib import V1beta1TrialTemplate
from kfp import components
from kubeflow.katib import (
ApiClient,
V1beta1AlgorithmSetting,
V1beta1AlgorithmSpec,
V1beta1ExperimentSpec,
V1beta1FeasibleSpace,
V1beta1ObjectiveSpec,
V1beta1ParameterSpec,
V1beta1TrialParameterSpec,
V1beta1TrialTemplate,
)


@dsl.pipeline(
Expand Down
4 changes: 1 addition & 3 deletions examples/v1beta1/trial-images/darts-cnn-cifar10/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from operations import FactorizedReduce
from operations import MixedOp
from operations import StdConv
import torch
import torch.nn as nn
import torch.nn.functional as F
from operations import FactorizedReduce, MixedOp, StdConv


class Cell(nn.Module):
Expand Down
6 changes: 3 additions & 3 deletions examples/v1beta1/trial-images/darts-cnn-cifar10/run_trial.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
import argparse
import json

from architect import Architect
from model import NetworkCNN
import numpy as np
from search_space import SearchSpace
import torch
import torch.nn as nn
import utils
from architect import Architect
from model import NetworkCNN
from search_space import SearchSpace


def main():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,9 @@

import json

from keras.layers import Dense
from keras.layers import Dropout
from keras.layers import GlobalAveragePooling2D
from keras.layers import Input
from keras.layers import Dense, Dropout, GlobalAveragePooling2D, Input
from keras.models import Model
from op_library import concat
from op_library import conv
from op_library import dw_conv
from op_library import reduction
from op_library import sp_conv
from op_library import concat, conv, dw_conv, reduction, sp_conv


class ModelConstructor(object):
Expand Down
6 changes: 2 additions & 4 deletions examples/v1beta1/trial-images/enas-cnn-cifar10/RunTrial.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@

import argparse

import tensorflow as tf
from keras.datasets import cifar10
from ModelConstructor import ModelConstructor
from tensorflow import keras
import tensorflow as tf
from tensorflow.keras.layers import RandomFlip
from tensorflow.keras.layers import RandomTranslation
from tensorflow.keras.layers import Rescaling
from tensorflow.keras.layers import RandomFlip, RandomTranslation, Rescaling
from tensorflow.keras.utils import to_categorical

if __name__ == "__main__":
Expand Down
22 changes: 12 additions & 10 deletions examples/v1beta1/trial-images/enas-cnn-cifar10/op_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,19 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from keras import backend as K
from keras.layers import Activation
from keras.layers import AveragePooling2D
from keras.layers import BatchNormalization
from keras.layers import concatenate
from keras.layers import Conv2D
from keras.layers import DepthwiseConv2D
from keras.layers import MaxPooling2D
from keras.layers import SeparableConv2D
from keras.layers import ZeroPadding2D
import numpy as np
from keras import backend as K
from keras.layers import (
Activation,
AveragePooling2D,
BatchNormalization,
Conv2D,
DepthwiseConv2D,
MaxPooling2D,
SeparableConv2D,
ZeroPadding2D,
concatenate,
)


def concat(inputs):
Expand Down
3 changes: 1 addition & 2 deletions examples/v1beta1/trial-images/pytorch-mnist/mnist.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torchvision import datasets
from torchvision import transforms
from torchvision import datasets, transforms

WORLD_SIZE = int(os.environ.get("WORLD_SIZE", 1))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@

import tensorflow as tf
from tensorflow.keras import Model
from tensorflow.keras.layers import Conv2D
from tensorflow.keras.layers import Dense
from tensorflow.keras.layers import Flatten
from tensorflow.keras.layers import Conv2D, Dense, Flatten


class MyModel(Model):
Expand Down
Loading

0 comments on commit 0e2ba6e

Please sign in to comment.