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
该模块提供了一些用于绘图的工具函数。
-
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/*
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0e2a0d9b3ad4834e151265cd0193d1425d09f3e320f211966ac536ee69562f1f
|
|
| MD5 |
f9b8db60225eb9a3db2c8e0d75ac3be9
|
|
| BLAKE2b-256 |
32513e046b7ec27ebee33d793a2506860deb03a9d957a7413ee8efc46c41edba
|
Provenance
The following attestation bundles were made for ai4one-0.3.1.tar.gz:
Publisher:
publish.yml on bestenevoy/ai4one
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ai4one-0.3.1.tar.gz -
Subject digest:
0e2a0d9b3ad4834e151265cd0193d1425d09f3e320f211966ac536ee69562f1f - Sigstore transparency entry: 426167212
- Sigstore integration time:
-
Permalink:
bestenevoy/ai4one@935d71c06725ba53e4c815dfa37635a0835a9384 -
Branch / Tag:
refs/tags/v0.3.1 - Owner: https://github.com/bestenevoy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@935d71c06725ba53e4c815dfa37635a0835a9384 -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e4983f527b0adb1a02b45984ca893b276b9196e784fd99c17c7dfdcd68940b4
|
|
| MD5 |
2bb14d37a90830d0f3655cedcc85682a
|
|
| BLAKE2b-256 |
49900c5404f5fd4f3509ecd22389f9fa680d6930e42b7e180b1d82255e77fa6c
|
Provenance
The following attestation bundles were made for ai4one-0.3.1-py3-none-any.whl:
Publisher:
publish.yml on bestenevoy/ai4one
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ai4one-0.3.1-py3-none-any.whl -
Subject digest:
2e4983f527b0adb1a02b45984ca893b276b9196e784fd99c17c7dfdcd68940b4 - Sigstore transparency entry: 426167223
- Sigstore integration time:
-
Permalink:
bestenevoy/ai4one@935d71c06725ba53e4c815dfa37635a0835a9384 -
Branch / Tag:
refs/tags/v0.3.1 - Owner: https://github.com/bestenevoy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@935d71c06725ba53e4c815dfa37635a0835a9384 -
Trigger Event:
push
-
Statement type: