Instructions to use dl1wjd2/Logistics_AX with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- ultralytics
How to use dl1wjd2/Logistics_AX with ultralytics:
from huggingface_hub import hf_hub_download from ultralytics import YOLO # pick the weights file from this repo's "Files and versions" tab weights = hf_hub_download("dl1wjd2/Logistics_AX", "<weights>.pt") model = YOLO(weights) source = 'http://images.cocodataset.org/val2017/000000039769.jpg' model.predict(source=source, save=True) - Notebooks
- Google Colab
- Kaggle
Download hug/lib/python3.12/site-packages/fontTools/misc/treeTools.py from dl1wjd2/Logistics_AX: direct link, hf CLI and curl.
- Browser
- Download file 1.27 kB
-
https://huggingface.co/dl1wjd2/Logistics_AX/resolve/main/hug/lib/python3.12/site-packages/fontTools/misc/treeTools.py
- Command line
-
hf download hf://dl1wjd2/Logistics_AX/hug/lib/python3.12/site-packages/fontTools/misc/treeTools.py
-
curl -L -o treeTools.py https://huggingface.co/dl1wjd2/Logistics_AX/resolve/main/hug/lib/python3.12/site-packages/fontTools/misc/treeTools.py
1.27 kB
| """Generic tools for working with trees.""" | |
| from math import ceil, log | |
| def build_n_ary_tree(leaves, n): | |
| """Build N-ary tree from sequence of leaf nodes. | |
| Return a list of lists where each non-leaf node is a list containing | |
| max n nodes. | |
| """ | |
| if not leaves: | |
| return [] | |
| assert n > 1 | |
| depth = ceil(log(len(leaves), n)) | |
| if depth <= 1: | |
| return list(leaves) | |
| # Fully populate complete subtrees of root until we have enough leaves left | |
| root = [] | |
| unassigned = None | |
| full_step = n ** (depth - 1) | |
| for i in range(0, len(leaves), full_step): | |
| subtree = leaves[i : i + full_step] | |
| if len(subtree) < full_step: | |
| unassigned = subtree | |
| break | |
| while len(subtree) > n: | |
| subtree = [subtree[k : k + n] for k in range(0, len(subtree), n)] | |
| root.append(subtree) | |
| if unassigned: | |
| # Recurse to fill the last subtree, which is the only partially populated one | |
| subtree = build_n_ary_tree(unassigned, n) | |
| if len(subtree) <= n - len(root): | |
| # replace last subtree with its children if they can still fit | |
| root.extend(subtree) | |
| else: | |
| root.append(subtree) | |
| assert len(root) <= n | |
| return root | |