[GLM4.6v] Required changes for bumping up to transformer 5.x (#13229)
This commit is contained in:
@@ -995,7 +995,10 @@ async def get_mooncake_request_over_time(
|
||||
# Form the full prompt from history
|
||||
try:
|
||||
full_prompt_text = tokenizer.apply_chat_template(
|
||||
chat_history, tokenize=False, add_generation_prompt=True
|
||||
chat_history,
|
||||
tokenize=False,
|
||||
add_generation_prompt=True,
|
||||
return_dict=False,
|
||||
)
|
||||
except Exception:
|
||||
full_prompt_text = "\n".join(
|
||||
@@ -1161,6 +1164,7 @@ def sample_sharegpt_requests(
|
||||
[{"role": "user", "content": prompt}],
|
||||
add_generation_prompt=True,
|
||||
tokenize=False,
|
||||
return_dict=False,
|
||||
)
|
||||
if tokenizer.bos_token:
|
||||
prompt = prompt.replace(tokenizer.bos_token, "")
|
||||
|
||||
@@ -46,7 +46,8 @@ enable_hf_transfer()
|
||||
class DisabledTqdm(tqdm):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs, disable=True)
|
||||
kwargs["disable"] = True
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
|
||||
def get_lock(model_name_or_path: str | Path, cache_dir: str | None = None):
|
||||
|
||||
@@ -324,6 +324,7 @@ class OpenAIServingChat(OpenAIServingBase):
|
||||
**(
|
||||
request.chat_template_kwargs if request.chat_template_kwargs else {}
|
||||
),
|
||||
return_dict=False,
|
||||
)
|
||||
except Exception:
|
||||
# This except branch will be triggered when the chosen model
|
||||
@@ -343,6 +344,7 @@ class OpenAIServingChat(OpenAIServingBase):
|
||||
**(
|
||||
request.chat_template_kwargs if request.chat_template_kwargs else {}
|
||||
),
|
||||
return_dict=False,
|
||||
)
|
||||
|
||||
if assistant_prefix:
|
||||
|
||||
@@ -70,7 +70,8 @@ enable_hf_transfer()
|
||||
|
||||
class DisabledTqdm(tqdm):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs, disable=True)
|
||||
kwargs["disable"] = True
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
|
||||
def get_lock(model_name_or_path: str, cache_dir: Optional[str] = None):
|
||||
|
||||
@@ -353,7 +353,7 @@ class HFRunner:
|
||||
scores = []
|
||||
for conv in prompts:
|
||||
conv_formatted = self.tokenizer.apply_chat_template(
|
||||
conv, tokenize=False
|
||||
conv, tokenize=False, return_dict=False
|
||||
)
|
||||
conv_tokenized = self.tokenizer(
|
||||
conv_formatted, return_tensors="pt"
|
||||
|
||||
Reference in New Issue
Block a user