Skip to main content

Tools for Hugging Face Jobs

Project description

hfjobs

Hugging Face Jobs

Installation

pip install hfjobs

Available commands

usage: hfjobs <command> [<args>]

positional arguments:
  {inspect,logs,ps,run}
                        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

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

Run jobs

Usage

usage: hfjobs <command> [<args>] run [-h] [-e ENV] [--env-file ENV_FILE] [--flavor FLAVOR] [-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.
  --env-file ENV_FILE  Read in a file of environment variables.
  --flavor FLAVOR      Flavor for the hardware, as in HF Spaces.
  -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)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hfjobs-0.4.2.tar.gz (10.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hfjobs-0.4.2-py3-none-any.whl (14.8 kB view details)

Uploaded Python 3

File details

Details for the file hfjobs-0.4.2.tar.gz.

File metadata

  • Download URL: hfjobs-0.4.2.tar.gz
  • Upload date:
  • Size: 10.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.12.2 Darwin/23.4.0

File hashes

Hashes for hfjobs-0.4.2.tar.gz
Algorithm Hash digest
SHA256 204cf0e88a706771b8e473448b4e199e65b9c96f8b1001af99a93eb74c4d0059
MD5 e53eb2766c7ef563626f36e04c4211f4
BLAKE2b-256 c732d9e90ea3597db5d5aa67cc3baf39a44a3ae0df78327ecbf01c61374a7104

See more details on using hashes here.

File details

Details for the file hfjobs-0.4.2-py3-none-any.whl.

File metadata

  • Download URL: hfjobs-0.4.2-py3-none-any.whl
  • Upload date:
  • Size: 14.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.12.2 Darwin/23.4.0

File hashes

Hashes for hfjobs-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a1ccc6ce16b802cb8aff5e988d553eeade52c2c5326850005b93af61342bdb0b
MD5 136d5d64ec3be926d858fdb28a59600b
BLAKE2b-256 161effb07f5a4a986daf8273950b6dfca612d70d2bac833b1d93a0423001dc99

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page