(engine_dir: str, is_hf: bool = False)
| 83 | |
| 84 | |
| 85 | def read_is_enc_dec(engine_dir: str, is_hf: bool = False): |
| 86 | if is_hf: |
| 87 | with open(Path(engine_dir) / "config.json", 'r') as f: |
| 88 | config = json.load(f) |
| 89 | is_enc_dec = config.get('is_encoder_decoder', False) |
| 90 | else: |
| 91 | is_enc_dec = {'encoder', 'decoder'}.issubset({ |
| 92 | name |
| 93 | for name in os.listdir(engine_dir) |
| 94 | if os.path.isdir(os.path.join(engine_dir, name)) |
| 95 | }) |
| 96 | return is_enc_dec |
| 97 | |
| 98 | |
| 99 | def read_model_name(engine_dir: str, is_hf: bool = False): |