We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
如标题所说, context_len参数同时控制了stream_generate_answer函数中token的len:
@torch.inference_mode() def stream_generate_answer( self, max_new_tokens=512, temperature=0.7, repetition_penalty=1.0, context_len=8192 ): streamer = TextIteratorStreamer(self.tokenizer, timeout=60.0, skip_prompt=True, skip_special_tokens=True) input_ids = self._get_chat_input() max_src_len = context_len - max_new_tokens - 8
和predict_stream中的str的len:
def predict_stream( self, query: str, max_length: int = 512, context_len: int = 8192, temperature: float = 0.7, ): """Generate predictions stream.""" stop_str = self.tokenizer.eos_token if self.tokenizer.eos_token else "</s>" if not self.enable_history: self.history = [] if self.sim_model.corpus: reference_results = self.get_reference_results(query) if not reference_results: yield '没有提供足够的相关信息', reference_results reference_results = self._add_source_numbers(reference_results) context_str = '\n'.join(reference_results)[:(context_len - len(PROMPT_TEMPLATE))] prompt = PROMPT_TEMPLATE.format(context_str=context_str, query_str=query) logger.debug(f"prompt: {prompt}")
这样会导致, prompt注入的知识永远和模型的最大上下文能力不匹配.
如果可以我可以提个pull request.
The text was updated successfully, but these errors were encountered:
提吧。
Sorry, something went wrong.
@rjagge nice!
@shibing624 提了
No branches or pull requests
如标题所说, context_len参数同时控制了stream_generate_answer函数中token的len:
和predict_stream中的str的len:
这样会导致, prompt注入的知识永远和模型的最大上下文能力不匹配.
如果可以我可以提个pull request.
The text was updated successfully, but these errors were encountered: