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
OpenDAS
AutoAWQ
Commits
435b3b4b
Commit
435b3b4b
authored
Sep 15, 2023
by
Casper Hansen
Browse files
Default to empty string for model file
parent
720a1fce
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
4 deletions
+7
-4
awq/models/auto.py
awq/models/auto.py
+1
-1
awq/models/base.py
awq/models/base.py
+6
-3
No files found.
awq/models/auto.py
View file @
435b3b4b
...
...
@@ -35,7 +35,7 @@ class AutoAWQForCausalLM:
)
@
classmethod
def
from_quantized
(
self
,
quant_path
,
quant_filename
=
'
pytorch_model.bin
'
,
max_new_tokens
=
None
,
def
from_quantized
(
self
,
quant_path
,
quant_filename
=
''
,
max_new_tokens
=
None
,
device
=
'balanced'
,
trust_remote_code
=
True
,
fuse_layers
=
True
,
batch_size
=
1
,
safetensors
=
False
)
->
BaseAWQForCausalLM
:
os
.
environ
[
"AWQ_BATCH_SIZE"
]
=
str
(
batch_size
)
...
...
awq/models/base.py
View file @
435b3b4b
...
...
@@ -284,7 +284,7 @@ class BaseAWQForCausalLM(nn.Module):
)
@
classmethod
def
from_quantized
(
self
,
model_path
,
model_type
,
model_filename
=
'
pytorch_model.bin
'
,
def
from_quantized
(
self
,
model_path
,
model_type
,
model_filename
=
''
,
max_new_tokens
=
None
,
device
=
'balanced'
,
torch_dtype
=
torch
.
float16
,
trust_remote_code
=
True
,
safetensors
=
False
,
is_quantized
=
True
,
fuse_layers
=
False
,
version
=
'GEMM'
):
...
...
@@ -298,7 +298,10 @@ class BaseAWQForCausalLM(nn.Module):
model_path
=
snapshot_download
(
model_path
,
ignore_patterns
=
ignore_patterns
)
model_weights_path
=
model_path
+
f
'/
{
model_filename
}
'
if
model_filename
!=
''
:
model_weights_path
=
model_path
+
f
'/
{
model_filename
}
'
else
:
model_weights_path
=
model_path
# [STEP 2] Load config and set sequence length
# TODO: Create BaseAWQConfig class
...
...
@@ -343,7 +346,7 @@ class BaseAWQForCausalLM(nn.Module):
if
is_quantized
:
load_checkpoint_in_model
(
model
,
checkpoint
=
model_path
if
safetensors
else
model_weights_path
,
checkpoint
=
model_weights_path
,
device_map
=
device_map
)
...
...
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