With the advent of complex machine learning models and experiments, tracking hyperparameters and organizing configurations can become a daunting task. Enter Paramit, an open-source framework that simplifies the process of parameterizing Python scripts and Jupyter notebooks straight from the command line. In this guide, we’ll walk you through using Paramit to streamline your machine learning workflows.
What is Paramit?
Paramit allows users to make their scripts and notebooks production-ready without manually tracking configuration files. It automates several mundane tasks such as:
- Config files without any code: Automatically probes the source code to generate reproducible config files.
- Grid search from CLI: Use the command line to directly iterate through hyperparameters.
- Automatic experiment logging: Generates separate output folders for reproducible configs per experiment.
- Scale to the Cloud: Potentially send models to clouds for parallel experimentation in the future.
Whether you’re coding in Windows, Linux, or OSX, Paramit is here to ease your experimentation process!
Getting Started with Paramit
To get started, follow these steps:
- Install Paramit using pip:
- If you wish to utilize notebook hosting, run:
- On Linux, you might need to install a virtual environment package:
- Ensure that your Python script (e.g., script.py) has an associated requirements.txt file in the same directory.
pip install paramit
pip install paramit[notebook]
apt install python3.10-venv
Example Usage of Paramit
Imagine you’re managing an orchard and you want to calculate the price of apples based on quantity and price per apple. Here’s how you could structure your code:
import numpy as np
num_apples = 100
apple_price = 3.0
print("Number of apples:", num_apples)
print("Price of an apple:", apple_price)
total_price = num_apples * apple_price
print("Total:", total_price)
In this simplistic example, tracking adjustments to num_apples and apple_price can become cumbersome. However, with Paramit, you can modify these variables directly through the command line.
To run the script with modified parameters, you would execute:
paramit run script.py --num-apples 30
Paramit will generate a script.toml configuration file that allows further experimentation without losing track of changes. You can run parameter grid searches like so:
paramit run script.py --num-apples 30,60 --apple-price 1.0,2.0
Using Paramit with Jupyter Notebooks
Do you enjoy using Jupyter notebooks for data exploration? Paramit will also integrate seamlessly with notebooks. Run notebooks like scripts to experiment with multiple configurations:
paramit run script.ipynb --num-apples 30,40,50
If you want to run the notebook with a dedicated configuration folder to organize results better, use:
paramit notebook script.ipynb --num-apples 30
Demo on Google Colab
Prefer working in the cloud? You can find a Google Colab demo [here](https://colab.research.google.com/drive/12jY7Kr1Rupj-aJFjlIRgZf1x-nySQdoJ?usp=sharing)!
Troubleshooting Tips
As with any powerful tool, you might run into a few bugs or issues during your experiments:
- To resolve installation issues, double-check if all dependencies are correctly listed in your requirements.txt.
- If your script fails to execute, ensure you have the correct environment variables set (like PATHTOYOURPYTHONINTERPRETER).
- For bugs or concerns, you can report them on the GitHub Issues page or join the Discord community for real-time discussion.
For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.
Next Steps
Consider checking out these more complex examples on GitHub to explore what else you can achieve with Paramit!
Conclusion
At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.

