Vipitis commited on
Commit
a096a44
·
1 Parent(s): d732bbe

use tokenizer fix only for str + remote code

Browse files
Files changed (1) hide show
  1. ShaderEval.py +4 -3
ShaderEval.py CHANGED
@@ -76,9 +76,10 @@ class ReturnGenerationEvaluator(evaluate.TextGenerationEvaluator):
76
  or isinstance(model_or_pipeline, transformers.PreTrainedModel)
77
  or isinstance(model_or_pipeline, transformers.TFPreTrainedModel)
78
  ):
79
- # load tokenizer manually, since the pipeline does fail to do so at times. needed for bigcode/santacoder for example.
80
- tokenizer = AutoTokenizer.from_pretrained(model_or_pipeline)
81
-
 
82
  pipe = pipeline(
83
  self.task,
84
  model=model_or_pipeline,
 
76
  or isinstance(model_or_pipeline, transformers.PreTrainedModel)
77
  or isinstance(model_or_pipeline, transformers.TFPreTrainedModel)
78
  ):
79
+ if isinstance(model_or_pipeline, str):
80
+ # load tokenizer manually, since the pipeline does fail to do so at times. needed for bigcode/santacoder for example.
81
+ tokenizer = AutoTokenizer.from_pretrained(model_or_pipeline, trust_remote_code=True)
82
+
83
  pipe = pipeline(
84
  self.task,
85
  model=model_or_pipeline,