mirror of
https://github.com/modelscope/modelscope.git
synced 2025-12-25 12:39:25 +01:00
[to #42322933] fix cv-action-recongnition-pipeline run inference with the cpu
修复识别模型CPU 加载推理问题
Link: https://code.alibaba-inc.com/Ali-MaaS/MaaS-lib/codereview/9279667
This commit is contained in:
@@ -33,7 +33,8 @@ class ActionRecognitionPipeline(Pipeline):
|
||||
'cuda' if torch.cuda.is_available() else 'cpu')
|
||||
self.infer_model = BaseVideoModel(cfg=self.cfg).to(self.device)
|
||||
self.infer_model.eval()
|
||||
self.infer_model.load_state_dict(torch.load(model_path)['model_state'])
|
||||
self.infer_model.load_state_dict(
|
||||
torch.load(model_path, map_location=self.device)['model_state'])
|
||||
self.label_mapping = self.cfg.label_mapping
|
||||
logger.info('load model done')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user