def test():
    opt = util.get_opt()

    model = GeneratorTestModel(opt)
    model.load_model(opt.load_model_name)  # Load old model

    dataset = TestDataset(opt)
    print("Dataloader initialized")

    for image in tqdm(dataset):
        model.save_generated(image)
Exemple #2
0
# This library is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
# for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this library; if not, see <http://www.gnu.org/licenses>.
#

import argparse
import sys

import util

from seccomp import *


def test(args):
    set_api(3)

    f = SyscallFilter(LOG)
    return f


args = util.get_opt()
ctx = test(args)
util.filter_output(args, ctx)

# kate: syntax python;
# kate: indent-mode python; space-indent on; indent-width 4; mixedindent off;
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
# for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this library; if not, see <http://www.gnu.org/licenses>.
#

import argparse
import sys

import util

from seccomp import *

def test(args):
    f = SyscallFilter(KILL)
    # the next three seccomp_rule_add_exact() calls for read must go together
    # in this order to catch an infinite loop.
    f.add_rule(ALLOW, "read", Arg(0, EQ, sys.stdout.fileno()))
    f.add_rule(ALLOW, "read", Arg(1, EQ, 0))
    f.add_rule(ALLOW, "read", Arg(0, EQ, sys.stdin.fileno()))
    return f

args = util.get_opt()
ctx = test(args)
util.filter_output(args, ctx)

# kate: syntax python;
# kate: indent-mode python; space-indent on; indent-width 4; mixedindent off;
Exemple #4
0
    print '\n'.join(['%d: %s' % (rank, repr(player))
                     for (rank, player) in game.player_ranking()])

    plot.plot_game(game, save_to=outpath + '.png')


if __name__ == '__main__':
    argv = sys.argv[1:]

    if len(argv) == 0:
        sys.exit('Please specify at least one input file')

    opts = [arg for arg in argv if arg.startswith('-')]
    args = [arg for arg in argv if not arg.startswith('-')]

    save_to = util.get_opt('save-to', opts, default=os.getcwd())
    use_threads = util.get_opt('use-threads', opts, default=True)

    util.mkdir(save_to)

    if use_threads:
        threads = []
        for infile in args:
            thread = threading.Thread(target=run_game, args=(infile, save_to))
            thread.daemon = True
            threads.append(thread)
            thread.start()
        util.join_threads(threads)

    else:
        for infile in args:
Exemple #5
0
 def find_disk(self, name):
     return get_opt(self.disks, name)
Exemple #6
0
            if model.step % opt.log_batch_freq == 0:
                model.print_logs(print_fn=log_bar.set_description_str)
            if model.step % opt.visual_batch_freq == 0:
                model.save_visuals()

            #key activated hotkeys and call their respective functions
            functions2call = hotkeys.get_function_list()
            for function in functions2call:
                function()
        model.update_learning_rate()

        if epoch % opt.save_epoch_freq == 0:
            model.save_model()
        if opt.use_eval and epoch % opt.eval_epoch_freq == 0:
            model.evaluate(list_of_eval_images)


if __name__ == '__main__':
    opt = util.get_opt()

    model = CycleGANModel(opt)
    if opt.load_model:
        model.load_model(opt.load_model_name) # Load old model

    # ----------
    #  Training
    # ----------

    train(model, opt)

Exemple #7
0
 def get_property(self, key):
     return get_opt(self.spec, key)