_C.MODEL.PROMPT.INITIATION = "random" # "final-cls", "cls-first12" _C.MODEL.PROMPT.CLSEMB_FOLDER = "" _C.MODEL.PROMPT.CLSEMB_PATH = "" _C.MODEL.PROMPT.PROJECT = -1 # "projection mlp hidden dim" _C.MODEL.PROMPT.DEEP = False
时间: 2023-06-24 07:04:39 浏览: 158
这是一个模型的配置参数,包含了一些关于预测时如何初始化提示信息(INITIATION)、使用哪个分类器进行聚类(CLSEMB_FOLDER、CLSEMB_PATH)、使用哪个投影矩阵(PROJECT)以及是否使用深度模型(DEEP)等信息。其中,INITIATION可以选择"random"、"final-cls"和"cls-first12"三种方式进行初始化;CLSEMB_FOLDER和CLSEMB_PATH是在使用分类器进行聚类时需要指定的文件夹和路径;PROJECT是在进行投影时使用的多层感知机的隐藏层维度。
相关问题
def initUI(self): self.setWindowTitle(self.title) screen = QApplication.primaryScreen() size = screen.size() self.setGeometry((size.width() - self.width) // 2, (size.height() - self.height) // 2, self.width, self.height) # Prompt Label and Edit box prompt_label = QLabel('对象:', self) prompt_label.setStyleSheet('color: #222; font-size: 30px; margin-bottom: 10px; font-weight: bold;') self.prompt_edit = QTextEdit(self) self.prompt_edit.setStyleSheet('color: #333; font-size: 24px; border: 1px solid #ccc; padding: 5px;') prompt_layout = QHBoxLayout() prompt_layout.addWidget(prompt_label) prompt_layout.addWidget(self.prompt_edit) # Question Label and Edit box question_label = QLabel('问题:', self) question_label.setStyleSheet('color: #222; font-size: 30px; margin-bottom: 10px; font-weight: bold;') self.question_edit = QTextEdit(self) self.question_edit.setStyleSheet('color: #333; font-size: 24px; border: 1px solid #ccc; padding: 5px;') question_layout = QHBoxLayout() question_layout.addWidget(question_label) question_layout.addWidget(self.question_edit) liangge_layout_layout = QVBoxLayout() liangge_layout_layout.addLayout(prompt_layout) liangge_layout_layout.addLayout(question_layout) # Adding submit button to question layout self.submit_btn = QPushButton('发送', self) self.submit_btn.setFixedWidth(150) self.submit_btn.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Expanding) self.submit_btn.setStyleSheet('color: #fff; background-color: #20639b; border: none; font-size: 24px; padding: 10px; border-radius: 5px;') self.submit_btn.clicked.connect(self.on_submit) # Change layout of question and submit button using QHBoxLayout question_submit_layout = QHBoxLayout() question_submit_layout.addLayout(liangge_layout_layout) question_submit_layout.addWidget(self.submit_btn) # JSON response Label and Edit box json_response_label = QLabel('回复:', self) json_response_label.setStyleSheet('color: #222; font-size: 30px; margin-bottom: 10px; font-weight: bold;') self.json_response_edit = QTextEdit(self) self.json_response_edit.setStyleSheet('color: #333; font-size: 24px; border: 1px solid #ccc; padding: 5px;') json_response_layout = QHBoxLayout() json_response_layout.addWidget(json_response_label) json_response_layout.addWidget(self.json_response_edit) # Main layout main_layout = QVBoxLayout() main_layout.setSpacing(20) main_layout.addLayout(question_submit_layout) main_layout.addLayout(json_response_layout) main_layout.setContentsMargins(30, 30, 30, 30) self.setLayout(main_layout) self.show()如何让按钮文本内容竖着显示?
你可以使用QPushButton的setStyleSheet方法设置按钮的样式表,将文本旋转90度,例如:
```
self.submit_btn.setStyleSheet('color: #fff; background-color: #20639b; border: none; font-size: 24px; padding: 10px; border-radius: 5px; transform: rotate(90deg);')
```
这里使用了transform属性将文本旋转了90度。
def generatorAnswer(self, prompt: str, history: List[List[str]] = [], streaming: bool = False): if streaming: history += [[]] for inum, (stream_resp, _) in enumerate(self.checkPoint.model.stream_chat( self.checkPoint.tokenizer, prompt, history=history[-self.history_len:-1] if self.history_len > 0 else [], max_length=self.max_token, temperature=self.temperature )): # self.checkPoint.clear_torch_cache() history[-1] = [prompt, stream_resp] answer_result = AnswerResult() answer_result.history = history answer_result.llm_output = {"answer": stream_resp} yield answer_result else: response, _ = self.checkPoint.model.chat( self.checkPoint.tokenizer, prompt, history=history[-self.history_len:] if self.history_len > 0 else [], max_length=self.max_token, temperature=self.temperature ) self.checkPoint.clear_torch_cache() history += [[prompt, response]] answer_result = AnswerResult() answer_result.history = history answer_result.llm_output = {"answer": response} yield answer_result
这段代码是用来生成AI对话回答的,其中包括以下参数:
- prompt: 代表AI的输入,即对话的开端
- history: 代表之前的对话历史,可以为空
- streaming: 是否使用流式对话,即实时回答对话
如果使用流式对话,该函数会在对话过程中不断生成回答;如果不使用流式对话,该函数会在输入完整的对话后一次性生成回答。该函数返回的是一个生成器,每次调用生成一个回答,其中包含了对话历史和AI的回答结果。
阅读全文