fix: encode_text latency
Browse filesSwitching the condition `if not self.tokenizer`which takes 20~30ms to an explicit `if self.tokenizer is None:` ( < 1ms)
- modeling_clip.py +1 -1
modeling_clip.py
CHANGED
@@ -329,7 +329,7 @@ class JinaCLIPModel(JinaCLIPPreTrainedModel):
|
|
329 |
self.post_init()
|
330 |
|
331 |
def get_tokenizer(self):
|
332 |
-
if
|
333 |
self.tokenizer = AutoTokenizer.from_pretrained(
|
334 |
self.config._name_or_path, trust_remote_code=True
|
335 |
)
|
|
|
329 |
self.post_init()
|
330 |
|
331 |
def get_tokenizer(self):
|
332 |
+
if self.tokenizer is None:
|
333 |
self.tokenizer = AutoTokenizer.from_pretrained(
|
334 |
self.config._name_or_path, trust_remote_code=True
|
335 |
)
|