A few ready-to use python tools for machine learning
Project description
FlashPythonToolbox
A few ready-to use python tools for machine learning
Install
pip install flashtool
Logger (to file)
For every print function, we print a copy to file without changing the whole file.
Logger(filepath = "./log.txt", mode = "w", stdout = None)
filepath
: output path. Default: "./log.txt"mode
: write mode, e.g., w,w+,a,a+. Default: "w"stdout
: capture which print source. Default: "sys.stdout"
Example:
from flashtool import Logger import sys sys.stdout = Logger("path/to/log/file/log.txt") sys.stdout = Logger("path/to/log/file/log.txt","w") sys.stdout = Logger("path/to/log/file/log.txt","w", sys.stdout)
Email Module
Default Sender: gtflashauto@gmail.com
. You need a password for this.
# Function api def send_email(port = 587,password = None, sender_email = "gtflashauto@gmail.com", smtp_server="smtp.gmail.com", receiver_email = None, subject="Subject", message="Hello! ", attachment=None): ... # Example from flashtool import send_email send_email(receiver_email="xxx@gmail.com", subject="Hi", message="first email")
Track Job
Track your job. Send you an email when it is done.
Tracking by PID
- Step 1: find your job pid by
ps
, e.g.,ps aux | grep python
- Step 2:
from flashtool import trackpid trackpid(12345,5,"xxx@gmail.com") trackpid([1357,2468],5,"xxx@gmail.com")
API:
def trackpid(pid, checktime=1, receiver_email=None, sender_email="gtflashauto@gmail.com", msg=""): ...
pid
: pid or pidschecktime
: check pid everychecktime
secondsmsg
: additional message
Pytorch Utils
GPU Usage
import flashtool as flash; flash.check_torch_memory(brief=True)
brief
: short message (default: Flase)
Auto Script Running
import flashtool as flash; basescript='script/run.sh' config={ "DATA": "subset5" } flash.run_script(basescript, config)
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.
Filename, size | File type | Python version | Upload date | Hashes |
---|---|---|---|---|
Filename, size flashtool-0.0.9-py3-none-any.whl (6.4 kB) | File type Wheel | Python version py3 | Upload date | Hashes View |
Filename, size flashtool-0.0.9.tar.gz (4.2 kB) | File type Source | Python version None | Upload date | Hashes View |
Close
Hashes for flashtool-0.0.9-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9e5b606f8f97459dd74b8a87b87fe668759eac84d291c444a2fc4c8a57362257 |
|
MD5 | 97812fc7c0f51cd46172ea2fa72826c3 |
|
BLAKE2-256 | 1a82eb3d57b1ed7457a6e67c0567a913288083a63b76a4eef40c723c3dd0fb2a |