TypeError: sequence item 0: expected str instance, NBProgressBar found
Author: pascalhuszar
Pull request: no
Labels: name: wontfix

name: TensorFlow

# 🐛 Bug

## Information

Model I am using (Bert, XLNet ...): bert-base-multilingual-cased

Language I am using the model on (English, Chinese ...): German

The problem arises when using:
* [X] the official example scripts: (give details below)
* [ ] my own modified scripts: (give details below)

The tasks I am working on is:
* [X] an official GLUE/SQUaD task: NER
* [ ] my own task or dataset: (give details below)

## To reproduce

Steps to reproduce the behavior:

1. Google Colab Notebook
2. Run: `!python3 run_tf_ner.py --data_dir ./data --model_type bert --labels labels.txt --model_name_or_path bert-base-multilingual-cased --output_dir germeval-model --max_seq_length 128 --num_train_epochs 3 --per_device_train_batch_size 32 --save_steps 750 --seed 1 --do_train --do_eval --do_predict`
3.
```
I0330 12:15:45.104261 140536926144384 modeling_tf_utils.py:388] loading weights file germeval-model/tf_model.h5
I0330 12:15:46.316838 140536926144384 modeling_tf_utils.py:428] Layers of TFBertForTokenClassification not initialized from pretrained model: ['dropout_75']
I0330 12:15:46.317042 140536926144384 modeling_tf_utils.py:432] Layers from pretrained model not used in TFBertForTokenClassification: ['dropout_37']
I0330 12:15:46.317251 140536926144384 run_tf_ner.py:420] Loading features from cached file ./data/cached_dev_bert-base-multilingual-cased_128.tf_record
I0330 12:15:46.483210 140536926144384 run_tf_ner.py:318] ***** Running evaluation *****
I0330 12:15:46.483375 140536926144384 run_tf_ner.py:319]   Num examples = 2200
I0330 12:15:46.483478 140536926144384 run_tf_ner.py:320]   Batch size = 8
Traceback (most recent call last):
  File "run_tf_ner.py", line 644, in <module>
    app.run(main)
  File "/usr/local/lib/python3.6/dist-packages/absl/app.py", line 299, in run
    _run_main(main, args)
  File "/usr/local/lib/python3.6/dist-packages/absl/app.py", line 250, in _run_main
    sys.exit(main(argv))
  File "run_tf_ner.py", line 579, in main
    args, strategy, model, tokenizer, labels, pad_token_label_id, mode="dev"
  File "run_tf_ner.py", line 322, in evaluate
    for eval_features, eval_labels in eval_iterator:
  File "/usr/local/lib/python3.6/dist-packages/fastprogress/fastprogress.py", line 39, in __iter__
    if self.total != 0: self.update(0)
  File "/usr/local/lib/python3.6/dist-packages/fastprogress/fastprogress.py", line 56, in update
    self.update_bar(0)
  File "/usr/local/lib/python3.6/dist-packages/fastprogress/fastprogress.py", line 76, in update_bar
    else: self.on_update(val, f'{100 * val/self.total:.2f}% [{val}/{self.total} {elapsed_t}<{remaining_t}{end}]')
  File "/usr/local/lib/python3.6/dist-packages/fastprogress/fastprogress.py", line 126, in on_update
    elif self.parent is not None: self.parent.show()
  File "/usr/local/lib/python3.6/dist-packages/fastprogress/fastprogress.py", line 167, in show
    self.html_code = '\n'.join([getattr(self.inner_dict[n], 'progress', self.inner_dict[n]) for n in to_show])
TypeError: sequence item 0: expected str instance, NBProgressBar found
```

## Expected behavior

Evaluation of test.txt 

## Environment info

     
- `transformers` version: 2.6.0
- Platform: Google  Colab
- Python version: 3.6
- PyTorch version (GPU?): -
- Tensorflow version (GPU?): 2.2.0rc1
- Using GPU in script?: -
- Using distributed or parallel set-up in script?: using example setup


Comments:
Whats also strange, the PyTorch version list the labels as text, e.g: "B-ORG, I-LOC, [...] in the Model Config Ouput but the TF-version list them like this bellow. Is this okay?

```
"id2label": {
    "0": "LABEL_0",
    "1": "LABEL_1",
    "2": "LABEL_2",
    "3": "LABEL_3",
    "4": "LABEL_4",
    "5": "LABEL_5",
    "6": "LABEL_6",
    "7": "LABEL_7",
    "8": "LABEL_8",
    "9": "LABEL_9",
    "10": "LABEL_10",
    "11": "LABEL_11",
    "12": "LABEL_12",
    "13": "LABEL_13",
    "14": "LABEL_14",
    "15": "LABEL_15",
    "16": "LABEL_16",
    "17": "LABEL_17",
    "18": "LABEL_18",
    "19": "LABEL_19",
    "20": "LABEL_20",
    "21": "LABEL_21",
    "22": "LABEL_22",
    "23": "LABEL_23",
    "24": "LABEL_24",
    "25": "LABEL_25"
```

Any update or fix for this?

Got it working - the parent progress bar is not needed for evalute/predict as there is a single iteration. 

In run_tf_ner.py I changed:

eval_iterator = progress_bar(eval_dataset, total=num_eval_steps,parent=master, display=args["n_device"] > 1)

to 

eval_iterator = progress_bar(eval_dataset, total=num_eval_steps, display=args["n_device"] > 1)

and commented out

master = master_bar(range(1))

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.


same issue

I solved it

I forgot how to solve it

Okay so this is because you have this
```python
mbar = master_bar(x)
for i in progress_bar(y, parent = mbar):  ...
```
basically you have mbar but you need iterate over it first before iterating over children so
```python
mbar = master_bar(x)
for epoch in mbar:
    for i in progress_bar(y, parent = mbar):  ...
```