def log_trial_end(self, trial, failed):
        e = CNVRGExperiment(self._cnvrg_experiments[trial.trial_id])

        e.log("===== Logging Artifacts =====")
        from os import listdir
        files_list = [
            os.path.join(trial.logdir, p) for p in os.listdir(trial.logdir)
        ]

        e.log_artifacts(files_list)
        e.finish(exit_status=int(failed))
Example #2
0
import os
import time
from cnvrg import Experiment
os.system("mkdir -p testfiles")
e = Experiment()
for commit in range(5):
    file_list = []
    for i in range(25):
        with open(f"testfiles/filet{i}.txt", 'w+') as file:
            file.write('hello')
        with open(f"testfiles/filet{i}.txt_tags.yml", 'w+') as yml:
            yml.write(f"---\nid: \"{i}\"\nsource: \"yann lecun\"")
        file_list.append(f"testfiles/filet{i}.txt")
        file_list.append(f"testfiles/filet{i}.txt_tags.yml")
    e.log_artifacts(file_list)
    time.sleep(5)
    print(f"commited: {commit}")
Example #3
0
        # Name generator
        names = get_images_name(os.path.join(args.evalf, "images"))
        model.eval()
        with torch.no_grad():
            for data, target in eval_loader:
                data, target = data.to(device), target.to(device)
                output = model(data)
                label = output.argmax(dim=1, keepdim=True).item()
                print ("Images: " + next(names) + ", Classified as: " + str(label))

    # Train?
    if args.train:
        # Train + Test per epoch
        for epoch in range(1, args.epochs + 1):
            train(args, model, device, train_loader, optimizer, epoch)
            accuracy = test(args, model, device, test_loader, epoch)

        # Do checkpointing - Is saved in outf
        outfile = '%s/mnist_convnet_model_epoch_%d.pth' % (args.outf, args.epochs)
        torch.save(model.state_dict(), outfile)

        e.log_artifacts([outfile])

    # Evaluate?
    if args.evaluate:
        accuracy = test_image()

    e.log_param("accuracy", accuracy)
    e.finish()
Example #4
0
{\colortbl;\red255\green255\blue255;\red199\green200\blue201;\red22\green21\blue22;}
{\*\expandedcolortbl;;\cssrgb\c81961\c82353\c82745;\cssrgb\c11373\c10980\c11373\c3922;}
\paperw11900\paperh16840\margl1440\margr1440\vieww11520\viewh8400\viewkind0
\deftab720
\pard\pardeftab720\sl360\partightenfactor0

\f0\fs24 \cf2 \cb3 \expnd0\expndtw0\kerning0
\outl0\strokewidth0 \strokec2 import os\cb1 \
\cb3 import time\cb1 \
\cb3 from cnvrg import Experiment\cb1 \
\cb3 os.system("mkdir -p testfiles")\cb1 \
\cb3 e = Experiment()\cb1 \
\cb3 for commit in range(5):\cb1 \
\cb3     file_list = []\cb1 \
\cb3     for i in range(25):\cb1 \
\cb3         with open(f"testfiles/filet\{i\}.txt", 'w+') as file:\cb1 \
\cb3             file.write('hello')\cb1 \
\cb3         with open(f"testfiles/filet\{i\}.txt_tags.yml", 'w+') as yml:\cb1 \
\cb3             yml.write(f"---\\nid: \\"\{i\}\\"\\nsource: \\"yann lecun\\"")\
\pard\pardeftab720\sl360\partightenfactor0
\cf2 \cb1 \
\pard\pardeftab720\sl360\partightenfactor0
\cf2 \cb3         file_list.append(f"testfiles/filet\{i\}.txt")\cb1 \
\cb3         file_list.append(f"testfiles/filet\{i\}.txt_tags.yml")\
\pard\pardeftab720\sl360\partightenfactor0
\cf2 \cb1 \
\pard\pardeftab720\sl360\partightenfactor0
\cf2 \cb3     e.log_artifacts(file_list)\cb1 \
\cb3     time.sleep(5)\cb1 \
\cb3     print(f"commited: \{commit\}")\
}