InvalidGitRepositoryError while running distillation train example
Author: kaliaanup
Pull request: no
Labels: name: bug

### System Info

```shell
(akalia) akalia@data-workstation-akalia1-gpu-data-10:~/pretrained_rembert/distillation$ python train.py     --student_type distilbert     --student_config training_configs/distilbert-base-uncased.json     --teacher_type bert     --teacher_name bert-base-uncased     --alpha_ce 5.0 --alpha_mlm 2.0 --alpha_cos 1.0 --alpha_clm 0.0 --mlm     --freeze_pos_embs     --dump_path serialization_dir/my_first_training     --data_file data/binarized_text.bert-base-uncased.pickle     --token_counts data/token_counts.bert-base-uncased.pickle     --force
06/16/2022 22:03:08 - INFO - utils - PID: 3947 -  Initializing GPUs
06/16/2022 22:03:08 - INFO - utils - PID: 3947 -  --- Global rank: 0 - Number of nodes: 1
06/16/2022 22:03:08 - INFO - utils - PID: 3947 -  --- Global rank: 0 - Node ID        : 0
06/16/2022 22:03:08 - INFO - utils - PID: 3947 -  --- Global rank: 0 - Local rank     : 0
06/16/2022 22:03:08 - INFO - utils - PID: 3947 -  --- Global rank: 0 - World size     : 1
06/16/2022 22:03:08 - INFO - utils - PID: 3947 -  --- Global rank: 0 - GPUs per node  : 1
06/16/2022 22:03:08 - INFO - utils - PID: 3947 -  --- Global rank: 0 - Master         : True
06/16/2022 22:03:08 - INFO - utils - PID: 3947 -  --- Global rank: 0 - Multi-node     : False
06/16/2022 22:03:08 - INFO - utils - PID: 3947 -  --- Global rank: 0 - Multi-GPU      : False
06/16/2022 22:03:08 - INFO - utils - PID: 3947 -  --- Global rank: 0 - Hostname       : data-workstation-akalia1-gpu-data-10.dm.vpc
06/16/2022 22:03:08 - INFO - utils - PID: 3947 -  Experiment will be dumped and logged in serialization_dir/my_first_training
06/16/2022 22:03:08 - INFO - utils - PID: 3947 -  Param: Namespace(force=True, dump_path='serialization_dir/my_first_training', data_file='data/binarized_text.bert-base-uncased.pickle', student_type='distilbert', student_config='training_configs/distilbert-base-uncased.json', student_pretrained_weights=None, teacher_type='bert', teacher_name='bert-base-uncased', temperature=2.0, alpha_ce=5.0, alpha_mlm=2.0, alpha_clm=0.0, alpha_mse=0.0, alpha_cos=1.0, mlm=True, mlm_mask_prop=0.15, word_mask=0.8, word_keep=0.1, word_rand=0.1, mlm_smoothing=0.7, token_counts='data/token_counts.bert-base-uncased.pickle', restrict_ce_to_mask=False, freeze_pos_embs=True, freeze_token_type_embds=False, n_epoch=3, batch_size=5, group_by_size=True, gradient_accumulation_steps=50, warmup_prop=0.05, weight_decay=0.0, learning_rate=0.0005, adam_epsilon=1e-06, max_grad_norm=5.0, initializer_range=0.02, fp16=False, fp16_opt_level='O1', n_gpu=1, local_rank=0, seed=56, log_interval=500, checkpoint_interval=4000, n_nodes=1, node_id=0, global_rank=0, world_size=1, n_gpu_per_node=1, multi_gpu=False, is_master=True, multi_node=False)
Traceback (most recent call last):
  File "/home/akalia/pretrained_rembert/distillation/train.py", line 324, in <module>
    main()
  File "/home/akalia/pretrained_rembert/distillation/train.py", line 245, in main
    git_log(args.dump_path)
  File "/home/akalia/pretrained_rembert/distillation/utils.py", line 40, in git_log
    repo = git.Repo(search_parent_directories=True)
  File "/home/akalia/anaconda3/envs/akalia/lib/python3.9/site-packages/git/repo/base.py", line 224, in __init__
    self.working_dir: Optional[PathLike] = self._working_tree_dir or self.common_dir
  File "/home/akalia/anaconda3/envs/akalia/lib/python3.9/site-packages/git/repo/base.py", line 307, in common_dir
    raise InvalidGitRepositoryError()
git.exc.InvalidGitRepositoryError
```


### Who can help?

_No response_

### Information

- [X] The official example scripts
- [ ] My own modified scripts

### Tasks

- [X] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)
- [ ] My own task or dataset (give details below)

### Reproduction

```python    
python train.py \
    --student_type distilbert \
    --student_config training_configs/distilbert-base-uncased.json \
    --teacher_type bert \
    --teacher_name bert-base-uncased \
    --alpha_ce 5.0 --alpha_mlm 2.0 --alpha_cos 1.0 --alpha_clm 0.0 --mlm \
    --freeze_pos_embs \
    --dump_path serialization_dir/my_first_training \
    --data_file data/binarized_text.bert-base-uncased.pickle \
    --token_counts data/token_counts.bert-base-uncased.pickle \
    --force
```

### Expected behavior

```shell
A distilled model will be generated
```


Comments:
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the [contributing guidelines](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md) are likely to be ignored.

Hi, did you resolve this error?

> Hi, did you resolve this error?

I haven't. I am still waiting for a reply on this.

> 

OK, I tried to upgrade the version of gitpython and gitdb2, but it doesn't work.

Hello, has this issue been resolved?