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
6b5dc29f
Unverified
Commit
6b5dc29f
authored
Dec 08, 2023
by
Casper
Committed by
GitHub
Dec 08, 2023
Browse files
Load on CPU to avoid OOM (#236)
parent
5eb1d2f0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
20 deletions
+0
-20
awq/models/base.py
awq/models/base.py
+0
-20
No files found.
awq/models/base.py
View file @
6b5dc29f
...
@@ -115,26 +115,6 @@ class BaseAWQForCausalLM(nn.Module):
...
@@ -115,26 +115,6 @@ class BaseAWQForCausalLM(nn.Module):
self
,
model_path
,
''
,
safetensors
,
trust_remote_code
=
trust_remote_code
self
,
model_path
,
''
,
safetensors
,
trust_remote_code
=
trust_remote_code
)
)
if
device_map
is
None
:
with
init_empty_weights
():
model
=
AutoModelForCausalLM
.
from_config
(
config
=
config
,
torch_dtype
=
torch_dtype
,
trust_remote_code
=
trust_remote_code
)
# Evenly distribute memory on GPUs
max_memory
=
get_balanced_memory
(
model
,
no_split_module_classes
=
[
self
.
layer_type
],
dtype
=
torch_dtype
)
# Get device map
device_map
=
infer_auto_device_map
(
model
,
max_memory
=
max_memory
,
no_split_module_classes
=
[
self
.
layer_type
],
dtype
=
torch_dtype
)
del
model
# If not quantized, must load with AutoModelForCausalLM
# If not quantized, must load with AutoModelForCausalLM
model
=
AutoModelForCausalLM
.
from_pretrained
(
model
=
AutoModelForCausalLM
.
from_pretrained
(
model_weights_path
,
model_weights_path
,
...
...
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