cavargas10 commited on
Commit
66d33a8
·
verified ·
1 Parent(s): 4c534ab

Update trellis/pipelines/__init__.py

Browse files
Files changed (1) hide show
  1. trellis/pipelines/__init__.py +25 -24
trellis/pipelines/__init__.py CHANGED
@@ -1,24 +1,25 @@
1
- from . import samplers
2
- from .trellis_image_to_3d import TrellisImageTo3DPipeline
3
-
4
-
5
- def from_pretrained(path: str):
6
- """
7
- Load a pipeline from a model folder or a Hugging Face model hub.
8
-
9
- Args:
10
- path: The path to the model. Can be either local path or a Hugging Face model name.
11
- """
12
- import os
13
- import json
14
- is_local = os.path.exists(f"{path}/pipeline.json")
15
-
16
- if is_local:
17
- config_file = f"{path}/pipeline.json"
18
- else:
19
- from huggingface_hub import hf_hub_download
20
- config_file = hf_hub_download(path, "pipeline.json")
21
-
22
- with open(config_file, 'r') as f:
23
- config = json.load(f)
24
- return globals()[config['name']].from_pretrained(path)
 
 
1
+ from . import samplers
2
+ from .trellis_image_to_3d import TrellisImageTo3DPipeline
3
+ from .trellis_text_to_3d import TrellisTextTo3DPipeline
4
+
5
+
6
+ def from_pretrained(path: str):
7
+ """
8
+ Load a pipeline from a model folder or a Hugging Face model hub.
9
+
10
+ Args:
11
+ path: The path to the model. Can be either local path or a Hugging Face model name.
12
+ """
13
+ import os
14
+ import json
15
+ is_local = os.path.exists(f"{path}/pipeline.json")
16
+
17
+ if is_local:
18
+ config_file = f"{path}/pipeline.json"
19
+ else:
20
+ from huggingface_hub import hf_hub_download
21
+ config_file = hf_hub_download(path, "pipeline.json")
22
+
23
+ with open(config_file, 'r') as f:
24
+ config = json.load(f)
25
+ return globals()[config['name']].from_pretrained(path)