Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. import spacy
  2. import random
  3. nlp=spacy.load('en')
  4.  
  5. TRAIN_DATA = [(u"Uber blew through $1 million a week", {"entities": [(0, 4, "ORG")]}),(u"Google rebrands its business apps", {"entities": [(0, 6, "ORG")]})]
  6.  
  7. nlp = spacy.blank('en')
  8. optimizer = nlp.begin_training()
  9. for i in range(20):
  10. random.shuffle(TRAIN_DATA)
  11. for text, annotations in TRAIN_DATA:
  12. nlp.update([text], [annotations], sgd=optimizer)
  13. nlp.to_disk("/model")
  14.  
  15. Warning: Unnamed vectors -- this won't allow multiple vectors models to be loaded. (Shape: (0, 0))
  16. Traceback (most recent call last):
  17. File "ss1.py", line 15, in <module>
  18. nlp.to_disk("/model")
  19. File "/Users/shailysaigal/anaconda3/lib/python3.7/site-packages/spacy/language.py", line 621, in to_disk
  20. util.to_disk(path, serializers, {p: False for p in disable})
  21. File "/Users/shailysaigal/anaconda3/lib/python3.7/site-packages/spacy/util.py", line 500, in to_disk
  22. path.mkdir()
  23. File "/Users/shailysaigal/anaconda3/lib/python3.7/pathlib.py", line 1241, in mkdir
  24. self._accessor.mkdir(self, mode)
  25. PermissionError: [Errno 13] Permission denied: '/model'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement