Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
bitsandbytes
Commits
62249b4a
Commit
62249b4a
authored
Mar 08, 2024
by
Aarni Koskela
Committed by
Titus
Mar 11, 2024
Browse files
Soft-require `transformers` in tests
parent
782ab96e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
7 deletions
+4
-7
tests/test_generation.py
tests/test_generation.py
+4
-7
No files found.
tests/test_generation.py
View file @
62249b4a
...
...
@@ -3,17 +3,14 @@ import math
import
pytest
import
torch
import
transformers
from
transformers
import
(
AutoModelForCausalLM
,
BitsAndBytesConfig
,
)
from
tests.helpers
import
TRUE_FALSE
,
describe_dtype
,
id_formatter
transformers
=
pytest
.
importorskip
(
"transformers"
)
def
get_4bit_config
():
return
BitsAndBytesConfig
(
return
transformers
.
BitsAndBytesConfig
(
load_in_4bit
=
True
,
load_in_8bit
=
False
,
llm_int8_threshold
=
6.0
,
...
...
@@ -31,7 +28,7 @@ def get_model_and_tokenizer(config):
bnb_config
.
load_in_4bit
=
False
else
:
bnb_config
.
bnb_4bit_quant_type
=
quant_type
model
=
AutoModelForCausalLM
.
from_pretrained
(
model_name_or_path
,
model
=
transformers
.
AutoModelForCausalLM
.
from_pretrained
(
model_name_or_path
,
quantization_config
=
bnb_config
,
max_memory
=
{
0
:
'48GB'
},
device_map
=
'auto'
,
...
...
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