From fa38faf5c20b17254ad92829a8ec5de588c08c25 Mon Sep 17 00:00:00 2001 From: zw <26880977+zw615@users.noreply.github.com> Date: Wed, 4 Oct 2023 03:47:28 +0800 Subject: [PATCH] update get_tokenizer to pass CI test --- src/open_clip/factory.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/open_clip/factory.py b/src/open_clip/factory.py index 3b33a0e6e..12f3dec30 100644 --- a/src/open_clip/factory.py +++ b/src/open_clip/factory.py @@ -90,8 +90,9 @@ def get_tokenizer(model_name): tokenizer = block_mask_tokenize else: tokenizer = tokenize - context_length = get_model_config(model_name)['text_cfg']['context_length'] - tokenizer = partial(tokenizer, context_length=context_length) + if 'context_length' in config['text_cfg'].keys(): + context_length = config['text_cfg']['context_length'] + tokenizer = partial(tokenizer, context_length=context_length) return tokenizer