File tree Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change 3
3
4
4
import pytest
5
5
import torch
6
- import transformers
7
- from transformers import (
8
- AutoModelForCausalLM ,
9
- BitsAndBytesConfig ,
10
- )
11
6
12
7
from tests .helpers import TRUE_FALSE , describe_dtype , id_formatter
13
8
9
+ transformers = pytest .importorskip ("transformers" )
10
+
14
11
15
12
def get_4bit_config ():
16
- return BitsAndBytesConfig (
13
+ return transformers . BitsAndBytesConfig (
17
14
load_in_4bit = True ,
18
15
load_in_8bit = False ,
19
16
llm_int8_threshold = 6.0 ,
@@ -31,7 +28,7 @@ def get_model_and_tokenizer(config):
31
28
bnb_config .load_in_4bit = False
32
29
else :
33
30
bnb_config .bnb_4bit_quant_type = quant_type
34
- model = AutoModelForCausalLM .from_pretrained (model_name_or_path ,
31
+ model = transformers . AutoModelForCausalLM .from_pretrained (model_name_or_path ,
35
32
quantization_config = bnb_config ,
36
33
max_memory = {0 :'48GB' },
37
34
device_map = 'auto' ,
You can’t perform that action at this time.
0 commit comments