question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

01_how-to-train.ipynb broken

See original GitHub issue

🐛 Bug

To reproduce

Steps to reproduce the behavior:

  1. Go to https://github.com/huggingface/transformers/tree/master/examples
  2. Click the colab for language-modeling: https://colab.research.google.com/github/huggingface/blog/blob/master/notebooks/01_how_to_train.ipynb
  3. Run notebook

Expected behavior

The notebook finishes succesfuly

What I get is:

---------------------------------------------------------------------------
Exception                                 Traceback (most recent call last)
<ipython-input-5-52625a7c86e5> in <module>()
      1 get_ipython().system('mkdir EsperBERTo')
----> 2 tokenizer.save("EsperBERTo")

/usr/local/lib/python3.6/dist-packages/tokenizers/implementations/base_tokenizer.py in save(self, path, pretty)
    330                 A path to the destination Tokenizer file
    331         """
--> 332         return self._tokenizer.save(path, pretty)
    333 
    334     def to_str(self, pretty: bool = False):

Exception: Is a directory (os error 21)

Environment info

  • transformers version: 2.11.0
  • Platform: Linux-4.19.104±x86_64-with-Ubuntu-18.04-bionic
  • Python version: 3.6.9
  • PyTorch version (GPU?): 1.5.0+cu101 (True)
  • Tensorflow version (GPU?): not installed (NA)
  • Using GPU in script?: NA
  • Using distributed or parallel set-up in script?: NA

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

7reactions
n1t0commented, Jun 18, 2020

Yes, tokenizers 0.8.0 introduces the full tokenizer serialization, whereas before it saved the “model” only (vocab.json + merges.txt for BPE). So the save method should be used like that: .save("tokenizer.json") and it saves the entire tokenizer to a JSON file. We need to update the Notebook to use this new serialization method, but in the meantime, the only thing needed to make it work exactly like before is to replace:

!mkdir EsperBERTo
tokenizer.save("EsperBERTo")

by

!mkdir EsperBERTo
tokenizer.save_model("EsperBERTo")
5reactions
thomwolfcommented, Jun 18, 2020

This one is for me (this method was actually not working as intended under the hood for Fast-tokenizers…)

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I fix a .ipynb file? - Stack Overflow
A possible way to recover corrupted Jupyter notebook files, whether it contains text or not (size = 0KB), is to go to the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found