GithubHelp home page GithubHelp logo

test-mass-forker-org-1 / partiallyshuffledistributedsampler Goto Github PK

View Code? Open in Web Editor NEW

This project forked from microsoft/partiallyshuffledistributedsampler

0.0 0.0 0.0 18 KB

License: MIT License

Python 100.00%

partiallyshuffledistributedsampler's Introduction

PartiallyShuffle

This repo includes 2 versions of distribute sampler with Partially Shuffle for Pytorch. They are designed to replace DistributedSampler.py in Pytorch.

These samplers will try to distribute files evenly to available GPUs, and use cache and threads to reduce the number of file reads, which is friendly to distributed storage system, such as HDFS.

DistributedSamplerViaLocallyShuffle.py is a simpler verison which only have one shuffle pool.

DistributedSamplerViaLocallyShuffleV2.py has two shuffle pools and similier process like the Partially Shuffle in TensorFlow.

Usage

You can use it just like DistributedSampler in Pytorch with some extra hyper-parameters.

The hyper-parameter reader is used to read the file before the dataloader to prevent reading a file too many times. Previous design in Pytorch will try to read the file every time when it generate a batch.

The file reader should be designed like this:

    def file_reader():
        def npz_reader(filename, get_data=False):
            ori_data = np.load(filename)
            data = dict()
            l = 0
            for key in ori_data.keys():
                data[key] = ori_data[key]
                if l == 0:
                    l = len(data[key])
                if not get_data:
                    return l
            return data, l
        return npz_reader

The files_len is a dict with <filename, samples> pairs. It will accelerate the initailization of sampler.

This work is done in Microsoft Ads team. For more information, you can connect [email protected].

partiallyshuffledistributedsampler's People

Contributors

microsoftopensource avatar zjianjin avatar

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.