Browse Source

fix decord would not be installed on ARM

gaotingquan 10 months ago
parent
commit
bcfabdef23
3 changed files with 11 additions and 3 deletions
  1. 10 1
      paddlex/inference/utils/io/readers.py
  2. 0 1
      paddlex/inference/utils/io/writers.py
  3. 1 1
      requirements.txt

+ 10 - 1
paddlex/inference/utils/io/readers.py

@@ -21,8 +21,17 @@ from PIL import Image, ImageOps
 import pandas as pd
 import numpy as np
 import yaml
-import decord
 import random
+import platform
+
+from ....utils import logging
+
+if not platform.machine().startswith("arm"):
+    import decord
+else:
+    logging.warning(
+        "Please install `decord` manually on ARM machine. Otherwise, the related model cannot work."
+    )
 
 __all__ = [
     "ReaderType",

+ 0 - 1
paddlex/inference/utils/io/writers.py

@@ -19,7 +19,6 @@ import json
 from pathlib import Path
 
 import cv2
-import decord
 import numpy as np
 from PIL import Image
 import pandas as pd

+ 1 - 1
requirements.txt

@@ -36,7 +36,7 @@ erniebot-agent == 0.5.0
 unstructured
 networkx
 faiss-cpu
-decord==0.6.0
+decord==0.6.0; platform_machine != 'arm64'
 ######## For NLP Tokenizer #######
 jieba
 sentencepiece