Spaces:
Running on T4
Download docs/GVHMR_SETUP.md from modventures/baseball-engine: direct link, hf CLI and curl.
- Browser
- Download file 4.94 kB
-
https://huggingface.co/spaces/modventures/baseball-engine/resolve/main/docs/GVHMR_SETUP.md
- Command line
-
hf download hf://spaces/modventures/baseball-engine/docs/GVHMR_SETUP.md
-
curl -L -o GVHMR_SETUP.md https://huggingface.co/spaces/modventures/baseball-engine/resolve/main/docs/GVHMR_SETUP.md
Enable GVHMR on the existing GPU API
The normal Docker image contains SAM and an optional GVHMR bootstrap. Once the licensed file location is configured, GVHMR installs into its own Python runtime on the GPU host, in the background. This avoids the constrained Hugging Face image builder running out of memory while packaging two CUDA stacks. The API starts independently and SAM stays the default. No new public route, Gemini key or GPU purchase is needed to select GVHMR.
Required operator-supplied file
Obtain the neutral SMPL-X model from the official SMPL-X provider
under the applicable license. The required file is SMPLX_NEUTRAL.npz.
SAM's approved Hugging Face access does not grant SMPL-X access. The setup never
downloads licensed body models from third-party public mirrors.
For a Docker server, mount that file read-only and set:
BASEBALL_SMPLX_MODEL_PATH=/models/smplx/SMPLX_NEUTRAL.npz
For the existing Hugging Face Space, store your licensed copy in an appropriately
private model repository accessible to the Space's existing HF_TOKEN. Set:
BASEBALL_SMPLX_REPO=your-owner/your-private-body-model-repository
BASEBALL_SMPLX_FILENAME=SMPLX_NEUTRAL.npz
Set BASEBALL_SMPLX_REVISION to pin a specific repository commit if desired.
Do not put the file in the public Space or GitHub repository. Restart after
configuring the file location. First setup installs the pinned runtime and then
resolves/pins asset revisions,
records checksums and creates /data/gvhmr-api-worker.json. Setup failures report
safe reason codes without printing tokens or provider response bodies.
During first setup, capabilities reports gvhmr_runtime_installing or
gvhmr_assets_installing; selecting GVHMR returns 503 until setup completes.
Use persistent /data to retain the runtime and weights across restarts. Ephemeral
Space rebuilds may need to install them again. Setup logs remain private under
/data/gvhmr-setup-private.log and are not served by the API.
Until the file is supplied, capabilities reports
gvhmr_smplx_license_asset_required, and selecting GVHMR returns 503. SAM keeps
working. After setup, configured: true means files/dependencies are configured;
successful GPU inference must still be verified with an actual recording.
Runtime and checkpoints
Source: official GVHMR, pinned to
ee960bb6e2ea2d381aa97f08e9b71ef320b624b1.
The isolated Python 3.10 runtime uses upstream's Torch 2.3 / CUDA 12.1 stack and official PyTorch3D wheel. CI builds the separate provider image and runs inference-import/configuration preflight without accessing a body model. The host installer runs the same preflight before downloading assets. SAM retains its existing runtime and the GVHMR installer does not modify its packages.
For a Docker build host with sufficient memory, Dockerfile.gvhmr offers an image
with GVHMR's runtime already installed. Build the ordinary image as
baseball-engine-api:local, then build Dockerfile.gvhmr with that base image
(BASE_IMAGE can override the tag). Run it with the same GPU/data/secret settings.
Model weights and the licensed body file are still runtime assets. The standard
Hugging Face deployment uses background installation instead of this larger image.
Startup obtains only the three non-body checkpoints from the mirror used by
the upstream project's linked Hugging Face demo: GVHMR release, HMR2 features,
and ViTPose. BASEBALL_GVHMR_WEIGHTS_REPO and
BASEBALL_GVHMR_WEIGHTS_REVISION can select an operator-managed mirror/revision.
The manifest records source revision and SHA-256 for all four model assets.
GVHMR's license restricts use
to educational, research and non-profit purposes; check the applicable terms
before commercial deployment. This integration does not change those terms.
For an existing installed runtime, use tools/register_gvhmr_api_worker.py with
--worker-python, --gvhmr-repo, --gvhmr-checkpoint, --hmr2-checkpoint,
--vitpose-checkpoint, --smplx-model, and --output. Set
BASEBALL_GVHMR_WORKER_RECORD to that output file. Registration verifies the
pinned source and asset hashes; it does not download files.
Test both models
Use the same motion API, with options.model equal to
sam3d or gvhmr. Follow returned status/result URLs. Test the same uploaded
source through source_asset_id or a model-switch revision. Each output carries
the selected model, anatomy, timestamp mapping and independent immutable files.
The adapter tests verify mapping, timestamps, missing observations, SO(3) resampling, projections and reproducible measurements using known synthetic sequences. They do not establish GVHMR's real-video accuracy. Real GPU comparison requires the licensed file; independent reference validation is still separate.