run_ner.py raised error
Author: gongel
Pull request: no

## Environment info
<!-- You can run the command `transformers-cli env` and copy-and-paste its output below.
     Don't forget to fill out the missing fields in that output! -->

- `transformers` version: 4.3.0.dev0
- Platform: MacOS
- Python version: 3.6
- PyTorch version (GPU?):   1.7.1
- Tensorflow version (GPU?): 2.4.1
- Using GPU in script?: No
- Using distributed or parallel set-up in script?: No

### Who can help

Examples:

- maintained examples (not research project or legacy): @sgugger, @patil-suraj


## To reproduce

Steps to reproduce the behavior:

1. bash [run.sh](https://github.com/huggingface/transformers/blob/master/examples/token-classification/run.sh) to [run_ner.py](https://github.com/huggingface/transformers/blob/master/examples/token-classification/run_ner.py)

## Error

```
ReferenceError: {'help': 'The name of the task (ner, pos...).'} does not reference a class __dict__
```

Comments:
I just ran `run.sh`, but did not see this error. Could you maybe post the full stack trace?

Hi @patil-suraj, thanks for replying. The full stack trace is posted below.
```
Traceback (most recent call last):
  File "run_origin.py", line 437, in <module>
    main()
  File "run_origin.py", line 310, in main
    load_from_cache_file=not data_args.overwrite_cache,
  File "/Users/bytedance/opt/anaconda3/lib/python3.6/site-packages/datasets/dataset_dict.py", line 303, in map
    for k, dataset in self.items()
  File "/Users/bytedance/opt/anaconda3/lib/python3.6/site-packages/datasets/dataset_dict.py", line 303, in <dictcomp>
    for k, dataset in self.items()
  File "/Users/bytedance/opt/anaconda3/lib/python3.6/site-packages/datasets/arrow_dataset.py", line 1259, in map
    update_data=update_data,
  File "/Users/bytedance/opt/anaconda3/lib/python3.6/site-packages/datasets/arrow_dataset.py", line 157, in wrapper
    out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs)
  File "/Users/bytedance/opt/anaconda3/lib/python3.6/site-packages/datasets/fingerprint.py", line 158, in wrapper
    self._fingerprint, transform, kwargs_for_fingerprint
  File "/Users/bytedance/opt/anaconda3/lib/python3.6/site-packages/datasets/fingerprint.py", line 105, in update_fingerprint
    hasher.update(transform_args[key])
  File "/Users/bytedance/opt/anaconda3/lib/python3.6/site-packages/datasets/fingerprint.py", line 57, in update
    self.m.update(self.hash(value).encode("utf-8"))
  File "/Users/bytedance/opt/anaconda3/lib/python3.6/site-packages/datasets/fingerprint.py", line 53, in hash
    return cls.hash_default(value)
  File "/Users/bytedance/opt/anaconda3/lib/python3.6/site-packages/datasets/fingerprint.py", line 46, in hash_default
    return cls.hash_bytes(dumps(value))
  File "/Users/bytedance/opt/anaconda3/lib/python3.6/site-packages/datasets/utils/py_utils.py", line 389, in dumps
    dump(obj, file)
  File "/Users/bytedance/opt/anaconda3/lib/python3.6/site-packages/datasets/utils/py_utils.py", line 361, in dump
    Pickler(file, recurse=True).dump(obj)
  File "/Users/bytedance/opt/anaconda3/lib/python3.6/pickle.py", line 409, in dump
    self.save(obj)
  File "/Users/bytedance/opt/anaconda3/lib/python3.6/pickle.py", line 476, in save
    f(self, obj) # Call unbound method with explicit self
  File "/Users/bytedance/opt/anaconda3/lib/python3.6/site-packages/datasets/utils/py_utils.py", line 556, in save_function
    obj=obj,
  File "/Users/bytedance/opt/anaconda3/lib/python3.6/pickle.py", line 610, in save_reduce
    save(args)
  File "/Users/bytedance/opt/anaconda3/lib/python3.6/pickle.py", line 476, in save
    f(self, obj) # Call unbound method with explicit self
  File "/Users/bytedance/opt/anaconda3/lib/python3.6/pickle.py", line 751, in save_tuple
    save(element)
  File "/Users/bytedance/opt/anaconda3/lib/python3.6/pickle.py", line 476, in save
    f(self, obj) # Call unbound method with explicit self
  File "/Users/bytedance/opt/anaconda3/lib/python3.6/pickle.py", line 751, in save_tuple
    save(element)
  File "/Users/bytedance/opt/anaconda3/lib/python3.6/pickle.py", line 476, in save
    f(self, obj) # Call unbound method with explicit self
  File "/Users/bytedance/opt/anaconda3/lib/python3.6/site-packages/dill/_dill.py", line 1129, in save_cell
    pickler.save_reduce(_create_cell, (f,), obj=obj)
  File "/Users/bytedance/opt/anaconda3/lib/python3.6/pickle.py", line 610, in save_reduce
    save(args)
  File "/Users/bytedance/opt/anaconda3/lib/python3.6/pickle.py", line 476, in save
    f(self, obj) # Call unbound method with explicit self
  File "/Users/bytedance/opt/anaconda3/lib/python3.6/pickle.py", line 736, in save_tuple
    save(element)
  File "/Users/bytedance/opt/anaconda3/lib/python3.6/pickle.py", line 521, in save
    self.save_reduce(obj=obj, *rv)
  File "/Users/bytedance/opt/anaconda3/lib/python3.6/pickle.py", line 605, in save_reduce
    save(cls)
  File "/Users/bytedance/opt/anaconda3/lib/python3.6/pickle.py", line 476, in save
    f(self, obj) # Call unbound method with explicit self
  File "/Users/bytedance/opt/anaconda3/lib/python3.6/site-packages/dill/_dill.py", line 1315, in save_type
    obj.__bases__, _dict), obj=obj)
  File "/Users/bytedance/opt/anaconda3/lib/python3.6/pickle.py", line 610, in save_reduce
    save(args)
  File "/Users/bytedance/opt/anaconda3/lib/python3.6/pickle.py", line 476, in save
    f(self, obj) # Call unbound method with explicit self
  File "/Users/bytedance/opt/anaconda3/lib/python3.6/pickle.py", line 751, in save_tuple
    save(element)
  File "/Users/bytedance/opt/anaconda3/lib/python3.6/pickle.py", line 476, in save
    f(self, obj) # Call unbound method with explicit self
  File "/Users/bytedance/opt/anaconda3/lib/python3.6/site-packages/dill/_dill.py", line 902, in save_module_dict
    StockPickler.save_dict(pickler, obj)
  File "/Users/bytedance/opt/anaconda3/lib/python3.6/pickle.py", line 821, in save_dict
    self._batch_setitems(obj.items())
  File "/Users/bytedance/opt/anaconda3/lib/python3.6/pickle.py", line 847, in _batch_setitems
    save(v)
  File "/Users/bytedance/opt/anaconda3/lib/python3.6/pickle.py", line 476, in save
    f(self, obj) # Call unbound method with explicit self
  File "/Users/bytedance/opt/anaconda3/lib/python3.6/site-packages/dill/_dill.py", line 902, in save_module_dict
    StockPickler.save_dict(pickler, obj)
  File "/Users/bytedance/opt/anaconda3/lib/python3.6/pickle.py", line 821, in save_dict
    self._batch_setitems(obj.items())
  File "/Users/bytedance/opt/anaconda3/lib/python3.6/pickle.py", line 847, in _batch_setitems
    save(v)
  File "/Users/bytedance/opt/anaconda3/lib/python3.6/pickle.py", line 521, in save
    self.save_reduce(obj=obj, *rv)
  File "/Users/bytedance/opt/anaconda3/lib/python3.6/pickle.py", line 634, in save_reduce
    save(state)
  File "/Users/bytedance/opt/anaconda3/lib/python3.6/pickle.py", line 476, in save
    f(self, obj) # Call unbound method with explicit self
  File "/Users/bytedance/opt/anaconda3/lib/python3.6/pickle.py", line 736, in save_tuple
    save(element)
  File "/Users/bytedance/opt/anaconda3/lib/python3.6/pickle.py", line 476, in save
    f(self, obj) # Call unbound method with explicit self
  File "/Users/bytedance/opt/anaconda3/lib/python3.6/site-packages/dill/_dill.py", line 902, in save_module_dict
    StockPickler.save_dict(pickler, obj)
  File "/Users/bytedance/opt/anaconda3/lib/python3.6/pickle.py", line 821, in save_dict
    self._batch_setitems(obj.items())
  File "/Users/bytedance/opt/anaconda3/lib/python3.6/pickle.py", line 847, in _batch_setitems
    save(v)
  File "/Users/bytedance/opt/anaconda3/lib/python3.6/pickle.py", line 476, in save
    f(self, obj) # Call unbound method with explicit self
  File "/Users/bytedance/opt/anaconda3/lib/python3.6/site-packages/dill/_dill.py", line 1148, in save_dictproxy
    raise ReferenceError("%s does not reference a class __dict__" % obj)
ReferenceError: {'help': 'The name of the task (ner, pos...).'} does not reference a class __dict__

```

looks like you are running your own script `run_origin.py`, so the issue is not with `run_ner.py`

Hey @gongel ,

could you confirm that you are really using latest 4.3 version :thinking: 

For me the example is working with`run_ner.sh`.

@patil-suraj, I just renamed run_ner.py to run_origin.py.

Hi @stefan-it , Yes
```
(base) C02D925LMD6R:transformers gong$ pip show transformers
Name: transformers
Version: 4.3.0.dev0
Summary: State-of-the-art Natural Language Processing for TensorFlow 2.0 and PyTorch
Home-page: https://github.com/huggingface/transformers
Author: Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumond, Sam Shleifer, Patrick von Platen, Sylvain Gugger, Google AI Language Team Authors, Open AI team Authors, Facebook AI Authors, Carnegie Mellon University Authors
Author-email: thomas@huggingface.co
License: Apache
Location: /Users/bytedance/transformers/src
Requires: filelock, numpy, packaging, regex, requests, sacremoses, tokenizers, tqdm, dataclasses, importlib-metadata
Required-by: sentence-transformers
```

Could you run the `run_ner.py` script using master?  as Stefan said your version seems old.

I tried 4.3.0.dev0, 4.4.0.dev0 and 4.2.2 .
They all didn't work. 😭

You might have an issue if your version of `datasets` is old. In any case, the whole serialization error is linked to the datasets library, so pinging @lhoestq in case he has a better idea :-)

Hi ! 
Can you try updating `dill` ?
It looks like [one of their issues](https://github.com/uqfoundation/dill/issues/312) from 2019 that has been fixed now.

Thank you, @lhoestq @sgugger @patil-suraj @stefan-it 
It works by updating ```dill``` from ```0.2.9``` to ```0.3.3```.