diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4ddabac..ddd638f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,14 +28,14 @@ repos: - id: python-use-type-annotations - repo: https://github.com/codespell-project/codespell - rev: v2.4.1 + rev: v2.4.3 hooks: - id: codespell additional_dependencies: [tomli] #args: ["--write-changes"] - repo: https://github.com/JoC0de/pre-commit-prettier - rev: v3.6.2 # v3.6.2 using SHA as tags are not persistent + rev: v3.9.6 # v3.6.2 using SHA as tags are not persistent hooks: - id: prettier files: \.(json|yml|yaml|toml) @@ -43,7 +43,7 @@ repos: args: ["--print-width=120"] - repo: https://github.com/executablebooks/mdformat - rev: 0.7.22 + rev: 1.0.0 hooks: - id: mdformat args: ["--number"] @@ -54,7 +54,7 @@ repos: exclude: CHANGELOG.md - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.13.3 + rev: v0.16.6 hooks: - id: ruff args: ["--fix"] diff --git a/README.md b/README.md index 4a8fd3e..bb8f1a9 100644 --- a/README.md +++ b/README.md @@ -138,12 +138,10 @@ from tensorflow import keras from litmodels import save_model # Define the model -model = keras.Sequential( - [ - keras.layers.Dense(10, input_shape=(784,), name="dense_1"), - keras.layers.Dense(10, name="dense_2"), - ] -) +model = keras.Sequential([ + keras.layers.Dense(10, input_shape=(784,), name="dense_1"), + keras.layers.Dense(10, name="dense_2"), +]) # Compile the model model.compile(optimizer="adam", loss="categorical_crossentropy") @@ -157,9 +155,7 @@ Load model: ```python from litmodels import load_model -model_ = load_model( - "lightning-ai/jirka/sample-tf-keras-model", download_dir="./my-model" -) +model_ = load_model("lightning-ai/jirka/sample-tf-keras-model", download_dir="./my-model") ``` @@ -178,9 +174,7 @@ iris = datasets.load_iris() X, y = iris.data, iris.target # Split dataset into training and test sets -X_train, X_test, y_train, y_test = model_selection.train_test_split( - X, y, test_size=0.2, random_state=42 -) +X_train, X_test, y_train, y_test = model_selection.train_test_split(X, y, test_size=0.2, random_state=42) # Train a simple SVC model model = svm.SVC() @@ -196,9 +190,7 @@ Use model: from litmodels import load_model # Download and load the model file from cloud storage -model = load_model( - name="your_org/your_team/sklearn-svm-model", download_dir="my_models" -) +model = load_model(name="your_org/your_team/sklearn-svm-model", download_dir="my_models") # Example: run inference with the loaded model sample_input = [[5.1, 3.5, 1.4, 0.2]]