Hey there! Quick question—do you know what quantization is?
In the world of generative AI, quantization means shrinking the size of an AI model without tanking its accuracy. Pretty neat, right?
So, while pondering quantization, a wild thought hit me:
This model quantization… the progress isn’t moving at all…
Modern heavyweight models are absolute chonkers—they act like users have infinite resources or something!
Progress that never ends
When the progress bar refuses to budge, it stops being fun.
If AI gets to enjoy quantization, shouldn’t the progress bar get quantized too during the wait?
And in a fancier way, no less.
A Fancier Way?
The best way to tackle a confusing concept is to throw an even more confusing concept at it.
Speaking of confusing quantum stuff…
Quantum Mechanics, Anyone?
What’s Quantum Mechanics?
Quantum mechanics can describe many systems that classical physics cannot. Classical physics can describe many aspects of nature at an ordinary (macroscopic and (optical) microscopic) scale, but is not sufficient for describing them at very small submicroscopic (atomic and subatomic) scales. Most theories in classical physics can be derived from quantum mechanics as an approximation, valid at large (macroscopic/microscopic) scale.
Features common across versions of the Copenhagen interpretation include the idea that quantum mechanics is intrinsically indeterministic, with probabilities calculated using the Born rule, and the principle of complementarity, which states that objects have certain pairs of complementary properties that cannot all be observed or measured simultaneously. Moreover, the act of "observing" or "measuring" an object is irreversible, and no truth can be attributed to an object except according to the results of its measurement (that is, the Copenhagen interpretation rejects counterfactual definiteness).
Yup, I’m already lost.
But for those of us staring at progress bars like hawks, it’s perfect.
Quantumizing the Progress Bar (quantum-progress-bar)
So, I went ahead and released a Python library: quantum-progress-bar
.
https://github.com/FlatBone/quantum-progress-bar
Now you can use a progress bar that changes every time you look at it!
Installation
Install it in a Python-ready environment:
pip install quantum-progress-bar
Basic Usage
Check out the details in README.md.
Here’s the basic gist:
from quantum_progress_bar import quantum_progress
quantum_progress(total=100, width=50, delay=0.2)
The output’s random every time. It might look like this (and yes, it actually finishes):
[▓▒░█▄▌ ] 42% # First peek
[█▄▌▓▒ ] 38% # Time reversal, oops
[█▓▒░█▄▌▓█....█] 100% # Miraculous collapse
For a more serious vibe, use the class-based approach:
from quantum_progress_bar import QuantumProgressBar
pb = QuantumProgressBar(total_steps=100)
for _ in range(10):
pb.quantum_progress()
print(f" Time remaining: {pb.uncertainty_estimate()}")
The remaining time might say stuff like “5 minutes (probably between 3 minutes - 12 minutes)
” or, occasionally, “42 light years ± uncertainty principle
”.
Quantum entanglement
Quantum entanglement can also be eobserved
from quantum_progress_bar import QuantumProgressBar, quantum_progress, quantum_loading, qqdm
import time
# Entangle with another progress bar
pb = QuantumProgressBar(total_steps=100)
for _ in range(10):
pb.quantum_progress()
print(f" Time remaining: {pb.uncertainty_estimate()}")
pb2 = QuantumProgressBar(total_steps=100)
pb.entangle(pb2)
pb.update(steps=10) # Affects both bars due to entanglement
pb.quantum_progress(width=50)
print()
pb2.quantum_progress(width=50)
print()
Using It Like tqdm
Want a tqdm
-style iterator? Import qqdm
:
from quantum_progress_bar import qqdm
for i in qqdm(range(200)):
time.sleep(0.01)
Quick Play Code
from quantum_progress_bar import QuantumProgressBar, quantum_progress, quantum_loading, qqdm
import time
print("🔬 Quantum Progress Bar Demo 🔬")
print("=" * 50)
print("\n1. Basic usage of quantum progress bar")
print("-" * 30)
# Display a quantum progress bar
quantum_progress(total=100, width=50, delay=0.1)
print("\n2. Direct usage of QuantumProgressBar class")
print("-" * 30)
# Initialize a quantum progress bar
pb = QuantumProgressBar(total_steps=1000, collapse_factor=0.7, uncertainty_level=0.9)
# Display progress
for _ in range(5):
progress = pb.quantum_progress(width=50)
print(f" Estimated time: {pb.uncertainty_estimate()}")
time.sleep(0.1)
print("\n3. Quantum entanglement")
print("-" * 30)
# Entangle with another progress bar
pb2 = QuantumProgressBar(total_steps=100)
pb.entangle(pb2)
pb.update(steps=10) # Affects both bars due to entanglement
pb.quantum_progress(width=50)
print()
pb2.quantum_progress(width=50)
print()
print("\n4. Quantum loading animation")
print("-" * 30)
quantum_loading(message="Loading quantum state", duration=10, width=50)
print("\n5. Usage of qqdm function like tqdm")
print("-" * 30)
print("Example of wrapping an iterator:")
for i in qqdm(range(200)):
# Some processing
time.sleep(0.05)
print("\nExample of using as a context manager:")
with qqdm(total_steps=20) as qbar:
for i in range(20):
# Some processing
time.sleep(0.05)
qbar.update(1)
print("\nThank you for enjoying the quantum progress display!")
Cline
I leaned heavily on Cline for the implementation—Claude 3.7 Sonnet, to be exact. Cost me about a buck. Writing the README first might’ve been the smart move.
Practicality
It’s great for processes where you want the progress to stay vague.
Or maybe use it to show non-engineers that “Whoa, this program is working super hard!!”
References
Some legendary references:
- On the Law of Distribution of Energy in the Normal Spectrum
- On a Heuristic Point of View Concerning the Production and Transformation of Light
- Quantization as an Eigenvalue Problem
Links
The README’s just as goofy, so give it a peek!
Top comments (0)