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-1.0.tar.gz
(16.5 kB
view details)
Built Distribution
efficiency-1.0-py3-none-any.whl
(21.8 kB
view details)
File details
Details for the file efficiency-1.0.tar.gz
.
File metadata
- Download URL: efficiency-1.0.tar.gz
- Upload date:
- Size: 16.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.7.1 pkginfo/1.7.1 requests/2.25.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
bcc09e1289424e9f4f564c79db23fd97739eac7c1d109fe7c567640c6cfd1c01
|
|
MD5 |
5617f4941b1319e1273017a9eb42ba51
|
|
BLAKE2b-256 |
9969595d62fd0101bb2bddd9d2fd9be50109769fef79a747aefa87930c903057
|
File details
Details for the file efficiency-1.0-py3-none-any.whl
.
File metadata
- Download URL: efficiency-1.0-py3-none-any.whl
- Upload date:
- Size: 21.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.7.1 pkginfo/1.7.1 requests/2.25.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
1c1308134b6b4d2838b7b04ee4451774ff0cd7ceaff401ef7a4839a9ae9c233b
|
|
MD5 |
6f57b4261fbafa28e57d68dbf7498505
|
|
BLAKE2b-256 |
85b2b9314f51b9e1f886f6a61786a683df3b8de1de5df245de591773ecdfaeed
|