What is the purpose of thinc.Model.id? #9609
-
Over at nlp1 = spacy.load("en_core_web_sm")
nlp2 = spacy.load("en_core_web_sm") Specifically, the nlp1.tagger.model.tok2vec.embed.id, nlp2.tagger.model.tok2vec.embed.id
# (1721, 2243) I found that indeed this A lot of the functionality seems to revolve around this unique ID (specifically when getting model parameters), and I am wondering how exactly that works or what its purpose is. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
There's a couple of reasons, but one is that it lets us run the optimizer without relying on object identity on the arrays. So, let's say you have |
Beta Was this translation helpful? Give feedback.
There's a couple of reasons, but one is that it lets us run the optimizer without relying on object identity on the arrays. So, let's say you have
nlp1
andnlp2
there. The optimizer will need some way of distinguishing that those are different parameters, including across processes. We do that by giving the models a distinct ID, and then parameters are addressed as(model_id, param_id)