A package for efficient programming
Project description
efficiency
This is a package of useful one-line logging functions made by Zhijing.
Installation
Requirement: Python 3
pip install --upgrade git+git://github.com/zhijing-jin/efficiency.git
pip install --user -r requirements.txt
Logging Shortcuts
Obtain time:
>>> from efficiency.log import show_time, fwrite
>>> time_stamp = show_time()
time: 11241933-41
>>> time_stamp
'11241933' # means: Nov 24th, 19:33
Writing out to files by one line:
>>> text = "This is handy!"
>>> fwrite(text, "temp.txt")
Printing out variables (name + value) easily:
>>> num1 = 7
>>> num2 = 2
>>> num3 = 9
>>> show_var(["num1", "num2", "num3"])
num1 : 7
num2 : 2
num3 : 9
ML-Related
>>> from efficiency.log import gpu_mem
>>> gpu_mem(gpu_id=0)
4101 # Currently, GPU Memory of GPU #0 is 4101 MiB
>>> from efficiency.function import set_seed
>>> set_seed(0)
[Info] seed set to: 0 # set the seed for random, numpy and pytorch
Useful Functions
>>> from efficiency.function import shell
>>> stdout, stderr = shell("cat temp.txt")
>>> stdout
b'This is handy!'
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
efficiency-0.4.tar.gz
(15.0 kB
view details)
File details
Details for the file efficiency-0.4.tar.gz
.
File metadata
- Download URL: efficiency-0.4.tar.gz
- Upload date:
- Size: 15.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.6.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
1a4120552f5880290cfe1a1174c161427c6afbdf9926a62627b422f297f05925
|
|
MD5 |
146e133825817e858aa2270984fcdce1
|
|
BLAKE2b-256 |
aa9b805e6da20cafbce2e2d08d92dce075d5cbb6316ecd473f4fe4f6373fb580
|