Documentation

Submodules

tfwatcher.firebase_config module

tfwatcher.firebase_config.get_firebase_config() dict[source]

Returns a dictionary to initialize Firebase containing registered app’s Firebase project configuration. It is safe to expose Firebase apiKey publicly, read this Stack Overflow answer .

Returns

A dictionary of Firebase project configuration

Return type

dict

tfwatcher.firebase_helpers module

tfwatcher.firebase_helpers.random_char(y: int) str[source]

A very simple function to help generate an arbitary length of pseudo random letters to serve as a unique ID specific to the class through which metrics are being logged. This is also the child under which the mtrics are logged in Firebase Realtime database.

Parameters

y (int) – The length of the unique ID to be created

Returns

A string of y pseudo random upper case and lower letters

Return type

str

tfwatcher.firebase_helpers.write_in_callback(data: dict, ref_id: str)[source]

A wrapper around write_to_firebase() to simply pass in the data and a unique ID to write to Firebase Realtime database. It automatically figures out the level at which logs were collected and calls the write_to_firebase() function. This function is also used to write data to Firebase in between callbacks (eg. the EpochEnd class).

Note

This function is specially made to directly use in callbacks and does not require using level argument which is automatically calculated for callback classes.

Parameters
  • data (dict) – A dictionary of the logging metrics, epoch number and average time which are to be logged to Firebase

  • ref_id (str) – A unique ID where the data would be pushed to on Firebase

tfwatcher.firebase_helpers.write_to_firebase(data: dict, ref_id: str, level: str)[source]

Writes data to Firebase Realtime Database using Pyrebase , a simple Python wrapper around the Firebase API. This automatically fetches the Firebase Config from firebase_config.get_firebase_config() .

Parameters
  • data (dict) – A dictionary of the logging metrics, epoch number and average time which are to be logged to Firebase

  • ref_id (str) – A unique ID where the data would be pushed to on Firebase

  • level (str) – This should be either epoch, batch or prediction corresponding to the level where the logs are collected. For prediction, the data would be pushed without the epoch or batch number it was collected on.

tfwatcher.version module

This module exports the __version__ attribute showing the current version of the package installed:

Version of tfwatcher installed
1 import tfwatcher
2 print(tfwatcher.__version__)

Module contents