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 everychecktimesecondsmsg: 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)
Profile Timing Line by Line
from flashtool import line_time_profiler
@line_time_profiler()
def f(n=1000):
a = [1 for _ in range(n)]
b = sum(a)
f()
f(10000)
class C:
@line_time_profiler()
def f(self, n=1000):
a = [1 for _ in range(n)]
b = sum(a)
ins = C()
ins.f()
ins.f(10000)
@line_time_profiler(stop=True)
def f(n=1000):
a = [1 for _ in range(n)]
b = sum(a)
f()
Metadata
Release files for flashtool 0.0.10
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 | Actions |
|---|---|---|---|---|
| flashtool-0.0.10.tar.gz | 4.7 kB | Without provenance | Details for flashtool-0.0.10.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| flashtool-0.0.10-py3-none-any.whl | Python 3 | none | any | Details for flashtool-0.0.10-py3-none-any.whl |
Total release size: 11.8 kB
Release files / flashtool-0.0.10.tar.gz
| Download URL | flashtool-0.0.10.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4251325430c3a131a913a3f16ddec9fb96e06f02932d278f7d41e987130683b8
|
|
BLAKE2b-256 checksum How to use checksums |
a31bfc6d6636afd7b0a8d3dda6eed7c15615e4eed3ba40b7488434c1d44915a6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.7
|
Release files / flashtool-0.0.10-py3-none-any.whl
| Download URL | flashtool-0.0.10-py3-none-any.whl |
|---|---|
| Size | 7.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ee9ff9b00f5fe74c1bb1a3a41444966030b5bf35316b23baebe194723656d5e1
|
|
BLAKE2b-256 checksum How to use checksums |
a61d8e00e398adce201b8f156842838ce47e78a7b73a9e11f05c7b6eaa7923c9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.7
|
Security for flashtool 0.0.10
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.