[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
d7482e8b23
commit
ca7779872f
2 changed files with 26 additions and 14 deletions
|
|
@ -22,14 +22,22 @@ import logging
|
|||
import textwrap
|
||||
|
||||
# We cannot do from unsloth_zoo.log import logger since FBGEMM might cause seg faults.
|
||||
UNSLOTH_ENABLE_LOGGING = os.environ.get("UNSLOTH_ENABLE_LOGGING", "0") in ("1", "True", "true",)
|
||||
UNSLOTH_ENABLE_LOGGING = os.environ.get("UNSLOTH_ENABLE_LOGGING", "0") in (
|
||||
"1",
|
||||
"True",
|
||||
"true",
|
||||
)
|
||||
logger = logging.getLogger(__name__)
|
||||
if UNSLOTH_ENABLE_LOGGING:
|
||||
logging.basicConfig(level = logging.INFO, format = '[%(name)s|%(levelname)s]%(message)s')
|
||||
logging.basicConfig(
|
||||
level = logging.INFO, format = "[%(name)s|%(levelname)s]%(message)s"
|
||||
)
|
||||
logger.setLevel(logging.INFO)
|
||||
else:
|
||||
logging.basicConfig(level = logging.WARNING, format = '[%(name)s|%(levelname)s]%(message)s')
|
||||
logger.setLevel(logging.WARNING)
|
||||
logging.basicConfig(
|
||||
level = logging.WARNING, format = "[%(name)s|%(levelname)s]%(message)s"
|
||||
)
|
||||
logger.setLevel(logging.WARNING)
|
||||
|
||||
|
||||
def Version(version):
|
||||
|
|
@ -118,7 +126,9 @@ def fix_xformers_performance_issue():
|
|||
if Version(xformers_version) < Version("0.0.29"):
|
||||
xformers_location = importlib.util.find_spec("xformers").origin
|
||||
if xformers_location is None:
|
||||
xformers_location = importlib.util.find_spec("xformers").submodule_search_locations[0]
|
||||
xformers_location = importlib.util.find_spec(
|
||||
"xformers"
|
||||
).submodule_search_locations[0]
|
||||
else:
|
||||
xformers_location = os.path.split(xformers_location)[0]
|
||||
cutlass = Path(xformers_location) / "ops" / "fmha" / "cutlass.py"
|
||||
|
|
@ -150,7 +160,9 @@ def fix_vllm_aimv2_issue():
|
|||
if Version(vllm_version) < Version("0.10.1"):
|
||||
vllm_version = importlib.util.find_spec("vllm").origin
|
||||
if vllm_version is None:
|
||||
vllm_version = importlib.util.find_spec("vllm").submodule_search_locations[0]
|
||||
vllm_version = importlib.util.find_spec("vllm").submodule_search_locations[
|
||||
0
|
||||
]
|
||||
else:
|
||||
vllm_version = os.path.split(vllm_version)[0]
|
||||
ovis_config = Path(vllm_version) / "transformers_utils" / "configs" / "ovis.py"
|
||||
|
|
@ -440,7 +452,9 @@ def fix_executorch():
|
|||
return
|
||||
executorch_location = importlib.util.find_spec("executorch").origin
|
||||
if executorch_location is None:
|
||||
executorch_location = importlib.util.find_spec("executorch").submodule_search_locations[0]
|
||||
executorch_location = importlib.util.find_spec(
|
||||
"executorch"
|
||||
).submodule_search_locations[0]
|
||||
else:
|
||||
executorch_location = os.path.split(executorch_location)[0]
|
||||
executorch = Path(executorch_location) / "examples" / "models" / "__init__.py"
|
||||
|
|
@ -448,7 +462,7 @@ def fix_executorch():
|
|||
return
|
||||
|
||||
try:
|
||||
what = r'''
|
||||
what = r"""
|
||||
import sys
|
||||
import types
|
||||
import re
|
||||
|
|
@ -483,9 +497,9 @@ def fix_executorch():
|
|||
sys.modules["torchtune"] = torchtune
|
||||
sys.modules["torchtune.models"] = models
|
||||
sys.modules["torchtune.models.convert_weights"] = convert_weights
|
||||
'''
|
||||
"""
|
||||
what = textwrap.dedent(what)
|
||||
|
||||
|
||||
with open(executorch, "r+", encoding = "utf-8") as f:
|
||||
text = f.read()
|
||||
bad = "from enum import Enum\n"
|
||||
|
|
@ -494,8 +508,6 @@ def fix_executorch():
|
|||
f.seek(0)
|
||||
f.write(text)
|
||||
f.truncate()
|
||||
logger.info(
|
||||
"Unsloth: Patching Executorch to fix get_mapped_key"
|
||||
)
|
||||
logger.info("Unsloth: Patching Executorch to fix get_mapped_key")
|
||||
except Exception as e:
|
||||
logger.info(f"Unsloth: Failed Executorch with error = {str(e)}")
|
||||
|
|
|
|||
|
|
@ -741,7 +741,7 @@ def _patch_trl_rl_trainers(trainer_file = "grpo_trainer"):
|
|||
"generation_kwargs": {},
|
||||
"bf16": False,
|
||||
"fp16": False,
|
||||
"report_to" : "none",
|
||||
"report_to": "none",
|
||||
"include_tokens_per_second": False,
|
||||
"include_num_input_tokens_seen": False,
|
||||
"auto_find_batch_size": False, # Auto /2 batch size - too many people complained so removing
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue