Skip to content
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

Changes isort profile to black, to be fully compatible and adds 'pkg' dir for black and flake8 #2413

Merged
merged 3 commits into from
Aug 22, 2024
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
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