Skip to main content

A harness project for ML & DL

Project description

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 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()

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

ai-harness-0.4.8.tar.gz (82.3 kB view details)

Uploaded Source

Built Distribution

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

ai_harness-0.4.8-py2.py3-none-any.whl (80.9 kB view details)

Uploaded Python 2Python 3

File details

Details for the file ai-harness-0.4.8.tar.gz.

File metadata

  • Download URL: ai-harness-0.4.8.tar.gz
  • Upload date:
  • Size: 82.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0.post20200518 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.6.0

File hashes

Hashes for ai-harness-0.4.8.tar.gz
Algorithm Hash digest
SHA256 bccae3a5f367fe5d24625384cfa0bd14b0c5db682578582b9a6e4d757e06bf1e
MD5 c76eb0aa5b4ed34bb1c939444eeed8fc
BLAKE2b-256 32a50bb96fcbac92434306547ea09f66b0b3e938241a36f88b61b86a3cafbb6d

See more details on using hashes here.

File details

Details for the file ai_harness-0.4.8-py2.py3-none-any.whl.

File metadata

  • Download URL: ai_harness-0.4.8-py2.py3-none-any.whl
  • Upload date:
  • Size: 80.9 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0.post20200518 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.6.0

File hashes

Hashes for ai_harness-0.4.8-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 881c5971ff00615777a0a704e45eaf377f198af149074ecb39e862b5b6a143b1
MD5 782c68aa5225cf08e2614587e9769efb
BLAKE2b-256 137d3b556717c5c270625a6dd6ad705d75bdc245b7a8cf93d2533d8d28d6f97c

See more details on using hashes here.

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