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
7b18702c
Unverified
Commit
7b18702c
authored
Jul 04, 2022
by
Lysandre Debut
Committed by
GitHub
Jul 04, 2022
Browse files
Add link to existing documentation (#17931)
parent
a045cbd6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
11 deletions
+2
-11
docs/source/en/big_models.mdx
docs/source/en/big_models.mdx
+2
-11
No files found.
docs/source/en/big_models.mdx
View file @
7b18702c
...
@@ -114,15 +114,6 @@ If you want to directly load such a sharded checkpoint inside a model without us
...
@@ -114,15 +114,6 @@ If you want to directly load such a sharded checkpoint inside a model without us
##
Low
memory
loading
##
Low
memory
loading
Sharded
checkpoints
reduce
the
memory
usage
during
step
2
of
the
worflow
mentioned
above
,
but
when
loadin
a
pretrained
model
,
why
keep
the
random
weights
in
memory
?
The
option
`
low_cpu_mem_usage
`
will
destroy
the
weights
of
the
randomly
initialized
model
,
then
progressively
load
the
weights
inside
,
then
perform
a
random
initialization
for
potential
missing
weights
(
if
you
are
loadding
a
model
with
a
newly
initialized
head
for
a
fine
-
tuning
task
for
instance
).
Sharded
checkpoints
reduce
the
memory
usage
during
step
2
of
the
workflow
mentioned
above
,
but
in
order
to
use
that
model
in
a
low
memory
setting
,
we
recommend
leveraging
our
tools
based
on
the
Accelerate
library
.
It
's very easy to use, just add `low_cpu_mem_usage=True` to your call to [`~PreTrainedModel.from_pretrained`]:
```py
from transformers import AutoModelForSequenceClas
model = AutoModel.from_pretrained("bert-base-cased", low_cpu_mem_usage=True)
```
This can be used in conjunction with a sharded checkpoint.
Please
read
the
following
guide
for
more
information
:
[
Large
model
loading
using
Accelerate
](./
main_classes
/
model
#
large
-
model
-
loading
)
\ No newline at end of file
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