A small tool package for qq
Project description
✨qqtools✨
A lightweight library, crafted and battle-tested daily by qq, to make PyTorch life a little easier.
I’ve gathered the repetitive parts of my day-to-day work and refined them into this slim utility library. It serves as my personal toolkit for handling data, training, and experiments, designed to keep projects moving fast with cleaner code and smoother workflows (and hopefully yours too!).
Built for me, shared for you.
Requirements
- torch>=2.0 for full functionality
- Some components maintain backward compatibility with torch==1.x
- Recommended: torch>=2.4
- pyyaml>=6.0
- Recommended to use YAML format for all configuration files.
This provides a unified approach to drive and manage all workflow operations.
To get started quickly, install it via pip:
pip install qqtools
Install with full features:
pip install qqtools[full]
Data Format Support
Non-torch formats:
qDict : Enhanced of basic Dict.
qScalaDict : Dict[str, num]. A dict that maps str to scala;
qListData : List[dict]. A list of dicts.
Torch-related data formats
qData
qBatchList
Simple Training Loop
For jupyter users
import qqtools as qt
qt.import_common(globals())
x = np.random.rand(100, 5)
y = np.random.rand(100)
# dataset wrap
xs = [ x[i] for i in range(len(x))]
ys = [ y[i] for i in range(len(y))]
data_list = [ qt.qData({'x': x[i], 'y':y[i]}) for i in range(len(x))]
dataset = qt.qDictDataset(data_list=data_list)
dataloader = qt.qDictDataloader()
# model
model = qt.nn.qMLP([5,5,1], activation="relu")
loss_fn = torch.nn.MSELoss()
optimizer = torch.optim.AdamW(model.parameters(), lr=1.0e-4, weight_decay=0.01)
# device
device = torch.device("cuda")
model.to(device)
# loop
for epoch in range(100):
for batch in dataloader:
batch.to(device)
out = model(batch.x)
loss = loss_fn(out, batch.y)
optimizer.zero_grad()
loss.backward()
optimizer.step()
print(f"{epoch} {loss.item():4.6f}")
Individual Modules
The following modules are consumers of the core functionality provided by this package. Each is designed to be independent, allowing for sole import.
under plugins/
- qchem
- qpipeline
Test
tox
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file qqtools-1.1.32.tar.gz.
File metadata
- Download URL: qqtools-1.1.32.tar.gz
- Upload date:
- Size: 85.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e608ce3a463161559dcc53a362bb4116e86809dcb7731c299c3f93f9e4f2e2dc
|
|
| MD5 |
8c6ce9e434d91a52c4a0088beaa8cfbc
|
|
| BLAKE2b-256 |
e2272b2848cf816bfc51b03be4e6fffd4e0842b849c976808de10365b4cae985
|
File details
Details for the file qqtools-1.1.32-py3-none-any.whl.
File metadata
- Download URL: qqtools-1.1.32-py3-none-any.whl
- Upload date:
- Size: 106.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b2ca212f02a1372c81076c6a2764b7f2aadb712442289829d2f8a4961b0be977
|
|
| MD5 |
c581ac309888902de572972f3538d10a
|
|
| BLAKE2b-256 |
9dc6310d0cf10488d9c0f7d036a992252805b3641b914a3f7f8fc83b7c8931cc
|