MCPcopy Create free account
hub / github.com/OpenBMB/ToolBench / prediction

Method prediction

toolbench/inference/LLM/llama_model.py:35–49  ·  view source on GitHub ↗
(self, prompt: str, stop: Optional[List[str]] = None)

Source from the content-addressed store, hash-verified

33 self.chatio = SimpleChatIO()
34
35 def prediction(self, prompt: str, stop: Optional[List[str]] = None) -> str:
36 gen_params = {
37 "model": "",
38 "prompt": prompt,
39 "temperature": 0.5,
40 "max_new_tokens": 512,
41 "stop": "</s>",
42 "stop_token_ids": None,
43 "echo": False
44 }
45 generate_stream_func = generate_stream
46 output_stream = generate_stream_func(self.model, self.tokenizer, gen_params, "cuda", self.max_sequence_length, force_generate=True)
47 outputs = self.chatio.return_output(output_stream)
48 prediction = outputs.strip()
49 return prediction
50
51 def add_message(self, message):
52 self.conversation_history.append(message)

Callers 1

parseMethod · 0.95

Calls 1

return_outputMethod · 0.45

Tested by

no test coverage detected