Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Fix CLS and SEP ids
Browse files- server/model_api.py +2 -1
server/model_api.py
CHANGED
@@ -52,7 +52,8 @@ class ModelDetails:
|
|
52 |
# For GPT2, add the beginning of sentence token to the input. Note that this will work on all models but XLM
|
53 |
bost = self.tok.bos_token_id
|
54 |
clst = self.tok.cls_token_id
|
55 |
-
|
|
|
56 |
ids.insert(0, bost)
|
57 |
|
58 |
inputs = self.tok.prepare_for_model(ids, add_special_tokens=add_special_tokens, return_tensors="pt")
|
|
|
52 |
# For GPT2, add the beginning of sentence token to the input. Note that this will work on all models but XLM
|
53 |
bost = self.tok.bos_token_id
|
54 |
clst = self.tok.cls_token_id
|
55 |
+
sept = self.tok.sep_token_id
|
56 |
+
if (bost is not None) and (bost != clst) and (clst != sept) and add_special_tokens:
|
57 |
ids.insert(0, bost)
|
58 |
|
59 |
inputs = self.tok.prepare_for_model(ids, add_special_tokens=add_special_tokens, return_tensors="pt")
|