Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Init-model doeesn't work for some languages #4048

Closed
Xargonus opened this issue Jul 30, 2019 · 2 comments
Closed

Init-model doeesn't work for some languages #4048

Xargonus opened this issue Jul 30, 2019 · 2 comments
Labels
bug Bugs and behaviour differing from documentation feat / cli Feature: Command-line interface

Comments

@Xargonus
Copy link

Xargonus commented Jul 30, 2019

Init-model doesn't work for some languages with less features. So far I have found that cs and bg don't work, but there are probably more. The problem is I think init-model expecting non-empty vocab.

Error

python -m spacy init-model bg test
�[2K✔ Counted frequencies
�[2K✔ Read clusters
0it [00:00, ?it/s]

Traceback (most recent call last):
File "C:\Users\xargo\AppData\Local\Programs\Python\Python36\lib\runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "C:\Users\xargo\AppData\Local\Programs\Python\Python36\lib\runpy.py", line 85, in run_code
exec(code, run_globals)
File "C:\Users\xargo\AppData\Local\Programs\Python\Python36\lib\site-packages\spacy_main
.py", line 35, in
plac.call(commands[command], sys.argv[1:])
File "C:\Users\xargo\AppData\Local\Programs\Python\Python36\lib\site-packages\plac_core.py", line 328, in call
cmd, result = parser.consume(arglist)
File "C:\Users\xargo\AppData\Local\Programs\Python\Python36\lib\site-packages\plac_core.py", line 207, in consume
return cmd, self.func(*(args + varargs + extraopts), **kwargs)
File "C:\Users\xargo\AppData\Local\Programs\Python\Python36\lib\site-packages\spacy\cli\init_model.py", line 78, in init_model
nlp = create_model(lang, lex_attrs)
File "C:\Users\xargo\AppData\Local\Programs\Python\Python36\lib\site-packages\spacy\cli\init_model.py", line 146, in create_model
oov_prob = min(lex.prob for lex in nlp.vocab)
ValueError: min() arg is an empty sequence

How to reproduce the behaviour

python -m spacy init-model cs test

Your Environment

  • Operating System: Windows 10
  • Python Version Used: 3.6.7
  • spaCy Version Used: 2.1.6
  • Environment Information:
@ines ines added bug Bugs and behaviour differing from documentation feat / cli Feature: Command-line interface labels Jul 30, 2019
@ines
Copy link
Member

ines commented Jul 30, 2019

Thanks for the report – fixed in #4048.

In the meantime, if you just want an empty blank model saved to a directory (no vectors etc.), you can also use this one-liner:

python -c "import spacy;spacy.blank('cs').to_disk('/path/to/model')"

@lock
Copy link

lock bot commented Aug 31, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Aug 31, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Bugs and behaviour differing from documentation feat / cli Feature: Command-line interface
Projects
None yet
Development

No branches or pull requests

2 participants