示例#1
0
    def __init__(self, debug_x=None):
        super(KerasCallback, self).__init__()

        self.context = deepkit.context()

        self.context.debugger_controller.snapshot.subscribe(self.snapshot)

        self.debug_x = debug_x

        self.epoch = 0

        self.data_validation = None
        self.data_validation_size = None

        self.current = {}
        self.last_batch_time = time.time()
        self.start_time = time.time()
        self.accuracy_metric = None
        self.all_losses = None
        self.loss_metric = None
        self.learning_rate_metric = None

        self.learning_rate_start = 0
        self.last_debug_sent = 0
示例#2
0
import asyncio

import deepkit

context = deepkit.context('deepkit.yml')

acc = deepkit.create_metric('acc')


async def bla():
    for i in range(1000):
        await asyncio.sleep(1)
        context.epoch(i, 10)
        acc.send(i, i * 2)
        print("asdasd")


asyncio.get_event_loop().run_until_complete(bla())
示例#3
0
import random

import deepkit

context = deepkit.context()
context.add_file(__file__)

test = deepkit.create_metric('test')

for i in range(100):
    deepkit.set_info(i, random.random())

total = 1_000_000;
for i in range(1_000_000):
    test.send(i, random.random())
    deepkit.epoch(i, total)

print("Bye.")
示例#4
0
import datetime

import tensorflow as tf
from tensorflow.keras import Model, layers, optimizers, datasets
import deepkit
from deepkit import ContextOptions

context = deepkit.context(ContextOptions(
    # account='peter',
    # project='deepkitorg/tf2-keras-mnist'
))
context.add_file('model.py')

(x, y), (x_val, y_val) = datasets.fashion_mnist.load_data()
x = x.reshape(x.shape[0], 28, 28, 1)
x_val = x_val.reshape(x_val.shape[0], 28, 28, 1)
x = x / 255.0
y = tf.one_hot(y, depth=10, dtype=tf.float32)
y_val = tf.one_hot(y_val, depth=10)
print('x/y shape:', x.shape, y.shape)


def train_gen():
    global x, y
    for x2, y2 in zip(x, y):
        yield (x2, x2), y2
        # yield x2, y2


train_dataset = tf.data.Dataset.from_generator(
    train_gen,