Skip to main content

ai_library

ai_library is a Python package that exposes model training, inference, metrics recording, cron scheduling, and package-based configuration management.

Package overview

The package is structured so that import ai_library is safe and does not execute heavy runtime logic. Core user-facing functionality is available through lazy exports exposed from ai_library/__init__.py.

Available top-level APIs

  • ai_library.validate_config(config_path=None)

    • Loads and validates the package default ai_library/config.yaml if no path is provided.
    • Returns the parsed configuration dictionary.
  • ai_library.update_config(config_path=None, updates=...)

    • Updates the package config file by default.
    • Supports a dictionary, a [key, value] pair, or a list of [key, value] pairs.
  • ai_library.show_config(config_path=None)

    • Prints the current configuration to stdout.
  • ai_library.train()

    • Loads configuration from the package config.
    • Reads data, builds the selected pipeline, and trains the model.
  • ai_library.infer()

    • Loads package configuration.
    • Loads a saved model and performs inference.
  • ai_library.record

    • Lazy-imported recorder module.
    • Use ai_library.record.main() or run the module directly to start metric collection.
  • ai_library.add_to_cron() / ai_library.remove_from_cron()

    • Manage cron scheduling for recurring training runs.
    • Adds or removes a cron job that runs python3 -m ai_library.codebase.setup.train.

Installation

From source:

python3 -m pip install -e .

From a built wheel or sdist:

python3 -m pip install dist/ai-library-swch-0.1.0-py3-none-any.whl

Configuration

The default configuration file lives inside the package at ai_library/config.yaml. This package is designed so that the default config is editable through the helper API:

from ai_library import validate_config, update_config, show_config

config = validate_config()
print(config)

update_config(None, {"pipeline_type": "gmlp"})
show_config()

Note: editing ai_library/config.yaml via update_config(None, ...) works cleanly during development or editable installs. If the package is installed from a read-only wheel, consider using an explicit config path or a custom location.

Usage

Training

python3 -m ai_library.codebase.setup.train

Or programmatically:

from ai_library import train
train()

Inference

python3 -m ai_library.codebase.setup.infer

Or programmatically:

from ai_library import infer
infer()

Metric recording

python3 -m ai_library.codebase.setup.record --out-dir ./data --run-seconds 60

Or programmatically:

from ai_library import record
record.main()

Cron scheduling

from ai_library import add_to_cron, remove_from_cron
add_to_cron()
remove_from_cron()

File structure

  • ai_library/
    • __init__.py — lazy exports and package-level API surface.
    • config.yaml — default package config.
    • codebase/
      • helpers/ — helper utilities such as config_helper.py.
      • models/ — model pipeline classes.
      • setup/ — training, inference, recording, and cron management modules.

Notes

  • ai_library.record is lazy-loaded so importing ai_library does not import heavy recorder dependencies until you actually access it.
  • The package currently relies on package-relative config loading, so the package config file is the main runtime configuration source.
  • Model training and inference rely on the dataset, saved model files, and other paths configured in ai_library/config.yaml.

Recommended next improvements

  • Add a runtime override for external config files.
  • Add automated tests for training and inference flows.
  • Document environment dependencies and the exact requirements.txt contents.

Download files

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

Source Distribution

ai_library_swch-0.1.0.tar.gz (24.0 kB view details)

Uploaded Source

Built Distribution

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

ai_library_swch-0.1.0-py3-none-any.whl (29.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ai_library_swch-0.1.0.tar.gz
  • Upload date:
  • Size: 24.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for ai_library_swch-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8368935cc0d81ffabf0ef38e9a47c0d0258e7e7b9f803c2556ad10aee3f4485d
MD5 a53fdea794224716be10b0244275dff0
BLAKE2b-256 a273fd6a969ac480ad74c4dd7ff937a4c5fcfef2f91ce8081d6c2304b577213b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ai_library_swch-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4c69b4b71c94cae6652952f6afb3603facdfceba39e921c3dbcc7d387d9d50e4
MD5 2cad698a8a33e8b24b686c61e45543f7
BLAKE2b-256 417882adc08209c99d4ed60af6c35c47a93ece86dc170b2416c5bd330210aa32

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 Sentry Error logging StatusPage Status page