Module 'seqeval' doesn't exist on the Hugging Face Hub either
Author: datquocnguyen
Pull request: no
Labels: name: bug

### System Info

- `transformers` version: 4.22.0.dev0
- Platform: Linux-5.4.0-77-generic-x86_64-with-debian-bullseye-sid
- Python version: 3.7.13
- Huggingface_hub version: 0.8.1
- PyTorch version (GPU?): 1.9.1+cu111 (False)
- Tensorflow version (GPU?): not installed (NA)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Using GPU in script?: <fill in>
- Using distributed or parallel set-up in script?: <fill in>

### Who can help?

@LysandreJik Please help with this issue. Thank you very much.

### Information

- [X] The official example scripts
- [ ] My own modified scripts

### Tasks

- [ ] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)
- [X] My own task or dataset (give details below)

### Reproduction

```
cd /lustre/scratch/client/vinai/users/datnq9/transformers/examples/pytorch/token-classification
python3 run_ner.py \
        --task_name $TASK_NAME \
        --model_name_or_path $BERT_MODEL \
        --output_dir $OUTPUT_DIR \
        --seed $SEED \
        --per_device_train_batch_size $BATCH_SIZE \
        --tokenizer_name $BERT_MODEL \
        --num_train_epochs $NUM_EPOCHS \
        --learning_rate $PEAK_LR \
        --warmup_steps $WARMUP \
        --train_file $TRAIN_FILE \
        --validation_file $DEV_FILE \
        --test_file $TEST_FILE \
        --do_train \
        --do_eval \
        --do_predict \
        --text_column_name words \
        --label_column_name tags \
        --evaluation_strategy epoch \
        --save_strategy epoch \
        --save_total_limit 3 \
        --metric_for_best_model $METRIC \
        --load_best_model_at_end
```

### Expected behavior

```
Traceback (most recent call last):
  File "run_ner.py", line 630, in <module>
    main()
  File "run_ner.py", line 508, in main
    metric = evaluate.load("seqeval")
  File "/lustre/scratch/client/vinai/users/datnq9/miniconda3/lib/python3.7/site-packages/evaluate/loading.py", line 703, in load
    path, module_type=module_type, revision=revision, download_config=download_config, download_mode=download_mode
  File "/lustre/scratch/client/vinai/users/datnq9/miniconda3/lib/python3.7/site-packages/evaluate/loading.py", line 655, in evaluation_module_factory
    ) from None
FileNotFoundError: Couldn't find a module script at /lustre/scratch/client/vinai/users/datnq9/transformers/examples/pytorch/token-classification/seqeval/seqeval.py. Module 'seqeval' doesn't exist on the Hugging Face Hub either.
```

I already installed "seqeval" as well as "evaluate" packages. Thus I am not sure why this issue happened.

Comments:
Now I can make `run_ner.py` running by changing the line 508 from `metric = evaluate.load("seqeval")` to `metric = evaluate.load("/absoluate/path/to/seqeval.py")`. But I think this is still a potential bug as the fine-tuning script had worked well before, without changing the file  `run_ner.py`. 

I meet this problem too(but for squad dataset). Seems that they have not fixed it yet.

I ran into this problem, too. I think this problem may be caused by the version of `transformers` package.

Here are my two solutions to work around it：

- Install the latest version of `transformers` from source, which version is `4.32.0.dev0`, then install the corresponding dependencies through `pip install -r requirements.txt`
- If you have problem install the latest version of `transformers`, then you could replace the evaluation part with the following codes:


**BEFORE**
```
metric = evaluate.load("seqeval")

def compute_metrics(p):
    predictions, labels = p
    predictions = np.argmax(predictions, axis=2)

    # Remove ignored index (special tokens)
    true_predictions = [
        [label_list[p] for (p, l) in zip(prediction, label) if l != -100]
        for prediction, label in zip(predictions, labels)
    ]
    true_labels = [
        [label_list[l] for (p, l) in zip(prediction, label) if l != -100]
        for prediction, label in zip(predictions, labels)
    ]

    results = metric.compute(predictions=true_predictions, references=true_labels)
    if data_args.return_entity_level_metrics:
        # Unpack nested dictionaries
        final_results = {}
        for key, value in results.items():
            if isinstance(value, dict):
                for n, v in value.items():
                    final_results[f"{key}_{n}"] = v
            else:
                final_results[key] = value
        return final_results
    else:
        return {
            "precision": results["overall_precision"],
            "recall": results["overall_recall"],
            "f1": results["overall_f1"],
            "accuracy": results["overall_accuracy"],
        }
```

**AFTER**
```
from seqeval.metrics import accuracy_score
from seqeval.metrics import classification_report
from seqeval.metrics import f1_score

def compute_metrics(p):
  predictions, labels = p
  predictions = np.argmax(predictions, axis=2)
  
  # Remove ignored index (special tokens)
  true_predictions = [
	  [label_list[p] for (p, l) in zip(prediction, label) if l != -100]
	  for prediction, label in zip(predictions, labels)
  ]
  true_labels = [
	  [label_list[l] for (p, l) in zip(prediction, label) if l != -100]
	  for prediction, label in zip(predictions, labels)
  ]
  results = {
	  'accuracy': accuracy_score(true_labels, true_predictions),
	  'f1': f1_score(true_labels, true_predictions),
	  'classification_report': classification_report(true_labels, true_predictions)
  }
  return results
```