Skip to content

feat: Huggingface#78

Merged
jtschwar merged 6 commits into
mainfrom
huggingface
Jul 20, 2026
Merged

feat: Huggingface#78
jtschwar merged 6 commits into
mainfrom
huggingface

Conversation

@jtschwar

Copy link
Copy Markdown
Collaborator

Summary

Adds support for pretrained checkpoints hosted on the Hugging Face Hub, restructures
membrane extraction into a general extract command group, and finishes migrating the
CLI to URI-based flags (--tomo-uri, --seg-uri, --target-uri) across the remaining
commands.

Changes

Hugging Face Hub checkpoints

  • New octopi/utils/hub.py: resolves a checkpoint alias (e.g. tomogram-boundary) against
    the biohub/octopi Hub repo, downloading weights + config on demand and caching locally.
    Falls back to treating --model-weights as a local path when it isn't a known alias.
  • octopi segment / octopi.workflows.segment: --model-config is now optional — omit it
    when --model-weights is a Hub alias, since its config is bundled and downloaded
    automatically. Still supports comma-separated paths for model-soup ensembles.
  • Adds huggingface_hub as a dependency (pyproject.toml).

extract command group

  • Replaces the standalone membrane-extract command with octopi extract, a group with
    two subcommands:
    • extract mb-picks — the existing membrane-proximity pick splitting (unchanged logic,
      moved under the group).
    • extract seg (new, octopi/extract/segmentations.py) — isolates a single object's
      binary mask from a multi-class segment prediction, using the inference log written by
      segment to recover voxel size and label mapping.

URI-based CLI cleanup

  • octopi segment: finishes the URI migration — takes --tomo-uri (algorithm@voxel_size)
    and --seg-uri (name:user_id/session_id) directly; URI parsing now happens once inside
    workflows.segment() instead of in the CLI layer.
  • octopi.workflows.segment() signature changed to (config, model_weights, model_config, tomo_uri, seg_uri, ...) — parses both URIs internally.
  • pytorch/segmentation.py renamed to pytorch/inference.py (predictor classes only,
    no behavior change) to disambiguate from the new extract/segmentations.py.
  • Removed the dead nnUNet CLI group reference from entry_points/groups.py.

MCP server

  • Updated tool instructions/help text for the new extract group and optional
    --model-config.
  • get_command_help now supports group subcommands (e.g. "extract seg").
  • Added guidance to default to CLI commands and only suggest the octopi.workflows Python
    API when the user is clearly scripting/notebooking, not running a one-off command.

Docs

  • Updated docs/api/inference.md, docs/user-guide/inference.md, docs/user-guide/labels.md,
    and others for the new checkpoint-alias workflow and extract group.

Comment thread octopi/pytorch/pg_server.py Fixed
jtschwar and others added 4 commits July 16, 2026 11:03
…all network interfaces'

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@jtschwar
jtschwar requested a review from ESmi99 July 20, 2026 19:07
@jtschwar
jtschwar merged commit 7ddfbc4 into main Jul 20, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants