Giter Site home page Giter Site logo

Comments (3)

ultranity avatar ultranity commented on May 20, 2024

And now there is no direct method to load full dcp saved state dict as torch.load does, while finding there is a dcp_to_torch_save impl. in dcp.format_utils, maybe we can make is better accessable by adding a function like dcp_to_torch_save but just return the state_dict? for example:

def dcp_load(
    dcp_checkpoint_dir: Union[str, os.PathLike],
    no_dist=True,
):
    """
    Given a directory containing a DCP checkpoint, this function will load it into a
    state dict and return it as torch.load does.

    Args:
        dcp_checkpoint_dir: Directory containing the DCP checkpoint.

    .. warning::
        To avoid OOM, it's recommended to only run this function on a single rank.
    """
    sd: STATE_DICT_TYPE = {}

    _load_state_dict(
        sd,
        storage_reader=FileSystemReader(dcp_checkpoint_dir),
        planner=_EmptyStateDictLoadPlanner(),
        no_dist=no_dist,
    )
    return sd

by using this method we can check that dcp.async_save do save other values (state_dict['epoch']==20 in that case), but dcp.load is not updating the dict

from pytorch.

fegin avatar fegin commented on May 20, 2024

cc., @LucasLLC

from pytorch.

LucasLLC avatar LucasLLC commented on May 20, 2024

Looking into this, thanks @ultranity

from pytorch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.