mattdeitke
commited on
Commit
•
b51f134
1
Parent(s):
5d96618
update scripts
Browse files- objaverse_xl/__init__.py +2 -0
- objaverse_xl/github.py +51 -56
- objaverse_xl/objaverse_v1.py +2 -0
- objaverse_xl/smithsonian.py +2 -0
- objaverse_xl/thingiverse.py +2 -0
- objaverse_xl/utils.py +2 -0
objaverse_xl/__init__.py
CHANGED
@@ -1 +1,3 @@
|
|
|
|
|
|
1 |
from .smithsonian import download_smithsonian_objects, load_smithsonian_metadata
|
|
|
1 |
+
"""A package for downloading and processing Objaverse-XL."""
|
2 |
+
|
3 |
from .smithsonian import download_smithsonian_objects, load_smithsonian_metadata
|
objaverse_xl/github.py
CHANGED
@@ -1,59 +1,4 @@
|
|
1 |
-
"""
|
2 |
-
|
3 |
-
- handle_found_object: Called when an object is successfully found and downloaded. Here,
|
4 |
-
the object has the same sha256 as the one that was downloaded with Objaverse-XL. If
|
5 |
-
not specified, the object will be downloaded, but nothing will be done with it.
|
6 |
-
|
7 |
-
Args:
|
8 |
-
file (str): Local path to the downloaded 3D object.
|
9 |
-
github_url (str): GitHub URL of the 3D object.
|
10 |
-
sha256 (str): SHA256 of the contents of the 3D object.
|
11 |
-
repo (str): Name of the GitHub repo where the 3D object comes from.
|
12 |
-
organization (str): Name of the GitHub organization where the 3D object comes from.
|
13 |
-
Returns: Any
|
14 |
-
|
15 |
-
- handle_new_object: Called when a new object is found. Here, the object is not used in
|
16 |
-
Objaverse-XL, but is still downloaded with the repository. The object may have not
|
17 |
-
been used because it does not successfully import into Blender. If not specified,
|
18 |
-
the object will be downloaded, but nothing will be done with it.
|
19 |
-
|
20 |
-
Args:
|
21 |
-
file (str): Local path to the downloaded 3D object.
|
22 |
-
github_url (str): GitHub URL of the 3D object.
|
23 |
-
sha256 (str): SHA256 of the contents of the 3D object.
|
24 |
-
repo (str): Name of the GitHub repo where the 3D object comes from.
|
25 |
-
organization (str): Name of the GitHub organization where the 3D object comes from.
|
26 |
-
Returns: Any
|
27 |
-
|
28 |
-
- handle_modified_object: Called when a modified object is found and downloaded. Here,
|
29 |
-
the object is successfully downloaded, but it has a different sha256 than the one
|
30 |
-
that was downloaded with Objaverse-XL. This is not expected to happen very often,
|
31 |
-
because the same commit hash is used for each repo. If not specified, the object
|
32 |
-
will be downloaded, but nothing will be done with it.
|
33 |
-
|
34 |
-
Args:
|
35 |
-
file (str): Local path to the downloaded 3D object.
|
36 |
-
github_url (str): GitHub URL of the 3D object.
|
37 |
-
sha256 (str): SHA256 of the contents of the 3D object.
|
38 |
-
repo (str): Name of the GitHub repo where the 3D object comes from.
|
39 |
-
organization (str): Name of the GitHub organization where the 3D object comes from.
|
40 |
-
Returns: Any
|
41 |
-
|
42 |
-
- handle_missing_object: Called when an object that is in Objaverse-XL is not found.
|
43 |
-
Here, it is likely that the repository was deleted or renamed. If not specified, the
|
44 |
-
object will be downloaded, but nothing will be done with it.
|
45 |
-
|
46 |
-
Args:
|
47 |
-
github_url (str): GitHub URL of the 3D object.
|
48 |
-
sha256 (str): SHA256 of the contents of the original 3D object.
|
49 |
-
repo (str): Name of the GitHub repo where the 3D object comes from.
|
50 |
-
organization (str): Name of the GitHub organization where the 3D object comes from.
|
51 |
-
Returns: Any
|
52 |
-
|
53 |
-
|
54 |
-
Note: You'll likely find more objects by
|
55 |
-
|
56 |
-
"""
|
57 |
|
58 |
import hashlib
|
59 |
import json
|
@@ -430,6 +375,56 @@ def download_github_objects(
|
|
430 |
If None, will use the number of CPUs on the machine. Defaults to None.
|
431 |
download_dir (str, optional): Directory to download the GitHub objects to.
|
432 |
Supports all file systems supported by fsspec. Defaults to "~/.objaverse".
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
433 |
|
434 |
Returns:
|
435 |
List[Dict[str, str]]: List of dictionaries with the keys "githubUrl" and
|
|
|
1 |
+
"""Script to download objects from GitHub."""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
import hashlib
|
4 |
import json
|
|
|
375 |
If None, will use the number of CPUs on the machine. Defaults to None.
|
376 |
download_dir (str, optional): Directory to download the GitHub objects to.
|
377 |
Supports all file systems supported by fsspec. Defaults to "~/.objaverse".
|
378 |
+
save_repo_format (Optional[Literal["zip", "tar", "tar.gz", "files"]], optional):
|
379 |
+
Format to save the repository. If None, the repository will not be saved. If
|
380 |
+
"files" is specified, each file will be saved individually. Otherwise, the
|
381 |
+
repository can be saved as a "zip", "tar", or "tar.gz" file. Defaults to
|
382 |
+
None.
|
383 |
+
handle_found_object (Optional[Callable], optional): Called when an object is
|
384 |
+
successfully found and downloaded. Here, the object has the same sha256 as
|
385 |
+
the one that was downloaded with Objaverse-XL. If None, the object will be
|
386 |
+
downloaded, but nothing will be done with it. Args for the function include:
|
387 |
+
- file (str): Local path to the downloaded 3D object.
|
388 |
+
- github_url (str): GitHub URL of the 3D object.
|
389 |
+
- sha256 (str): SHA256 of the contents of the 3D object.
|
390 |
+
- repo (str): Name of the GitHub repo where the 3D object comes from.
|
391 |
+
- organization (str): Name of the GitHub organization where the 3D object
|
392 |
+
comes from.
|
393 |
+
Return is not used. Defaults to None.
|
394 |
+
handle_new_object (Optional[Callable], optional): Called when a new object is
|
395 |
+
found. Here, the object is not used in Objaverse-XL, but is still downloaded
|
396 |
+
with the repository. The object may have not been used because it does not
|
397 |
+
successfully import into Blender. If None, the object will be downloaded,
|
398 |
+
but nothing will be done with it. Args for the function include:
|
399 |
+
- file (str): Local path to the downloaded 3D object.
|
400 |
+
- github_url (str): GitHub URL of the 3D object.
|
401 |
+
- sha256 (str): SHA256 of the contents of the 3D object.
|
402 |
+
- repo (str): Name of the GitHub repo where the 3D object comes from.
|
403 |
+
- organization (str): Name of the GitHub organization where the 3D object
|
404 |
+
comes from.
|
405 |
+
Return is not used. Defaults to None.
|
406 |
+
handle_modified_object (Optional[Callable], optional): Called when a modified
|
407 |
+
object is found and downloaded. Here, the object is successfully downloaded,
|
408 |
+
but it has a different sha256 than the one that was downloaded with
|
409 |
+
Objaverse-XL. This is not expected to happen very often, because the same
|
410 |
+
commit hash is used for each repo. If None, the object will be downloaded,
|
411 |
+
but nothing will be done with it. Args for the function include:
|
412 |
+
- file (str): Local path to the downloaded 3D object.
|
413 |
+
- github_url (str): GitHub URL of the 3D object.
|
414 |
+
- sha256 (str): SHA256 of the contents of the 3D object.
|
415 |
+
- repo (str): Name of the GitHub repo where the 3D object comes from.
|
416 |
+
- organization (str): Name of the GitHub organization where the 3D object
|
417 |
+
comes from.
|
418 |
+
Return is not used. Defaults to None.
|
419 |
+
handle_missing_object (Optional[Callable], optional): Called when an object that
|
420 |
+
is in Objaverse-XL is not found. Here, it is likely that the repository was
|
421 |
+
deleted or renamed. If None, nothing will be done with the missing object.
|
422 |
+
Args for the function include:
|
423 |
+
- github_url (str): GitHub URL of the 3D object.
|
424 |
+
- sha256 (str): SHA256 of the contents of the original 3D object.
|
425 |
+
- repo (str): Name of the GitHub repo where the 3D object comes from.
|
426 |
+
- organization (str): Name of the GitHub organization where the 3D object comes from.
|
427 |
+
Return is not used. Defaults to None.
|
428 |
|
429 |
Returns:
|
430 |
List[Dict[str, str]]: List of dictionaries with the keys "githubUrl" and
|
objaverse_xl/objaverse_v1.py
CHANGED
@@ -1,3 +1,5 @@
|
|
|
|
|
|
1 |
import gzip
|
2 |
import json
|
3 |
import os
|
|
|
1 |
+
"""Script to download objects from Objaverse 1.0."""
|
2 |
+
|
3 |
import gzip
|
4 |
import json
|
5 |
import os
|
objaverse_xl/smithsonian.py
CHANGED
@@ -1,3 +1,5 @@
|
|
|
|
|
|
1 |
import multiprocessing
|
2 |
import os
|
3 |
from functools import partial
|
|
|
1 |
+
"""Script to download 3D objects from the Smithsonian Institution."""
|
2 |
+
|
3 |
import multiprocessing
|
4 |
import os
|
5 |
from functools import partial
|
objaverse_xl/thingiverse.py
CHANGED
@@ -1,3 +1,5 @@
|
|
|
|
|
|
1 |
import multiprocessing
|
2 |
import os
|
3 |
import time
|
|
|
1 |
+
"""Script to download objects from Thingiverse."""
|
2 |
+
|
3 |
import multiprocessing
|
4 |
import os
|
5 |
import time
|
objaverse_xl/utils.py
CHANGED
@@ -1,3 +1,5 @@
|
|
|
|
|
|
1 |
import uuid
|
2 |
|
3 |
|
|
|
1 |
+
"""Utility functions for the objaverse_xl package."""
|
2 |
+
|
3 |
import uuid
|
4 |
|
5 |
|