Skip to main content

hfjobs

Hugging Face Jobs

Installation

pip install hfjobs

Available commands

usage: hfjobs <command> [<args>]

positional arguments:
  {inspect,logs,ps,run,cancel}
                        hfjobs command helpers
    inspect             Display detailed information on one or more Jobs
    logs                Fetch the logs of a Job
    ps                  List Jobs
    run                 Run a Job
    cancel              Cancel a Job

options:
  -h, --help            show this help message and exit

Run jobs

Usage

usage: hfjobs <command> [<args>] run [-h] [-e ENV] [-s SECRET] [--env-file ENV_FILE] [--secret-env-file SECRET_ENV_FILE] [--flavor FLAVOR] [--timeout TIMEOUT] [-d] [--token TOKEN] dockerImage ...

positional arguments:
  dockerImage           The Docker image to use.
  command               The command to run.

options:
  -h, --help            show this help message and exit
  -e ENV, --env ENV     Set environment variables.
  -s SECRET, --secret SECRET
                        Set secret environment variables.
  --env-file ENV_FILE   Read in a file of environment variables.
  --secret-env-file SECRET_ENV_FILE
                        Read in a file of secret environment variables.
  --flavor FLAVOR       Flavor for the hardware, as in HF Spaces.
  --timeout TIMEOUT     Max duration: int/float with s (seconds, default), m (minutes), h (hours) or d (days).
  -d, --detach          Run the Job in the background and print the Job ID.
  --token TOKEN         A User Access Token generated from https://huggingface.co/settings/tokens

Examples

$ hfjobs run ubuntu echo hello world
hello world
$ hfjobs run python:3.12 python -c "print(2+2)"
4
$ hfjobs run python:3.12 /bin/bash -c "cd /tmp && wget https://gist.githubusercontent.com/sergeyprokudin/e8e1eeb9263766cc43a05ab9190442e4/raw/3c34504fd646517aeb15903700f8e9c1f4d6d2e5/fibonacci.py && python fibonacci.py"
0
1
...
218922995834555169026
$ hfjobs run hf.co/spaces/lhoestq/duckdb duckdb -c "select 'hello world'"
┌───────────────┐
│ 'hello world' │
│    varchar    │
├───────────────┤
│ hello world   │
└───────────────┘
$ hfjobs run --flavor t4-small pytorch/pytorch:2.6.0-cuda12.4-cudnn9-devel python -c "import torch; print(torch.tensor([42]).to('cuda'))"
tensor([42], device='cuda:0')

Hardware

Available --flavor options:

  • CPU: cpu-basic, cpu-upgrade
  • GPU: t4-small, t4-medium, l4x1, l4x4, a10g-small, a10g-large, a10g-largex2, a10g-largex4,a100-large
  • TPU: v5e-1x1, v5e-2x2, v5e-2x4

(updated in 03/25 from Hugging Face suggested_hardware docs)

Metadata

Release files for hfjobs 0.6.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hfjobs 0.6.2
File Size Uploaded
hfjobs-0.6.2.tar.gz 11.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hfjobs 0.6.2
File Interpreter ABI Platform
hfjobs-0.6.2-py3-none-any.whl Python 3 none any Details

Total release size: 27.2 kB

Release files / hfjobs-0.6.2.tar.gz

Download URL hfjobs-0.6.2.tar.gz
Size 11.5 kB
Tags Source
SHA-256 checksum
How to use checksums
043eb05355034ebcbf0fb2caabc24d2e2275e28d84457d037b87152bf35014fd
BLAKE2b-256 checksum
How to use checksums
1f2359fc066278bb4eeb874c17947775e5c1deabc38416e253e81a96c84ca7c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.1 CPython/3.12.2 Darwin/24.4.0

Release files / hfjobs-0.6.2-py3-none-any.whl

Download URL hfjobs-0.6.2-py3-none-any.whl
Size 15.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4068ed8c62aeb44812358f8c9a785c641c23c9e05f714380a991164e6cd3b564
BLAKE2b-256 checksum
How to use checksums
631a1fb2ee838a96c2102ceed1d741ab07ab695011e3e4e096d8030db22389a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.1 CPython/3.12.2 Darwin/24.4.0

Release history Release notifications | RSS feed

This release

0.6.2 This release

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.3

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page