Loading weights straight to GPU only works for inference

Open
#2,028 8 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
python

Research direction

Start with the official example scripts in the examples/ folder, including the supported no_trainer scripts such as run_no_trainer_glue.py, and review the documented weight-loading path. Verify the behavior for training in both single-GPU and multi-GPU cases; done means weights can load directly to the GPU for both configurations.

Written by the indexing model from the issue text.

Description

enhancement feature request
System Info
accelerate v0.22.0
Information
  • The official example scripts
  • My own modified scripts
Tasks
  • One of the scripts in the examples/ folder of Accelerate or an officially supported no_trainer script in the examples folder of the transformers repo (such as run_no_trainer_glue.py)
  • My own task or dataset (give details below)
Reproduction

Going through the doc, accelerate currently does not seem to support loading weights straight to the GPU if the model is to be used for training. If this is correct, are there any plans to support this in the future?

Expected behavior

It would be nice to be able to load weights straight to GPU when training, and to be able to do this either in the single or multi-gpu case.

Dominant language
Python
Stars
9.9k
Forks
1.6k
Avg merge
20h 23m
Merged PRs (30d)
12

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from huggingface/accelerate

All issues in huggingface/accelerate

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.