(self,
path: str,
max_seq_len: int = 2048,
tokenizer_only: bool = False,
meta_template: Optional[Dict] = None,
generation_kwargs: Optional[Dict] = dict(),
sync_rank: bool = False)
| 32 | is_api: bool = False |
| 33 | |
| 34 | def __init__(self, |
| 35 | path: str, |
| 36 | max_seq_len: int = 2048, |
| 37 | tokenizer_only: bool = False, |
| 38 | meta_template: Optional[Dict] = None, |
| 39 | generation_kwargs: Optional[Dict] = dict(), |
| 40 | sync_rank: bool = False): |
| 41 | self.path = path |
| 42 | self.max_seq_len = max_seq_len |
| 43 | self.tokenizer_only = tokenizer_only |
| 44 | # meta template |
| 45 | self.template_parser = LMTemplateParser(meta_template) |
| 46 | self.eos_token_id = None |
| 47 | if meta_template and 'eos_token_id' in meta_template: |
| 48 | self.eos_token_id = meta_template['eos_token_id'] |
| 49 | self.generation_kwargs = generation_kwargs |
| 50 | self.sync_rank = sync_rank |
| 51 | |
| 52 | @abstractmethod |
| 53 | def generate(self, inputs: List[str], max_out_len: int) -> List[str]: |
nothing calls this directly
no test coverage detected