continuation-jax : Continuaion Framework for lambda
Continuation methods of Deep Neural Networks Tags: optimization, deep-learning, homotopy, bifurcation-analysis, continuation
Install using pip:
Package: https://pypi.org/project/continuation-jax/
pip install continuation-jax
Import
import cjax
Math operations on Pytrees
>>> import cjax
>>> from cjax.utils import math_trees
>>> math_trees.pytree_element_mul([2,3,5], 2)
[4, 6, 10]
>>> math_trees.pytree_sub([2,3,5], [1,1,1])
[DeviceArray(1, dtype=int32), DeviceArray(2, dtype=int32), DeviceArray(4, dtype=int32)]
>>> math_trees.pytree_zeros_like({'a':12, 'b':45, 'c':[1,1]})
{'a': 0, 'b': 0, 'c': [0, 0]}
Examples:
- Examples: https://github.com/harsh306/continuation-jax/tree/main/examples
- Sample Runner: https://github.com/harsh306/continuation-jax/blob/main/model_simple_classifier/run.py
"""
Main file to run contination on the user defined problem. Examples can be found in the examples/ directory.
Continuation is topological procedure to train a neural network. This module tracks all
the critical points or fixed points and dumps them to output file provided in hparams.json file.
Typical usage example:
continuation = ContinuationCreator(
problem=problem, hparams=hparams
).get_continuation_method()
continuation.run()
"""
from cjax.continuation.creator.continuation_creator import ContinuationCreator
from examples.model_simple_classifier.model_classifier import ModelContClassifier
from cjax.utils.abstract_problem import ProblemWraper
import json
from jax.config import config
from datetime import datetime
import mlflow
from cjax.utils.visualizer import pick_array, bif_plot
config.update("jax_debug_nans", True)
# TODO: use **kwargs to reduce params
if __name__ == "__main__":
problem = ModelContClassifier()
problem = ProblemWraper(problem)
with open(problem.HPARAMS_PATH, "r") as hfile:
hparams = json.load(hfile)
mlflow.set_tracking_uri(hparams['meta']["mlflow_uri"])
mlflow.set_experiment(hparams['meta']["name"])
with mlflow.start_run(run_name=hparams['meta']["method"]+"-"+hparams["meta"]["optimizer"]) as run:
mlflow.log_dict(hparams, artifact_file="hparams/hparams.json")
mlflow.log_text("", artifact_file="output/_touch.txt")
artifact_uri = mlflow.get_artifact_uri("output/")
hparams["meta"]["output_dir"] = artifact_uri
print(f"URI: {artifact_uri}")
start_time = datetime.now()
if hparams["n_perturbs"] > 1:
for perturb in range(hparams["n_perturbs"]):
print(f"Running perturb {perturb}")
continuation = ContinuationCreator(
problem=problem, hparams=hparams, key=perturb
).get_continuation_method()
continuation.run()
else:
continuation = ContinuationCreator(
problem=problem, hparams=hparams
).get_continuation_method()
continuation.run()
end_time = datetime.now()
print(f"Duration: {end_time-start_time}")
figure = bif_plot(hparams["meta"]["output_dir"], pick_array)
mlflow.log_figure(figure, artifact_file="plots/fig.png")
Note on Hyperparameters
Papers:
Contact:
harshnpathak@gmail.com
Metadata
Release files for continuation-jax 0.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| continuation_jax-0.0.7.tar.gz | 57.4 kB | Without provenance | Details for continuation_jax-0.0.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| continuation_jax-0.0.7-py3-none-any.whl | Python 3 | none | any | Details for continuation_jax-0.0.7-py3-none-any.whl |
Total release size: 163.7 kB
Release files / continuation_jax-0.0.7.tar.gz
| Download URL | continuation_jax-0.0.7.tar.gz |
|---|---|
| Size | 57.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f29543d8090e4b91e23c7f19d03a21c8408042b582c88c98f25e159c318f963c
|
|
BLAKE2b-256 checksum How to use checksums |
29f6cd677235ea59bd7428d2a8c93fb5dc3101460d3b0a25f90474a3f671354c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.2
|
Release files / continuation_jax-0.0.7-py3-none-any.whl
| Download URL | continuation_jax-0.0.7-py3-none-any.whl |
|---|---|
| Size | 106.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
01e44ab1dd2e4fa294b87633e8d8883df30ad34a493887df1569524ec992e228
|
|
BLAKE2b-256 checksum How to use checksums |
aa33c6501ec1b7d94f36c969fcf5251067cbf76cc5946a5de0e041c1cf688999
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.2
|
Security for continuation-jax 0.0.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.