add required packages
Browse files- __init__.py +23 -3
__init__.py
CHANGED
|
@@ -1,6 +1,26 @@
|
|
| 1 |
from transformers import AutoProcessor
|
| 2 |
from .modeling import LRMGenerator, LRMGeneratorConfig
|
| 3 |
-
from .processor import LRMImageProcessor
|
| 4 |
|
| 5 |
-
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
from transformers import AutoProcessor
|
| 2 |
from .modeling import LRMGenerator, LRMGeneratorConfig
|
|
|
|
| 3 |
|
| 4 |
+
import logging
|
| 5 |
+
|
| 6 |
+
# we set up logging
|
| 7 |
+
logging.basicConfig(level=logging.INFO)
|
| 8 |
+
logger = logging.getLogger(__name__)
|
| 9 |
+
|
| 10 |
+
# helper function to install packages
|
| 11 |
+
def install_package(package_name):
|
| 12 |
+
if importlib.util.find_spec(package_name) is None:
|
| 13 |
+
logger.info(f"Package '{package_name}' not found. Installing...")
|
| 14 |
+
subprocess.check_call([sys.executable, "-m", "pip", "install", package_name])
|
| 15 |
+
else:
|
| 16 |
+
logger.info(f"Package '{package_name}' is already installed.")
|
| 17 |
+
|
| 18 |
+
# list of packages to ensure are installed
|
| 19 |
+
required_packages = [
|
| 20 |
+
'imageio[ffmpeg]', 'PyMCubes', 'trimesh', 'rembg[gpu,cli]', 'kiui', 'torchvision', 'Pillow'
|
| 21 |
+
]
|
| 22 |
+
|
| 23 |
+
for package in required_packages:
|
| 24 |
+
install_package(package)
|
| 25 |
+
|
| 26 |
+
from .processor import LRMImageProcessor
|