# AI Harness
## Introduction
This project would like to supply some convenient tools for the machine learning and deep learning.
Current features:
- XMLConfiguration: for loading a configuration defined in xml files into a Python Object
- Arguments: Mapping a Python Object to the arguments of argparse
- inspector: Some convenient method for class/object
- executors: Some convenient ProcessExecutor
- fileutils: DirectoryNavigator, FileReadPipeLine
- others:
## Log
- 2019.4.18, version: 0.3.0: Added distributed training tools for python
- 2019.4.23, version: 0.3.5: Added a Json file Reader
- 2019.4.24, version: 0.3.6: Added a data utils for processing data
- 2019.4.26, version: 0.3.7 Added a data utils for processing data for zip file
- 2019.4.28, version: 0.3.8 Added QueueExecutor
## Examples
### 1. XMLConfiguration
##### (1) Define the configuration in xml file like:
```xml
<?xml version="1.0" encoding="UTF-8" ?>
<configuration>
<arg name="name" default="TestName" help="Name Test Help"/>
<arg name="age" default="20" help="Age Test Help"/>
<group name="address">
<arg name="home" default="shanghai" help="Home test Help"/>
<arg name="phone" default="136" help="Phone test Help"/>
</group>
<group name="education">
<arg name="school" default="beijing" help="school test Help"/>
<arg name="grade" default="master" help="grade test Help"/>
</group>
</configuration>
```
you can define multiple xml configuration files, and if the name is same, the value of the later will cover the previous.
#### (3) Define the configuration class like:
```
from aiharness.configuration import configclass,field
@configclass
class Address:
phone: int = field(139, "phone help")
home: str = field("beijing", "phone help")
@configclass
class Education:
school: str = field('ustb', "phone help")
grade: str = field("master", "phone help")
@configclass
class Config:
name: str = field("test", "name help")
age: str = field(10, "age help")
address: Address = Address()
education: Education = Education()
```
#### (3) Load the xml configuration into python object as folling:
```
from aiharness.configuration import XmlConfiguration
config:Config=XmlConfiguration(Config).load(['configuration1.xml','configuration2.xml'])
```
### Arguments Example
Generally, we use argparse as following:
```
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--name",default='TEST',help='name help')
parser.add_argument("--age",default=18,help='age help')
arguments=parser.parse_args()
```
And you can got a arguments object.
Here give an example showing how to load a xml configuration and set to argparse arguments and to parse the arguments into a object you defined.
And here the Config Class and 'configuration.xml' are same with those of the Configuration example.
Firstly, in fact, the Config Class instead of the codes of 'add_argument' of the argparse.ArgumentParser.
Secondly, you can put the configuration into a xml file so that you can change it conveniently.
```
from aiharness.configuration import Arguments, XmlConfiguration
config: Config = XmlConfiguration(Config).load(['configuration.xml'])
arguments = Arguments(config)
config: Config = arguments.parse()
```
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
资源分类:Python库 所属语言:Python 资源全名:ai-harness-0.4.26.tar.gz 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
资源推荐
资源详情
资源评论
收起资源包目录
ai-harness-0.4.26.tar.gz (25个子文件)
ai-harness-0.4.26
MANIFEST.in 157B
PKG-INFO 5KB
src
ai_harness.egg-info
PKG-INFO 5KB
requires.txt 59B
SOURCES.txt 669B
top_level.txt 11B
dependency_links.txt 1B
ai_harness
xml2object.py 5KB
fileutils.py 10KB
executors.py 5KB
tqdmutils.py 868B
configuration.py 9KB
__init__.py 0B
datautils.py 1KB
harnessutils.py 874B
inspector.py 2KB
objectproxy.py 6KB
language
langconv.py 8KB
__init__.py 0B
zh_wiki.py 172KB
configclasses.py 30KB
setup.cfg 107B
setup.py 2KB
README.md 3KB
LICENSE.txt 1KB
共 25 条
- 1
资源评论
挣扎的蓝藻
- 粉丝: 14w+
- 资源: 15万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功