How to skip a example when running dataset.map
{'login': 'xixiaoyao', 'id': 24541791, 'node_id': 'MDQ6VXNlcjI0NTQxNzkx', 'avatar_url': 'https://avatars.githubusercontent.com/u/24541791?v=4', 'gravatar_id': '', 'url': 'https://api.github.com/users/xixiaoyao', 'html_url': 'https://github.com/xixiaoyao', 'followers_url': 'https://api.github.com/users/xixiaoyao/followers', 'following_url': 'https://api.github.com/users/xixiaoyao/following{/other_user}', 'gists_url': 'https://api.github.com/users/xixiaoyao/gists{/gist_id}', 'starred_url': 'https://api.github.com/users/xixiaoyao/starred{/owner}{/repo}', 'subscriptions_url': 'https://api.github.com/users/xixiaoyao/subscriptions', 'organizations_url': 'https://api.github.com/users/xixiaoyao/orgs', 'repos_url': 'https://api.github.com/users/xixiaoyao/repos', 'events_url': 'https://api.github.com/users/xixiaoyao/events{/privacy}', 'received_events_url': 'https://api.github.com/users/xixiaoyao/received_events', 'type': 'User', 'site_admin': False}
[]
[]
Hi @xixiaoyao,
Depending on what you want to do you can:
- use a first step of `filter` to filter out the invalid examples: https://huggingface.co/docs/datasets/processing.html#filtering-rows-select-and-filter
- or directly detect the invalid examples inside the callable used with `map` and return them unchanged or even remove them at the same time if you are using `map` in batched mode. Here is an example where we use `map` in batched mode to add new rows on the fly but you can also use it to remove examples on the fly (that's what `filter` actually do under-the-hood): https://huggingface.co/docs/datasets/processing.html#augmenting-the-dataset Closing this one.
Feel free to re-open if you have other questions Letting finders-of-this-thread know that the new link is: https://huggingface.co/docs/datasets/process#data-augmentation

in processing func, I process examples and detect some invalid examples, which I did not want it to be added into train dataset. However I did not find how to skip this recognized invalid example when doing dataset.map. 
{'url': 'https://api.github.com/repos/huggingface/datasets/issues/669/reactions', 'total_count': 0, '+1': 0, '-1': 0, 'laugh': 0, 'hooray': 0, 'confused': 0, 'heart': 0, 'rocket': 0, 'eyes': 0}