Adding arg to pass process rank to `map`
{'login': 'TevenLeScao', 'id': 26709476, 'node_id': 'MDQ6VXNlcjI2NzA5NDc2', 'avatar_url': 'https://avatars.githubusercontent.com/u/26709476?v=4', 'gravatar_id': '', 'url': 'https://api.github.com/users/TevenLeScao', 'html_url': 'https://github.com/TevenLeScao', 'followers_url': 'https://api.github.com/users/TevenLeScao/followers', 'following_url': 'https://api.github.com/users/TevenLeScao/following{/other_user}', 'gists_url': 'https://api.github.com/users/TevenLeScao/gists{/gist_id}', 'starred_url': 'https://api.github.com/users/TevenLeScao/starred{/owner}{/repo}', 'subscriptions_url': 'https://api.github.com/users/TevenLeScao/subscriptions', 'organizations_url': 'https://api.github.com/users/TevenLeScao/orgs', 'repos_url': 'https://api.github.com/users/TevenLeScao/repos', 'events_url': 'https://api.github.com/users/TevenLeScao/events{/privacy}', 'received_events_url': 'https://api.github.com/users/TevenLeScao/received_events', 'type': 'User', 'site_admin': False}
[]
[]
Some commits seem to be there twice (made the mistake of rebasing because I wasn't sure whether the doc had changed), is this an issue @lhoestq ?
This PR adds a `with_rank` argument to `map` that gives the user the possibility to pass the rank of each process to their function. This is mostly designed for multi-GPU map (each process can be sent to a different device thanks to the rank). I've also added tests. I'm putting the PR up so you can check the code, I'll add a multi-GPU example to the doc (+ write a bit in the doc for the new arg)
{'url': 'https://api.github.com/repos/huggingface/datasets/issues/3314/reactions', 'total_count': 0, '+1': 0, '-1': 0, 'laugh': 0, 'hooray': 0, 'confused': 0, 'heart': 0, 'rocket': 0, 'eyes': 0}
{'url': 'https://api.github.com/repos/huggingface/datasets/pulls/3314', 'html_url': 'https://github.com/huggingface/datasets/pull/3314', 'diff_url': 'https://github.com/huggingface/datasets/pull/3314.diff', 'patch_url': 'https://github.com/huggingface/datasets/pull/3314.patch', 'merged_at': '2021-11-24T11:54:13Z'}