Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

有关内容总结质量 #332

Open
leizhu1989 opened this issue Jul 2, 2024 · 0 comments
Open

有关内容总结质量 #332

leizhu1989 opened this issue Jul 2, 2024 · 0 comments

Comments

@leizhu1989
Copy link

想请问下对于一段长的内容,要如何设计提示词进行总结比较好,用的是glm4-chat-1m int4量化模型,没按照我的模板进行总结,prompt.txt是具体事情内容。
我的代码如下
prompt = "/home/lili/project/chatglm.cpp/prompt.txt"

with open(prompt, "r", encoding="utf-8") as f:
   content = f.read()

system = "你是一个总结助手,帮我根据内容按如下格式总结,内容包括:\
 一、主题 \
 二、目的 \
 三、主要内容 \
 四、结论 \"

pipeline = chatglm_cpp.Pipeline(DEFAULT_MODEL_PATH, max_length=20000)

generation_kwargs = dict(
    max_length=20000,
    max_new_tokens=2000,
    max_context_length=1024,
    do_sample=0.95,
    top_k=0,
    top_p=0.8,  #0.7
    temperature=0.6,  #0.95
    repetition_penalty=1.2,   #1.0
    stream=True,
)

system_messages: List[chatglm_cpp.ChatMessage] = []
if system is not None:
    system_messages.append(chatglm_cpp.ChatMessage(role="system", content=system))

messages = system_messages.copy()

#print("system: ", messages)
messages.append(chatglm_cpp.ChatMessage(role="user", content=content[0:10000]))

for chunk in pipeline.chat(messages, **generation_kwargs):
    print(chunk.content, sep="", end="", flush=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant