in optimum/intel/openvino/utils.py [0:0]
def _is_timm_ov_dir(model_dir):
config_file = None
has_xml = False
has_bin = False
if os.path.isdir(model_dir):
for filename in glob(os.path.join(model_dir, "*")):
if filename.endswith(".xml"):
has_xml = True
if filename.endswith(".bin"):
has_bin = True
if filename.endswith("config.json"):
config_file = filename
if config_file and has_xml and has_bin:
with open(config_file) as conf:
hf_hub_id = json.load(conf).get("hf_hub_id", None)
if hf_hub_id and model_info(hf_hub_id).library_name == "timm":
return True
return False