Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
8d8ac9c2
Unverified
Commit
8d8ac9c2
authored
Feb 29, 2024
by
Younes Belkada
Committed by
GitHub
Feb 29, 2024
Browse files
FIX [`CI`]: Fix failing tests for peft integration (#29330)
fix failing tests for peft integration
parent
1aee9afd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
1 deletion
+11
-1
tests/peft_integration/test_peft_integration.py
tests/peft_integration/test_peft_integration.py
+11
-1
No files found.
tests/peft_integration/test_peft_integration.py
View file @
8d8ac9c2
...
@@ -19,7 +19,14 @@ import unittest
...
@@ -19,7 +19,14 @@ import unittest
from
huggingface_hub
import
hf_hub_download
from
huggingface_hub
import
hf_hub_download
from
transformers
import
AutoModelForCausalLM
,
OPTForCausalLM
from
transformers
import
AutoModelForCausalLM
,
OPTForCausalLM
from
transformers.testing_utils
import
require_peft
,
require_torch
,
require_torch_gpu
,
slow
,
torch_device
from
transformers.testing_utils
import
(
require_bitsandbytes
,
require_peft
,
require_torch
,
require_torch_gpu
,
slow
,
torch_device
,
)
from
transformers.utils
import
is_torch_available
from
transformers.utils
import
is_torch_available
...
@@ -335,6 +342,7 @@ class PeftIntegrationTester(unittest.TestCase, PeftTesterMixin):
...
@@ -335,6 +342,7 @@ class PeftIntegrationTester(unittest.TestCase, PeftTesterMixin):
model
.
save_pretrained
(
tmpdirname
)
model
.
save_pretrained
(
tmpdirname
)
@
require_torch_gpu
@
require_torch_gpu
@
require_bitsandbytes
def
test_peft_from_pretrained_kwargs
(
self
):
def
test_peft_from_pretrained_kwargs
(
self
):
"""
"""
Simple test that tests the basic usage of PEFT model through `from_pretrained` + additional kwargs
Simple test that tests the basic usage of PEFT model through `from_pretrained` + additional kwargs
...
@@ -352,6 +360,7 @@ class PeftIntegrationTester(unittest.TestCase, PeftTesterMixin):
...
@@ -352,6 +360,7 @@ class PeftIntegrationTester(unittest.TestCase, PeftTesterMixin):
_
=
peft_model
.
generate
(
input_ids
=
torch
.
LongTensor
([[
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
]]).
to
(
torch_device
))
_
=
peft_model
.
generate
(
input_ids
=
torch
.
LongTensor
([[
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
]]).
to
(
torch_device
))
@
require_torch_gpu
@
require_torch_gpu
@
require_bitsandbytes
def
test_peft_save_quantized
(
self
):
def
test_peft_save_quantized
(
self
):
"""
"""
Simple test that tests the basic usage of PEFT model save_pretrained with quantized base models
Simple test that tests the basic usage of PEFT model save_pretrained with quantized base models
...
@@ -390,6 +399,7 @@ class PeftIntegrationTester(unittest.TestCase, PeftTesterMixin):
...
@@ -390,6 +399,7 @@ class PeftIntegrationTester(unittest.TestCase, PeftTesterMixin):
self
.
assertTrue
(
"model.safetensors"
not
in
os
.
listdir
(
tmpdirname
))
self
.
assertTrue
(
"model.safetensors"
not
in
os
.
listdir
(
tmpdirname
))
@
require_torch_gpu
@
require_torch_gpu
@
require_bitsandbytes
def
test_peft_save_quantized_regression
(
self
):
def
test_peft_save_quantized_regression
(
self
):
"""
"""
Simple test that tests the basic usage of PEFT model save_pretrained with quantized base models
Simple test that tests the basic usage of PEFT model save_pretrained with quantized base models
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment