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
c9bae84e
"vscode:/vscode.git/clone" did not exist on "077a5dce32a4be4bf92231a5832989b8bd77bd1b"
Unverified
Commit
c9bae84e
authored
Aug 29, 2023
by
Sourab Mangrulkar
Committed by
GitHub
Aug 29, 2023
Browse files
Resolving Attribute error when using the FSDP ram efficient feature (#25820)
fix bug
parent
77713d11
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
src/transformers/modeling_utils.py
src/transformers/modeling_utils.py
+2
-2
No files found.
src/transformers/modeling_utils.py
View file @
c9bae84e
...
@@ -3574,11 +3574,11 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin, GenerationMixin, PushToHubMix
...
@@ -3574,11 +3574,11 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin, GenerationMixin, PushToHubMix
if
param
.
device
==
torch
.
device
(
"meta"
):
if
param
.
device
==
torch
.
device
(
"meta"
):
if
not
(
is_quantized
):
if
not
(
is_quantized
):
set_module_tensor_to_device
(
set_module_tensor_to_device
(
model
,
key
,
"cpu"
,
torch
.
empty
(
*
param
.
size
(),
dtype
=
dtype
)
model
_to_load
,
key
,
"cpu"
,
torch
.
empty
(
*
param
.
size
(),
dtype
=
dtype
)
)
)
else
:
else
:
set_module_quantized_tensor_to_device
(
set_module_quantized_tensor_to_device
(
model
,
key
,
"cpu"
,
torch
.
empty
(
*
param
.
size
(),
dtype
=
dtype
)
model
_to_load
,
key
,
"cpu"
,
torch
.
empty
(
*
param
.
size
(),
dtype
=
dtype
)
)
)
else
:
else
:
error_msgs
+=
_load_state_dict_into_model
(
model_to_load
,
state_dict
,
start_prefix
)
error_msgs
+=
_load_state_dict_into_model
(
model_to_load
,
state_dict
,
start_prefix
)
...
...
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