A simple library to manage Tensorflow experiments though git and reduce boilerplate. Compatible with tf 1.x
Project description
TfExperiment
A simple library to manage Tensorflow experiments though git and reduce boilerplate. Compatible with tf 1.x
Usage
This library relies of git to manage experiments. Each experiment should be a unique git branch, and the name of the experiment, if not give, will be the current git branch.
experiment = tfExperiment.Experiment(finalizeGraph = False)
experiment.saveGraph()
# output
# > graph location ======================================>
# > tensorboard --logdir output\experimentName\graph
# with with
with experiment.trainingSession(epochs = 125, saveAfter = 2, testAfter = 2) as ts:
ts.saveGraph() # function to save the graph
ts.trainCallback = runTrainingCallback
ts.testCallback = runTestCallback
# as function
experiment.train(runTrainingCallback)
experiment.test(runTestCallback)
API
__init__(self.name = None, finalizeGraph = False)
-
name: string: Name of the experiment, if no name is provided the name of the current git branch will be used. -
finalizeGraph: bool: Finalizes the graph. Attention I have not tried this feature much.
train(trainCallback, epochs = 1, saveModelAfter = 2, saveGraph = False, testCallback = None, testAfter = 0)
Runs the training and validates/test the model
-
trainCallback: function: Function to be run at each epoch. This should contain your loop with the training actions to execute for each batch. The training callback can take 2 parameters: session (current tf.session), and env (if env is used you should use the exact name) experiment environment with access to functionalities like timer and dataSaver. -
epochs: integer: Number of epochs to run, that is to say the number of times the traininCallbacks will be called. Attention: the experiment object keeps track of the number of epochs run so far, so if you callexperiment.trainagain, the epoch number will continue to grow from the last epoch number. -
saveModelAfter: integer: Save the model after n epochs have run. This only considers the current run. -
saveGraph: bool: If we should save the graph at the current run. -
testCallback: function: Function to call to test/validate the current network. Similar to trainCallback. -
testAfter: integer: test the model after n epochs have run. This only considers the current run.
test(testCallback)
Runs the testing/validation of the model once
testCallback: function: Function to call to test/validate the current network. Similar to trainCallback.
env: DotMap object
The env object contains
env.training.currentEpoch: integer: number of epochs since the instance was initialized.env.training.currentEpoch: integer: number of epochs since the instance was initialized.env.training.dataSavePath: path string: path in which the data will be used if dataSaver is used during training.env.training.dataSaver: dataSaver Instance: dataSaver instance (initialized with env.training.dataSavePath) for training to the training file.env.testing.dataSavePath: path stringpath in which the data will be used if dataSaver is used during testing.env.testing.dataSaver: dataSaver Instance: dataSaver instance (initialized with env.testing.dataSavePath) for testing to the training file.
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 tfExperiment-0.0.2.tar.gz.
File metadata
- Download URL: tfExperiment-0.0.2.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.19.1 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.27.0 CPython/3.6.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b7ecb299d7277dca3c51f472fcce7140c37f9e83e30cd1a4ddaa3f31ba91eddc
|
|
| MD5 |
c8ac79374a88a645abadc36d10e49115
|
|
| BLAKE2b-256 |
7ab2ff45715b5ab9dfba27557e637ee09ae6e4787f4b2ea649a7c943a48ec2f4
|
File details
Details for the file tfExperiment-0.0.2-py3-none-any.whl.
File metadata
- Download URL: tfExperiment-0.0.2-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.19.1 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.27.0 CPython/3.6.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0433ae2f7c456ee2d29b09b3aad0c69725f88f6a3901ea867a1deb65e72ca1db
|
|
| MD5 |
d79b60bc7785722e66b0b887f3f4b89c
|
|
| BLAKE2b-256 |
9dabea73d3b9c92888138cf9d49786b0efd28288b8a475c27daa296f22ba101f
|