Skip to main content

A small machine learning package

Project description

AI4One 🤖

A small, modular package for machine learning.


Installation

pip install ai4one

This package requires Python 3.8 or newer.


Usage

ai4one.config

3.9>=Python 版本>=3.7, 请使用pip isntall ai4one~=0.2安装 ai4one=0.2 版本。

The primary feature of this package is a powerful configuration system. For a comprehensive guide and examples, please see the Configuration System Guide.

from ai4one.config import BaseConfig, field
from typing import List

class TrainConfig(BaseConfig):
    learning_rate: float = 0.001
    epochs: int = 10
    optimizer: str = "Adam"
    layers: List[int] = [3, 3]

if __name__ == "__main__":
    config = TrainConfig.argument_parser()
    print(f"Using optimizer: {config.optimizer}")

You can also run the self-contained example to see it in action:

examples/example_config.py

ai4one.cli

ai4one gpu

Outputs:

--- CUDA Version ---
12.7 

--- PyTorch Version ---
2.1.0+cu121

--- Python Version ---
Python 3.10.12

--- Python Executable Path ---
/usr/bin/python

ai4one.tools

ai4one.tools.plt

该模块提供了一些用于绘图的工具函数。

  1. setup_fonts 函数用于设置 matplotlib 字体,以支持中文字符。

    主要用途是跨平台支持中文字符的显示。

    • 默认配置为 New Times RomanSimSunSimHei 两种字体。
    • 使用详情查看 tools.plt
from ai4one.tools.plt import setup_fonts
setup_fonts(["New Times Roman", "SimSun", "SimHei"])

Development

Interested in contributing? Set up your local development environment with uv.

  1. Clone the repository:

    git clone https://github.com/bestenevoy/ai4one.git
    cd ai4one
    
  2. Create a virtual environment and install dependencies: This command installs all core, optional, and development dependencies.

    uv pip install -e ".[dev]"
    

    To keep your environment in sync with the lock file, you can run uv sync.

  3. Run tests:

    uv run pytest
    

Build and Publish

These commands are for package maintainers.

Build the package:

uv build

Publish to PyPI:

uv run twine upload dist/*

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

ai4one-0.3.2.tar.gz (29.4 kB view details)

Uploaded Source

Built Distribution

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

ai4one-0.3.2-py3-none-any.whl (32.0 kB view details)

Uploaded Python 3

File details

Details for the file ai4one-0.3.2.tar.gz.

File metadata

  • Download URL: ai4one-0.3.2.tar.gz
  • Upload date:
  • Size: 29.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for ai4one-0.3.2.tar.gz
Algorithm Hash digest
SHA256 b3d97781123585e921cd88991f68c86f1e7a1fb09831b8cc8eabc6379deb2b3f
MD5 9106a6bb08393c5c99b56fb58dc48c91
BLAKE2b-256 ccf90df8c73abb98db6d4a1395e70a7c67476c4cb437336155f40f038bdc5814

See more details on using hashes here.

Provenance

The following attestation bundles were made for ai4one-0.3.2.tar.gz:

Publisher: publish.yml on bestenevoy/ai4one

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

File details

Details for the file ai4one-0.3.2-py3-none-any.whl.

File metadata

  • Download URL: ai4one-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 32.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for ai4one-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 cbb790163dc502e3aaa4861c941e1e531cc4dbb712258f0ca311594b7deba073
MD5 f8c8d90d99af048a80194be1a8bb13d0
BLAKE2b-256 7548344501f3a9fbfa8944613e68eea133c3328556ef6ffe5f6fce0290d65f52

See more details on using hashes here.

Provenance

The following attestation bundles were made for ai4one-0.3.2-py3-none-any.whl:

Publisher: publish.yml on bestenevoy/ai4one

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