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

'spacy.vocab.Vocab' object has no attribute 'clear_vectors' #1516

Closed
danielhers opened this issue Nov 8, 2017 · 4 comments
Closed

'spacy.vocab.Vocab' object has no attribute 'clear_vectors' #1516

danielhers opened this issue Nov 8, 2017 · 4 comments
Labels
docs Documentation and website

Comments

@danielhers
Copy link
Contributor

Steps leading to the issue:

python -m spacy download en_core_web_md

And then in Python:

>>> import spacy
>>> nlp = spacy.load("en_core_web_md")
>>> nlp.vocab.clear_vectors()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'spacy.vocab.Vocab' object has no attribute 'clear_vectors'

Info about spaCy

  • spaCy version: 2.0.1
  • Platform: Linux-4.8.4-aufs-1-x86_64-with-debian-stretch-sid
  • Python version: 3.6.3
  • Models: en_core_web_md, en_core_web_lg, en, de_core_news_sm, fr_core_news_md, fr_core_news_sm
@ines ines added the docs Documentation and website label Nov 8, 2017
@honnibal
Copy link
Member

honnibal commented Nov 8, 2017

Thanks! We renamed this to .reset_vectors(), which I see hasn't been updated in the docs and examples yet.

    def reset_vectors(self, *, width=None, shape=None):
        """Drop the current vector table. Because all vectors must be the same
        width, you have to call this to change the size of the vectors.
        """
        if width is not None and shape is not None:
            raise ValueError("Only one of width and shape can be specified")
        elif shape is not None:
            self.vectors = Vectors(shape=shape)
        else:
            width = width if width is not None else self.vectors.data.shape[1]
            self.vectors = Vectors(shape=(self.vectors.shape[0], width))

@ines
Copy link
Member

ines commented Nov 8, 2017

@ines ines closed this as completed in 33b84f4 Nov 8, 2017
@danielhers
Copy link
Contributor Author

Nice, thanks!

@lock
Copy link

lock bot commented May 8, 2018

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 May 8, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
docs Documentation and website
Projects
None yet
Development

No branches or pull requests

3 participants