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
该模块提供了一些用于绘图的工具函数。
-
setup_fonts函数用于设置 matplotlib 字体,以支持中文字符。主要用途是跨平台支持中文字符的显示。
- 默认配置为
New Times Roman、SimSun和SimHei两种字体。 - 使用详情查看 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.
-
Clone the repository:
git clone https://github.com/bestenevoy/ai4one.git cd ai4one
-
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. -
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/*
Metadata
Release files for ai4one 0.3.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| ai4one-0.3.2.tar.gz | 29.4 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ai4one-0.3.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 61.3 kB
Release files / ai4one-0.3.2.tar.gz
| Download URL | ai4one-0.3.2.tar.gz |
|---|---|
| Size | 29.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b3d97781123585e921cd88991f68c86f1e7a1fb09831b8cc8eabc6379deb2b3f
|
|
BLAKE2b-256 checksum How to use checksums |
ccf90df8c73abb98db6d4a1395e70a7c67476c4cb437336155f40f038bdc5814
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 24, 2025.
Transparency logRelease files / ai4one-0.3.2-py3-none-any.whl
| Download URL | ai4one-0.3.2-py3-none-any.whl |
|---|---|
| Size | 32.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cbb790163dc502e3aaa4861c941e1e531cc4dbb712258f0ca311594b7deba073
|
|
BLAKE2b-256 checksum How to use checksums |
7548344501f3a9fbfa8944613e68eea133c3328556ef6ffe5f6fce0290d65f52
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 24, 2025.
Transparency logSecurity for ai4one 0.3.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for ai4one-0.3.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 24, 2025.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.