Skip to content

Commit

Permalink
activate workflow and some more lint fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Yu Chin Fabian Lim <[email protected]>
  • Loading branch information
fabianlim committed May 28, 2024
1 parent 21b87f5 commit c288268
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 9 deletions.
1 change: 1 addition & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
plugin_name:
- "framework"
- "accelerated-peft"
- "fused-ops-and-kernels"

steps:
- uses: actions/checkout@v4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ def log_patch_summary(
# this is a guarded import, because the model rule registration
# does not need to be loaded unless patch_model is required
# Local
from .models.model_patcher import patch_model_summary #pylint: disable=import-outside-toplevel
from .models.model_patcher import ( # pylint: disable=import-outside-toplevel
patch_model_summary,
)

for line in patch_model_summary().split("\n"):
logging_func(line)
Expand Down Expand Up @@ -120,12 +122,16 @@ def augmentation(
# this is a guarded import, because the model rule registration
# does not need to be loaded unless patch_model is required
# Local
from .models.model_patcher import patch_model #pylint: disable=import-outside-toplevel
from .models.model_patcher import ( # pylint: disable=import-outside-toplevel
patch_model,
)

model = patch_model(model, base_type=self._base_layer)
return model, modifiable_args

def get_callbacks_and_ready_for_train(self, model: torch.nn.Module = None, accelerator = None):
def get_callbacks_and_ready_for_train(
self, model: torch.nn.Module = None, accelerator=None
):

# if this is moved to framework, it can be handled as the same way as
# log_initialization_message
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

# Standard
from dataclasses import asdict, dataclass
from enum import Enum
from types import MethodType
from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Type, Union
import importlib
Expand All @@ -23,9 +24,6 @@
import pandas as pd
import torch

# Standard
from enum import Enum

# ------------------------ helpers -----------------------


Expand Down Expand Up @@ -106,7 +104,7 @@ def is_triggered(
# the function call may raise
if self.type == ModelPatcherTriggerType.callable and self.check(module):
return True
except Exception: # pylint: disable=broad-exception-caught
except Exception: # pylint: disable=broad-exception-caught
# NOTE: not sure if its good idea to let the exception pass through
pass

Expand Down
13 changes: 13 additions & 0 deletions plugins/fused-ops-and-kernels/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright The FMS HF Tuning Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
4 changes: 2 additions & 2 deletions plugins/fused-ops-and-kernels/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ description = run linters
deps =
-e {toxinidir}/../framework
pylint>=2.16.2,<=3.1.0
commands = pylint src # tests # activate tests later
commands = pylint src tests
allowlist_externals = pylint

[testenv:fmt]
Expand All @@ -23,7 +23,7 @@ deps =
commands =
# exclude the code ported from unsloth
black --exclude .*unsloth.* src
# black --exclude .*unsloth.* tests # activate this later
black --exclude .*unsloth.* tests
isort .

# [testenv:build]
Expand Down

0 comments on commit c288268

Please sign in to comment.