Training MarianTokenizer with sentencepiece
i tried to run:
```
import sentencepiece as spm
import io
from transformers import MarianTokenizer
import json

model_en = io.BytesIO()
spm.SentencePieceTrainer.train(input='texts_en.txt',
                               vocab_size=125036,
                               max_sentence_length=512,
                               model_writer=model_en)

with open('target.spm', 'w') as fp:
    json.dump(model_en.getvalue(), fp)

MarianTokenizer(vocab=125036,
                source_spm="target.spm",
                target_spm="target.spm") # for example
```

But got error:
```
/opt/conda/lib/python3.7/site-packages/transformers/models/marian/tokenization_marian.py in __init__(self, vocab, source_spm, target_spm, source_lang, target_lang, unk_token, eos_token, pad_token, model_max_length, sp_model_kwargs, **kwargs)
    154         )
    155         assert Path(source_spm).exists(), f"cannot find spm source {source_spm}"
--> 156         self.encoder = load_json(vocab)
    157         if self.unk_token not in self.encoder:
    158             raise KeyError("<unk> token must be in vocab")

/opt/conda/lib/python3.7/site-packages/transformers/models/marian/tokenization_marian.py in load_json(path)
    365 
    366 def load_json(path: str) -> Union[Dict, List]:
--> 367     with open(path, "r") as f:
    368         return json.load(f)

OSError: [Errno 9] Bad file descriptor
```

transformers version - 4.16.2
kaggle cpu env

Can someone help me?
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.<|||||>@Lednik7 Have you resolved this problem?
I wanted to train a new  Marian tokenizer for new language and having lots of problems with creating the tokenizer.

Can you please share the script which you used to creater tokenizer? or tell how the source and target spm files can be created and alsothe vocab files.