[assets] update readme (#8529)
This commit is contained in:
@@ -1014,7 +1014,7 @@ register_template(
|
||||
)
|
||||
|
||||
|
||||
# part copied from glm4 template
|
||||
# copied from glm4 template
|
||||
register_template(
|
||||
name="glm4v",
|
||||
format_user=StringFormatter(slots=["<|user|>\n{{content}}<|assistant|>"]),
|
||||
@@ -1024,11 +1024,10 @@ register_template(
|
||||
format_observation=StringFormatter(slots=["<|observation|>\n{{content}}<|assistant|>"]),
|
||||
format_tools=ToolFormatter(tool_format="glm4"),
|
||||
format_prefix=EmptyFormatter(slots=["[gMASK]<sop>"]),
|
||||
stop_words=["<|user|>", "<|observation|>"],
|
||||
stop_words=["<|user|>", "<|observation|>", "</answer>"],
|
||||
efficient_eos=True,
|
||||
mm_plugin=get_mm_plugin(name="glm4v", image_token="<|image|>", video_token="<|video|>"),
|
||||
template_class=ReasoningTemplate,
|
||||
thought_words=("<think>", "</think>"),
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -38,8 +38,8 @@ DEFAULT_TOOL_PROMPT = (
|
||||
)
|
||||
|
||||
GLM4_TOOL_PROMPT = (
|
||||
"你是一个名为 ChatGLM 的人工智能助手。你是基于智谱AI训练的语言模型 GLM-4 模型开发的,"
|
||||
"你的任务是针对用户的问题和要求提供适当的答复和支持。# 可用工具{tool_text}"
|
||||
"你是一个名为 ChatGLM 的人工智能助手。你是基于智谱 AI 公司训练的语言模型 GLM-4 模型开发的,"
|
||||
"你的任务是针对用户的问题和要求提供适当的答复和支持。\n\n# 可用工具{tool_text}"
|
||||
)
|
||||
|
||||
LLAMA3_TOOL_PROMPT = (
|
||||
|
||||
@@ -860,14 +860,14 @@ register_model_group(
|
||||
|
||||
register_model_group(
|
||||
models={
|
||||
"GLM-4.1V-9B-Thinking": {
|
||||
DownloadSource.DEFAULT: "THUDM/GLM-4.1V-9B-Thinking",
|
||||
DownloadSource.MODELSCOPE: "ZhipuAI/GLM-4.1V-9B-Thinking",
|
||||
},
|
||||
"GLM-4.1V-9B-Base": {
|
||||
DownloadSource.DEFAULT: "THUDM/GLM-4.1V-9B-Base",
|
||||
DownloadSource.MODELSCOPE: "ZhipuAI/GLM-4.1V-9B-Base",
|
||||
},
|
||||
"GLM-4.1V-9B-Thinking": {
|
||||
DownloadSource.DEFAULT: "THUDM/GLM-4.1V-9B-Thinking",
|
||||
DownloadSource.MODELSCOPE: "ZhipuAI/GLM-4.1V-9B-Thinking",
|
||||
},
|
||||
},
|
||||
template="glm4v",
|
||||
multimodal=True,
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import inspect
|
||||
import json
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
@@ -50,7 +51,14 @@ def create_chat_box(
|
||||
) -> tuple["Component", "Component", dict[str, "Component"]]:
|
||||
lang = engine.manager.get_elem_by_id("top.lang")
|
||||
with gr.Column(visible=visible) as chat_box:
|
||||
chatbot = gr.Chatbot(type="messages", show_copy_button=True)
|
||||
kwargs = {}
|
||||
if "show_copy_button" in inspect.signature(gr.Chatbot.__init__).parameters:
|
||||
kwargs["show_copy_button"] = True
|
||||
|
||||
if "resizable" in inspect.signature(gr.Chatbot.__init__).parameters:
|
||||
kwargs["resizable"] = True
|
||||
|
||||
chatbot = gr.Chatbot(type="messages", **kwargs)
|
||||
messages = gr.State([])
|
||||
with gr.Row():
|
||||
with gr.Column(scale=4):
|
||||
|
||||
Reference in New Issue
Block a user