(self)
| 67 | ) |
| 68 | |
| 69 | def create_llm(self) -> Callable[[...], List[str]]: |
| 70 | GPUS = os.environ.get('CUDA_VISIBLE_DEVICES', "0").split(',') |
| 71 | llm = LLM( |
| 72 | model=self.config.model_dir, |
| 73 | tensor_parallel_size=len(GPUS), |
| 74 | trust_remote_code=True, |
| 75 | seed=self.config.seed, |
| 76 | swap_space=self.config.swap_space, |
| 77 | ) |
| 78 | sampling_params = SamplingParams( |
| 79 | top_k=self.config.top_k, |
| 80 | top_p=self.config.top_p, |
| 81 | use_beam_search=self.config.use_beam_search, |
| 82 | best_of=self.config.best_of, |
| 83 | max_tokens=self.config.max_tokens, |
| 84 | stop=self.stop, |
| 85 | #seed=self.config.seed, |
| 86 | ) |
| 87 | return partial( |
| 88 | local_vllm, |
| 89 | llm=llm, |
| 90 | sampling_params=sampling_params, |
| 91 | n=1, |
| 92 | temperature=self.config.temperature, |
| 93 | ) |
| 94 | |
| 95 | def should_generate_next(self) -> bool: |
| 96 | return not self.current_node.is_terminal and self.current_node.depth <= self.config.max_depth |
nothing calls this directly
no outgoing calls
no test coverage detected