Unix Program Shortcuts
Need to transfer data locally or remote? Support efficient re-connect and dedupe? Want summary progress information?
rsync -a --info=progress2 --recursive [SOURCE] ... [DEST]
| # Run this example: | |
| # | |
| # mysecret=SECRET_VALUE docker build --secret id=mysecret,env=mysecret -f Dockerfile -t deleteme . | |
| # | |
| FROM debian:trixie-slim | |
| RUN <<EOF cat >> file | |
| #!/bin/bash | |
| if [[ -z "\${MYSECRET}" ]]; then | |
| echo "No MYSECRET env var!!!" |
| [build-system] | |
| requires = ["setuptools", "wheel", "setuptools_scm"] | |
| build-backend = "setuptools.build_meta" | |
| [project] | |
| name = "mypackage" | |
| requires-python = ">=3.10" | |
| dynamic = ["dependencies"] | |
| [tool.setuptools.dynamic] |
| FROM nvidia/cuda:11.7.1-devel-ubuntu22.04 | |
| RUN DEBIAN_FRONTEND=noninteractive apt-get update && \ | |
| apt-get install -y software-properties-common && \ | |
| add-apt-repository -y ppa:deadsnakes/ppa && \ | |
| apt-get install -y \ | |
| python3-setuptools python3-dev swig \ | |
| wget git unzip tmux vim tree xterm \ | |
| build-essential gcc \ |
| """ | |
| $ python testing_args_easier_debug_messages.py.py | |
| Hello world, I can't believe you've have 42 birthdays! I hope you find time for crafting soon! | |
| Hello universe, I can't believe you've have 117.0 birthdays! I hope you find time for crafting soon! | |
| ValueError: Need positive numbers, not: age=whoops | |
| ValueError: Need positive numbers, not: age=-1 | |
| ValueError: Need non-empty strings, not: name= | |
| ValueError: Need non-empty strings, not: hobby=None | |
| """ |
| from contextlib import contextmanager | |
| from multiprocessing import get_start_method, set_start_method | |
| from typing import Literal | |
| @contextmanager | |
| def ForkingBehavior( | |
| *, | |
| start_method: Literal['spawn', 'fork', 'forkserver'], |
| Hugging Face Optimized Inference License 1.0 (HFOILv1.0) | |
| This License Agreement governs the use of the Software and its Modifications. It is a | |
| binding agreement between the Licensor and You. | |
| This License Agreement shall be referred to as Hugging Face Optimized Inference License | |
| 1.0 or HFOILv1.0. We may publish revised versions of this License Agreement from time to | |
| time. Each version will be given a distinguished number. |
| from dataclasses import dataclass | |
| from typing import Collection, Dict, Iterator, Optional, Set | |
| import torch | |
| def torchscript(model: torch.nn.Module) -> torch.ScriptModule: | |
| """Runs TorchScript's scripting mode on the input model. | |
| A torch scripted model is able to run in a Python-free execution environment, | |
| ideal for production inference. |
| from concurrent.futures import ProcessPoolExecutor | |
| from multiprocessing import BoundedSemaphore | |
| from typing import Optional, Sequence | |
| from concurrent_utils import BoundedPoolExecutor | |
| __all__: Sequence[str] = ("BoundedProcessPoolExecutor",) | |
| class BoundedProcessPoolExecutor(ProcessPoolExecutor, BoundedPoolExecutor): |
| from concurrent.futures import ThreadPoolExecutor | |
| from threading import BoundedSemaphore, Lock | |
| from typing import Optional, Sequence | |
| from concurrent_utils import BoundedPoolExecutor | |
| __all__: Sequence[str] = ( | |
| "BoundedThreadPoolExecutor", | |
| "IsDone", | |
| ) |