Skip to content

Commit

Permalink
Fixed imports
Browse files Browse the repository at this point in the history
  • Loading branch information
adnaniazi committed Jul 10, 2024
1 parent 6780429 commit 023a65d
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 19 deletions.
5 changes: 0 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ repos:
language: system
types: [python]
pass_filenames: false
- id: ruff
name: ruff
entry: poetry run ruff check
language: system
types: [python]
- id: flake8
name: flake8
entry: poetry run flake8
Expand Down
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ ignore =
# Module level import not at top of file
C901,
# Too complex
F401,
# Unused imports

# pep8-naming
classmethod-decorators =
Expand Down
30 changes: 25 additions & 5 deletions src/capfinder/ml_libs.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,30 @@
import os
import logging # noqa
import os # noqa
import warnings # noqa

os.environ["KERAS_BACKEND"] = "jax"
import jax # noqa

# from keras import Model
os.environ["KERAS_BACKEND"] = "jax"

import logging
import warnings
import keras # noqa
from keras import layers # noqa
from keras.layers import LSTM # noqa
from keras.layers import BatchNormalization # noqa
from keras.layers import Conv1D # noqa
from keras.layers import Dense # noqa
from keras.layers import Dropout # noqa
from keras.layers import Input # noqa
from keras.layers import MaxPooling1D # noqa
from keras.models import Model # noqa
from keras.optimizers import Adam # noqa
from keras_tuner import ( # noqa
BayesianOptimization,
Hyperband,
HyperModel,
HyperParameters,
Objective,
RandomSearch,
)

# Disable TensorFlow logging
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "3" # FATAL
Expand All @@ -18,3 +37,4 @@
warnings.filterwarnings("ignore", category=UserWarning, message=".*TensorRT.*")

# Now import TensorFlow
import tensorflow as tf # noqa
11 changes: 2 additions & 9 deletions src/capfinder/training.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,8 @@
import pandas as pd
from comet_ml import Experiment # Import CometML before keras
from loguru import logger
from ml_libs import (
BayesianOptimization,
Hyperband,
Objective,
RandomSearch,
jax,
keras,
tf,
)
from ml_libs import jax # noqa
from ml_libs import BayesianOptimization, Hyperband, Objective, RandomSearch, keras, tf
from sklearn.metrics import confusion_matrix
from tqdm import tqdm

Expand Down

0 comments on commit 023a65d

Please sign in to comment.