File tree Expand file tree Collapse file tree 2 files changed +3
-0
lines changed Expand file tree Collapse file tree 2 files changed +3
-0
lines changed Original file line number Diff line number Diff line change 77from typing import List , Optional , Union
88
99import json
10+ import torch
1011from fastapi import FastAPI , Request
1112from fastapi .responses import JSONResponse , StreamingResponse
1213from modelscope import GenerationConfig
Original file line number Diff line number Diff line change @@ -134,6 +134,7 @@ def __init__(
134134 n : int = 1 ,
135135 length_penalty : float = 1. ,
136136 stop : Optional [List [str ]] = None ,
137+ skip_special_tokens : bool = False ,
137138 ** kwargs ,
138139 ) -> None :
139140 # The parameter design is similar to transformers.GenerationConfig.
@@ -162,6 +163,7 @@ def __init__(
162163 kwargs ['n' ] = n
163164 kwargs ['length_penalty' ] = length_penalty
164165 kwargs ['stop' ] = stop
166+ kwargs ['skip_special_tokens' ] = skip_special_tokens
165167 parameters = inspect .signature (SamplingParams .__init__ ).parameters
166168 for k in kwargs .copy ().keys ():
167169 if k not in parameters :
You can’t perform that action at this time.
0 commit comments