[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
c7d5f1569c
commit
f23735af0a
2 changed files with 10 additions and 4 deletions
|
|
@ -101,7 +101,9 @@ if os.environ.get("UNSLOTH_ENABLE_LOGGING", "0") != "1":
|
|||
# Skipping import of cpp extensions due to incompatible torch version 2.9.0+cu128 for torchao version 0.15.0
|
||||
logging.getLogger("torchao").setLevel(logging.ERROR)
|
||||
# SyntaxWarning: invalid escape sequence '\.'
|
||||
warnings.filterwarnings("ignore", message = "invalid escape sequence", category = SyntaxWarning)
|
||||
warnings.filterwarnings(
|
||||
"ignore", message = "invalid escape sequence", category = SyntaxWarning
|
||||
)
|
||||
|
||||
|
||||
# Fix up AttributeError: 'MessageFactory' object has no attribute 'GetPrototype'
|
||||
|
|
@ -549,5 +551,8 @@ def fix_diffusers_warnings():
|
|||
def fix_huggingface_hub():
|
||||
# huggingface_hub.is_offline_mode got removed, so add it back
|
||||
import huggingface_hub
|
||||
|
||||
if not hasattr(huggingface_hub, "is_offline_mode"):
|
||||
huggingface_hub.is_offline_mode = lambda: huggingface_hub.constants.HF_HUB_OFFLINE
|
||||
huggingface_hub.is_offline_mode = (
|
||||
lambda: huggingface_hub.constants.HF_HUB_OFFLINE
|
||||
)
|
||||
|
|
|
|||
|
|
@ -2386,6 +2386,7 @@ def make_fast_generate_wrapper(original_generate):
|
|||
Creates a wrapper around model.generate that checks for incorrect
|
||||
vLLM-style usage when fast_inference=False.
|
||||
"""
|
||||
|
||||
@functools.wraps(original_generate)
|
||||
def _fast_generate_wrapper(*args, **kwargs):
|
||||
# Check for vLLM-specific arguments
|
||||
|
|
@ -2419,9 +2420,9 @@ def make_fast_generate_wrapper(original_generate):
|
|||
"when `fast_inference=True` (vLLM). Since `fast_inference=False`, you must "
|
||||
"tokenize the input first:\n\n"
|
||||
" messages = tokenizer.apply_chat_template(\n"
|
||||
" [{\"role\": \"user\", \"content\": \"Your prompt here\"}],\n"
|
||||
' [{"role": "user", "content": "Your prompt here"}],\n'
|
||||
" tokenize=True, add_generation_prompt=True,\n"
|
||||
" return_tensors=\"pt\", return_dict=True\n"
|
||||
' return_tensors="pt", return_dict=True\n'
|
||||
" )\n"
|
||||
" output = model.fast_generate(\n"
|
||||
" **messages.to('cuda'),\n"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue