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.1.tar.gz (29.3 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.1-py3-none-any.whl (31.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ai4one-0.3.1.tar.gz
  • Upload date:
  • Size: 29.3 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.1.tar.gz
Algorithm Hash digest
SHA256 0e2a0d9b3ad4834e151265cd0193d1425d09f3e320f211966ac536ee69562f1f
MD5 f9b8db60225eb9a3db2c8e0d75ac3be9
BLAKE2b-256 32513e046b7ec27ebee33d793a2506860deb03a9d957a7413ee8efc46c41edba

See more details on using hashes here.

Provenance

The following attestation bundles were made for ai4one-0.3.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: ai4one-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 31.9 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2e4983f527b0adb1a02b45984ca893b276b9196e784fd99c17c7dfdcd68940b4
MD5 2bb14d37a90830d0f3655cedcc85682a
BLAKE2b-256 49900c5404f5fd4f3509ecd22389f9fa680d6930e42b7e180b1d82255e77fa6c

See more details on using hashes here.

Provenance

The following attestation bundles were made for ai4one-0.3.1-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