Skip to main content

A lightweight inference pipeline for pseudo-labeling and model prototyping.

Project description

Pseudo-Labeling Inference Pipeline

A lightweight inference pipeline for running various models on datasets like CIFAR-10, ImageNet, etc., configured via Hydra.

Quick Start

1. Setup Environment

Ensure your environment is set up with the required dependencies.

pip install -r requirements.txt
# Or use the existing conda env
conda activate proxy-det

2. Run Inference

Run the main script. By default, it runs resnet18 on cifar10 (or whatever defaults are in configs/config.yaml).

python main.py

3. Verify Setup & Usage

Run the included example script to understand how to interact with the dataset wrappers and verify your environment.

python src/test/example_usage.py

Features

  • Batch Inference: Efficiently run pytorch models on standard datasets.
  • Streaming Data: Support for streaming huge datasets (e.g., ImageNet-1k) from Hugging Face without downloading.
  • Label Mapping: Auto-map predictions between different label spaces (e.g., ImageNet -> CIFAR10).

Project Structure

├── configs/            # Hydra configs
├── src/
│   ├── datasets/       # Dataset wrappers (standard & streaming)
│   ├── models/         # Model definitions
│   ├── inference/      # Inference engine
│   ├── test/           # Tests and verification scripts
├── main.py             # Entry point
└── requirements.txt

Testing & Verification

The project includes a src/test directory with unit tests and examples.

Run Unit Tests:

python src/test/test_wrappers.py

Tests all wrappers including streaming and reliability edge cases.

Run Usage Example:

python src/test/example_usage.py

Demonstrates how to initialize wrappers (both local and streaming) and access data.

Output

Results are saved to the outputs/ directory by default.

Filename Format: [dataset_name]-[model_name]-[split].csv

CSV Structure:

sample_id,prediction,confidence,ground_truth
cifar10_test_0,776,0.2668,3
...
  • sample_id: Unique identifier for the sample.
  • prediction: The class index predicted by the model (mapped to target dataset space if applicable).
  • confidence: The probability/confidence score of the prediction.
  • ground_truth: The actual class label.

Label Mapping

To handle label discrepancies (e.g., ImageNet model on CIFAR10), the system automatically maps equivalent classes using JSON files in configs/mappings/.

  • Model Config: Models define their source_dataset (e.g., imagenet1k).
  • Logic: If source != target, predictions are mapped. Unmapped classes become -1.
  • Supported Mappings: ImageNet1k -> Imagenette, CIFAR10 (208 classes), CIFAR100 (131 classes).

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

pseudo_labeling-0.1.0.tar.gz (32.7 kB view details)

Uploaded Source

Built Distribution

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

pseudo_labeling-0.1.0-py3-none-any.whl (43.9 kB view details)

Uploaded Python 3

File details

Details for the file pseudo_labeling-0.1.0.tar.gz.

File metadata

  • Download URL: pseudo_labeling-0.1.0.tar.gz
  • Upload date:
  • Size: 32.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pseudo_labeling-0.1.0.tar.gz
Algorithm Hash digest
SHA256 dbab52af2248738dc93d00dda3f8f3943c98afdc9c6fef3162b23a3b710989cd
MD5 a13e84f6bcc45d862c6581d22498c763
BLAKE2b-256 c50392790c00479dc67348cdde67305d5a1d762fe4a84f66665df1f14bab99bc

See more details on using hashes here.

Provenance

The following attestation bundles were made for pseudo_labeling-0.1.0.tar.gz:

Publisher: workflow.yml on ViGeng/pseudo-labeling

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pseudo_labeling-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pseudo_labeling-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 938d22a19ef287c8f5f7de630316844605d3f6a4f8838efbc2efed95fcbe7b66
MD5 71793eb82e5f931eec70e63a624db635
BLAKE2b-256 b7f3d2badcddb404bd37b8ddfd5441ffeabb0771b91e7c6cec35207097cdf1f5

See more details on using hashes here.

Provenance

The following attestation bundles were made for pseudo_labeling-0.1.0-py3-none-any.whl:

Publisher: workflow.yml on ViGeng/pseudo-labeling

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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