repo stringclasses 454
values | file_path stringlengths 5 201 | extension stringclasses 1
value | content stringlengths 8 509k | num_lines int64 3 16.9k | size_bytes int64 8 511k |
|---|---|---|---|---|---|
clearml | examples/pipeline/step3_train_model.py | .py | import joblib
import matplotlib.pyplot as plt
import numpy as np
from sklearn.linear_model import LogisticRegression
from clearml import Task
# Connecting ClearML with the current process,
# from here on everything is logged automatically
task = Task.init(project_name="examples", task_name="Pipeline step 3 train mod... | 59 | 1,638 |
clearml | examples/pipeline/decorated_pipeline_step_decorators.py | .py | from clearml import PipelineDecorator
def our_decorator(func):
def function_wrapper(*args, **kwargs):
return func(*args, **kwargs) + 1
return function_wrapper
@PipelineDecorator.component()
@our_decorator
def step():
return 1
@PipelineDecorator.pipeline(name="test_decorated", project="test_dec... | 25 | 468 |
clearml | examples/pipeline/pipeline_from_tasks.py | .py | from clearml import Task
from clearml.automation import PipelineController
def pre_execute_callback_example(a_pipeline, a_node, current_param_override):
# type (PipelineController, PipelineController.Node, dict) -> bool
print(
f"Cloning Task id={a_node.base_task_id} with parameters: {current_param_ove... | 70 | 2,221 |
clearml | examples/pipeline/pipeline_from_decorator.py | .py | from clearml.automation.controller import PipelineDecorator
from clearml import TaskTypes
# Make the following function an independent pipeline component step
# notice all package imports inside the function will be automatically logged as
# required packages for the pipeline execution step
@PipelineDecorator.compone... | 125 | 5,936 |
clearml | examples/optimization/hyper-parameter-optimization/multi_objective_hpo.py | .py | import sys
from clearml import Task
from clearml.automation import DiscreteParameterRange, HyperParameterOptimizer, UniformIntegerParameterRange
try:
from clearml.automation.optuna import OptimizerOptuna # noqa
except ImportError:
print("Multi-objective HPO is currently only supported via Optuna")
sys.e... | 112 | 5,864 |
clearml | examples/optimization/hyper-parameter-optimization/base_template_keras_simple.py | .py | # ClearML - Keras with Tensorboard example code, automatic logging model and Tensorboard outputs
#
# Train a simple deep NN on the MNIST dataset.
# Gets to 98.40% test accuracy after 20 epochs
# (there is *a lot* of margin for parameter tuning).
# 2 seconds per epoch on a K520 GPU.
from __future__ import print_function... | 88 | 3,040 |
clearml | examples/optimization/hyper-parameter-optimization/hyper_parameter_optimizer.py | .py | import logging
import argparse
from clearml import Task
from clearml.automation import (
DiscreteParameterRange, HyperParameterOptimizer, RandomSearch,
UniformIntegerParameterRange)
# trying to load Bayesian optimizer package
try:
from clearml.automation.optuna import OptimizerOptuna # noqa
aSearchSt... | 134 | 6,707 |
clearml | examples/router/simple_webserver.py | .py | """
A simple webserver, used as a tool to showcase the capabilities of
ClearML HTTP router. See `http_router.py` for more details.
"""
from fastapi import FastAPI, HTTPException
from pydantic import BaseModel
import uvicorn
app = FastAPI()
actions = {
"1": {"name": "Action 1", "description": "This is model acti... | 45 | 994 |
clearml | examples/router/http_router.py | .py | """
Example on how to use the ClearML HTTP router.
For this example, you would first need a webserver to route the traffic to:
`simple_webserver.py` launches such a server. Running the script will start a
webserver, bound to localhost:8000.
Then, when running this example, it creates a router which binds to 0.0.0.0:90... | 43 | 1,734 |
clearml | examples/router/multi_endpoints.py | .py | """
Minimal example showing how to request multiple external endpoints for a Task.
This script assumes you already have local services bound to ports 8000 and 8001.
You can reuse `simple_webserver.py` for the primary endpoint and launch any other
service on the secondary port before running this example.
"""
from cle... | 24 | 933 |
clearml | examples/frameworks/openmmlab/openmmlab_cifar10.py | .py | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import torchvision.transforms as transforms
from mmcv.parallel import MMDataParallel
from mmcv.runner import EpochBasedRunner
from mmcv.utils import get_logger
from torch.utils.data import DataLoader
from torchvision.datasets... | 95 | 3,012 |
clearml | examples/frameworks/pytorch/pytorch_tensorboardx.py | .py | # ClearML - Example of pytorch with tensorboardX
#
from __future__ import print_function
import argparse
import os
from tempfile import gettempdir
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from tensorboardX import SummaryWriter
from torch.autograd import Variable
f... | 210 | 6,165 |
clearml | examples/frameworks/pytorch/tensorboard_toy_pytorch.py | .py | import os
from tempfile import gettempdir
import numpy as np
from PIL import Image
from torch.utils.tensorboard import SummaryWriter
from clearml import Task
# Connecting ClearML with the current process,
# from here on everything is logged automatically
task = Task.init(project_name='examples', task_name='PyTorch ... | 33 | 1,281 |
clearml | examples/frameworks/pytorch/pytorch_matplotlib.py | .py | # ClearML - Example of Pytorch and matplotlib integration and reporting
#
"""
Neural Transfer Using PyTorch
=============================
**Author**: `Alexis Jacq <https://alexis-jacq.github.io>`_
**Edited by**: `Winston Herring <https://github.com/winston6>`_
Introduction
------------
This tutorial explains how to im... | 484 | 19,642 |
clearml | examples/frameworks/pytorch/pytorch_abseil.py | .py | # Example of MNIST training with PyTorch and abseil integration
from __future__ import print_function
import os
from tempfile import gettempdir
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from absl import app, flags
from torchvision import datasets, transforms
from... | 187 | 5,346 |
clearml | examples/frameworks/pytorch/pytorch_tensorboard.py | .py | # ClearML - Example of pytorch with tensorboard>=v1.14
#
from __future__ import print_function
import argparse
import os
from tempfile import gettempdir
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torchvision import datasets, transforms
from torch.autograd impor... | 143 | 6,227 |
clearml | examples/frameworks/pytorch/pytorch_mnist.py | .py | # ClearML - Example of Pytorch mnist training integration
#
from __future__ import print_function
import argparse
import os
from tempfile import gettempdir
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torchvision import datasets, transforms
from clearml import T... | 248 | 6,431 |
clearml | examples/frameworks/pytorch/pytorch_model_update.py | .py | from pathlib import Path
import matplotlib.pyplot as plt
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import torchvision.datasets as datasets
import torchvision.transforms as transforms
from ignite.contrib.handlers import TensorboardLogger
from ignite.engine import Eve... | 251 | 8,036 |
clearml | examples/frameworks/ignite/cifar_ignite.py | .py | from pathlib import Path
import matplotlib.pyplot as plt
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import torchvision.datasets as datasets
import torchvision.transforms as transforms
from ignite.contrib.handlers import TensorboardLogger
from ignite.engine import Eve... | 192 | 7,140 |
clearml | examples/frameworks/click/click_multi_cmd.py | .py | import click
from clearml import Task
@click.group()
@click.option(
'--print-something/--dont-print-something',
default=True,
)
@click.option(
'--what-to-print',
default='something',
)
def cli(print_something, what_to_print):
Task.init(
project_name='examples',
task_name='Click mul... | 63 | 1,132 |
clearml | examples/frameworks/click/click_single_cmd.py | .py | import click
from clearml import Task
@click.command()
@click.option(
"--count",
default=1,
help="Number of greetings.",
)
@click.option(
"--name",
prompt="Your name",
help="The person to greet.",
)
def hello(count, name):
Task.init(
project_name="examples",
task_name="Clic... | 31 | 531 |
clearml | examples/frameworks/jsonargparse/pytorch_lightning_cli.py | .py | try:
from lightning.pytorch.cli import LightningCLI
from lightning.pytorch.demos.boring_classes import DemoModel, BoringDataModule
except ImportError:
import sys
print("Module 'lightning' not installed (only available for Python 3.8+)")
sys.exit(0)
from clearml import Task
if __name__ == "__main__... | 15 | 497 |
clearml | examples/frameworks/jsonargparse/pytorch_lightning_cli_old.py | .py | # Copyright The PyTorch Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | 116 | 3,930 |
clearml | examples/frameworks/jsonargparse/jsonargparse_command.py | .py | from jsonargparse import CLI
from clearml import Task
class Main:
def __init__(self, prize: int = 100):
self.prize = prize
def person(self, name: str):
return f"{name} won {self.prize}!"
if __name__ == "__main__":
Task.init(
project_name="examples",
task_name="jsonargpar... | 19 | 360 |
clearml | examples/frameworks/jsonargparse/jsonargparse_nested_namespaces.py | .py | from dataclasses import dataclass
from jsonargparse import ArgumentParser
from clearml import Task
@dataclass
class Arg2:
opt1: str = "from default 1"
opt2: str = "from default 2"
if __name__ == "__main__":
Task.init(project_name="examples", task_name="jsonargparse nested namespaces")
parser = Argum... | 20 | 594 |
clearml | examples/frameworks/tensorflow/tensorboard_toy.py | .py | # ClearML - Example of tensorboard with tensorflow (without any actual training)
#
import os
import tensorflow as tf
import numpy as np
from tempfile import gettempdir
from PIL import Image
from clearml import Task
def generate_summary(k, step):
# Make a normal distribution, with a shifting mean
mean_moving_... | 77 | 3,227 |
clearml | examples/frameworks/tensorflow/absl_flags.py | .py | # ClearML - example code, absl parameter logging
#
import sys
from absl import app
from absl import flags
from absl import logging
from clearml import Task
FLAGS = flags.FLAGS
flags.DEFINE_string("echo", None, "Text to echo.")
flags.DEFINE_string("another_str", "My string", "A string", module_name="test")
# Connec... | 33 | 921 |
clearml | examples/frameworks/tensorflow/tensorflow_mnist.py | .py | from __future__ import absolute_import, division, print_function, unicode_literals
import os
from tempfile import gettempdir
import tensorflow as tf
from tensorflow.keras.layers import Dense, Flatten, Conv2D
from tensorflow.keras import Model
from clearml import Task
# Connecting ClearML with the current process,... | 159 | 5,063 |
clearml | examples/frameworks/tensorflow/tensorboard_pr_curve.py | .py | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 282 | 9,925 |
clearml | examples/frameworks/tensorflow/legacy/tensorboard_toy.py | .py | # ClearML - Example of tensorboard with tensorflow (without any actual training)
#
import os
from tempfile import gettempdir
import tensorflow as tf
import numpy as np
from PIL import Image
from clearml import Task
# Connecting ClearML with the current process,
# from here on everything is logged automatically
task... | 87 | 3,203 |
clearml | examples/frameworks/tensorflow/legacy/tensorflow_eager.py | .py | # ClearML - Example of tensorflow eager mode, model logging and tensorboard
#
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#... | 358 | 14,373 |
clearml | examples/frameworks/tensorflow/legacy/tensorflow_mnist_with_summaries.py | .py | # Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the 'License');
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | 223 | 9,808 |
clearml | examples/frameworks/tensorflow/legacy/tensorboard_pr_curve.py | .py | # ClearML - Example of new tensorboard pr_curves model
#
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apach... | 242 | 9,625 |
clearml | examples/frameworks/autokeras/autokeras_imdb_example.py | .py | try:
import autokeras as ak
except ImportError:
import sys
raise ImportError(
"autokeras package is missing, you can install it using pip: pip install autokeras"
if (sys.version_info.major, sys.version_info.minor) > (3, 6)
else "AutoKeras does not support python version < 3.7"
)... | 67 | 2,122 |
clearml | examples/frameworks/fire/fire_grouping_cmd.py | .py | # ClearML - Example of Python Fire integration, with commands grouped inside classes
#
from clearml import Task
import fire
class Other:
def status(self):
return "Other"
class IngestionStage:
def __init__(self):
self.other = Other()
def run(self):
return "Ingesting! Nom nom nom... | 45 | 861 |
clearml | examples/frameworks/fire/fire_object_cmd.py | .py | # ClearML - Example of Python Fire integration, with commands derived from an object
#
from clearml import Task
import fire
class Calculator:
def add(self, x, y):
return x + y
def multiply(self, x, y):
return x * y
if __name__ == "__main__":
Task.init(project_name="examples", task_name... | 20 | 400 |
clearml | examples/frameworks/fire/fire_class_cmd.py | .py | # ClearML - Example of Python Fire integration, processing commands derived from a class
#
from clearml import Task
import fire
class BrokenCalculator:
def __init__(self, offset=1):
self._offset = offset
def add(self, x, y):
return x + y + self._offset
def multiply(self, x, y):
... | 22 | 480 |
clearml | examples/frameworks/fire/fire_dict_cmd.py | .py | # ClearML - Example of Python Fire integration, with commands derived from a dictionary
#
from clearml import Task
import fire
def add(x, y):
return x + y
def multiply(x, y):
return x * y
if __name__ == "__main__":
Task.init(project_name="examples", task_name="Fire dict command")
fire.Fire(
... | 24 | 400 |
clearml | examples/frameworks/fire/fire_single_cmd.py | .py | # ClearML - Example of Python Fire integration, with a single command passed to Fire
#
from clearml import Task
import fire
def hello(count, name="clearml", prefix="prefix_", suffix="_suffix", **kwargs):
for _ in range(count):
print("Hello %s%s%s!" % (prefix, name, suffix))
if __name__ == "__main__":
... | 16 | 412 |
clearml | examples/frameworks/fire/fire_typing.py | .py | from typing import Tuple, List
from clearml import Task
import fire
def with_ret() -> Tuple:
print("With ret called")
return 1, 2
def with_args(arg1: int, arg2: List):
print("With args called", arg1, arg2)
def with_args_and_ret(arg1: int, arg2: List) -> Tuple:
print("With args and ret called", arg... | 23 | 462 |
clearml | examples/frameworks/fire/fire_multi_cmd.py | .py | # ClearML - Example of Python Fire integration, processing multiple commands, when fire is initialized with no component
#
from clearml import Task
import fire
def hello(count, name="clearml", prefix="prefix_", suffix="_suffix", **kwargs):
for _ in range(count):
print("Hello %s%s%s!" % (prefix, name, suf... | 23 | 600 |
clearml | examples/frameworks/scikit-learn/sklearn_joblib_example.py | .py | try:
import joblib
except ImportError:
from sklearn.externals import joblib
from sklearn import datasets
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import train_test_split
import numpy as np
import matplotlib.pyplot as plt
from clearml import Task
# Connecting ClearML w... | 48 | 1,358 |
clearml | examples/frameworks/scikit-learn/sklearn_matplotlib_example.py | .py | import matplotlib.pyplot as plt
import numpy as np
from sklearn.datasets import load_digits
from sklearn.model_selection import ShuffleSplit
from sklearn.model_selection import learning_curve
from sklearn.naive_bayes import GaussianNB
from sklearn.svm import SVC
from clearml import Task
def plot_learning_curve(estim... | 156 | 6,221 |
clearml | examples/frameworks/lightgbm/lightgbm_example.py | .py | # ClearML - Example of LightGBM integration
#
import lightgbm as lgb
import matplotlib.pyplot as plt
import pandas as pd
from sklearn.metrics import mean_squared_error
from clearml import Task
def main():
# Connecting ClearML with the current process,
# from here on everything is logged automatically
tas... | 105 | 2,775 |
clearml | examples/frameworks/kerastuner/keras_tuner_cifar_legacy.py | .py | """Keras Tuner CIFAR10 example for the TensorFlow blog post."""
import keras_tuner as kt
import tensorflow as tf
import tensorflow_datasets as tfds
from clearml.external.kerastuner import ClearmlTunerLogger
from clearml import Task
physical_devices = tf.config.list_physical_devices('GPU')
if physical_devices:
tf... | 78 | 2,643 |
clearml | examples/frameworks/kerastuner/keras_tuner_cifar.py | .py | """Keras Tuner CIFAR10 example for the TensorFlow blog post."""
import keras_tuner as kt
import tensorflow as tf
import tensorflow_datasets as tfds
from clearml.external.kerastuner import ClearmlTunerCallback
from clearml import Task
physical_devices = tf.config.list_physical_devices("GPU")
if physical_devices:
... | 80 | 2,628 |
clearml | examples/frameworks/catboost/catboost_example.py | .py | # ClearML - Example of CatBoost training, saving model and loading model
#
import argparse
from catboost import CatBoostRegressor, Pool
from catboost.datasets import msrank
from clearml import Task
import numpy as np
from sklearn.model_selection import train_test_split
def main(iterations):
# Download train a... | 61 | 2,186 |
clearml | examples/frameworks/fastai/fastai_with_tensorboard_example.py | .py | # ClearML - Fastai v2 with tensorboard callbacks example code, automatic logging the model and various scalars
#
import argparse
from clearml import Task
import fastai
try:
from fastai.vision.all import (
untar_data,
URLs,
get_image_files,
ImageDataLoaders,
Resize,
... | 47 | 1,247 |
clearml | examples/frameworks/fastai/fastai_example.py | .py | # ClearML - Fastai v2 example code, automatic logging the model and various scalars
#
import argparse
from clearml import Task
import fastai
try:
from fastai.vision.all import (
untar_data,
URLs,
get_image_files,
ImageDataLoaders,
Resize,
cnn_learner,
resne... | 46 | 1,095 |
clearml | examples/frameworks/fastai/legacy/fastai_with_tensorboard_example.py | .py | # ClearML - Fastai with Tensorboard example code, automatic logging the model and Tensorboard outputs
#
import argparse
from clearml import Task
import fastai
try:
from fastai.vision import (
untar_data,
URLs,
ImageDataBunch,
rand_pad,
imagenet_stats,
cnn_learner,
... | 48 | 1,328 |
clearml | examples/frameworks/fastai/legacy/fastai_example.py | .py | # ClearML - Fastai example code, automatic logging the model and scalars
#
import argparse
from clearml import Task
import fastai
try:
from fastai.vision import untar_data, URLs, ImageDataBunch, rand_pad, imagenet_stats, cnn_learner, models, accuracy
except ImportError:
raise ImportError("FastAI version %s i... | 34 | 950 |
clearml | examples/frameworks/xgboost/xgboost_metrics.py | .py | import xgboost as xgb
from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
from clearml import Task
task = Task.init(project_name="examples", task_name="XGBoost metric auto reporting")
X, y = load_iris(return_X_y=True)
X_train, X_test, y_train, y_test = train_test_split(
X,... | 28 | 680 |
clearml | examples/frameworks/xgboost/xgboost_sample.py | .py | import matplotlib.pyplot as plt
import xgboost as xgb
from sklearn import datasets
from sklearn.metrics import accuracy_score
from sklearn.model_selection import train_test_split
from xgboost import plot_tree
from clearml import Task
# Connecting ClearML with the current process,
# from here on everything is logged ... | 69 | 1,998 |
clearml | examples/frameworks/keras/keras_tensorboard.py | .py | # ClearML - Keras with Tensorboard example code, automatic logging model and Tensorboard outputs
#
# Train a simple deep NN on the MNIST dataset.
# Gets to 98.40% test accuracy after 20 epochs
# (there is *a lot* of margin for parameter tuning).
# 2 seconds per epoch on a K520 GPU.
from __future__ import print_function... | 125 | 4,356 |
clearml | examples/frameworks/keras/keras_v3.py | .py | import numpy as np
import keras
from clearml import Task
def get_model():
# Create a simple model.
inputs = keras.Input(shape=(32,))
outputs = keras.layers.Dense(1)(inputs)
model = keras.Model(inputs, outputs)
model.compile(optimizer=keras.optimizers.Adam(), loss="mean_squared_error")
return m... | 29 | 719 |
clearml | examples/frameworks/keras/legacy/keras_tensorboard.py | .py | # ClearML - Keras with Tensorboard example code, automatic logging model and Tensorboard outputs
#
# Train a simple deep NN on the MNIST dataset.
# Gets to 98.40% test accuracy after 20 epochs
# (there is *a lot* of margin for parameter tuning).
# 2 seconds per epoch on a K520 GPU.
from __future__ import print_function... | 119 | 4,206 |
clearml | examples/frameworks/tensorboardx/moviepy_tensorboardx.py | .py | # ClearML - Example of pytorch with tensorboardX add_video.
#
from __future__ import print_function
import torch
from tensorboardX import SummaryWriter
from clearml import Task
def main():
# Connecting ClearML with the current process,
# from here on everything is logged automatically
task = Task.init(... | 29 | 758 |
clearml | examples/frameworks/hydra/hydra_example.py | .py | # ClearML - Hydra Example
#
import hydra
from omegaconf import OmegaConf
from clearml import Task
@hydra.main(config_path="config_files", config_name="config", version_base=None)
def my_app(cfg):
# type (DictConfig) -> None
task = Task.init(project_name="examples", task_name="Hydra configuration")
logge... | 21 | 521 |
clearml | examples/frameworks/megengine/megengine_mnist.py | .py | import argparse
import os
import sys
from tempfile import gettempdir
import numpy as np
try:
import megengine as mge
import megengine.functional as F
import megengine.module as M
from megengine.autodiff import GradManager
from megengine.data import DataLoader, RandomSampler
from megengine.data... | 143 | 4,115 |
clearml | examples/frameworks/pytorch-lightning/pytorch_lightning_example.py | .py | import sys
from argparse import ArgumentParser
import pytorch_lightning as pl
import torch
from torch.nn import functional as F
from torch.utils.data import DataLoader, random_split
from torchvision import transforms
from torchvision.datasets.mnist import MNIST
from clearml import Task
class LitClassifier(pl.Lightn... | 96 | 2,935 |
clearml | examples/cicd/example_task.py | .py | """This is a dummy ClearML task. This should be replaced by your own experiment code."""
import time
import random
from clearml import Task
from tqdm import tqdm
task = Task.init(
project_name='Github CICD Video',
task_name='dummy_task',
reuse_last_task_id=False
)
random.seed()
for i in tqdm(range(10)):... | 24 | 503 |
clearml | examples/cicd/check_remotely_runnable.py | .py | import sys
import time
from clearml import Task
def check_task_status(task_id, timeout=600):
"""Make sure the task can run by checking for iteration reports."""
# Get the task object
task = Task.get_task(task_id=task_id)
start_time = time.time()
if task:
while time.time() - start_time < ti... | 36 | 1,189 |
clearml | examples/cicd/task_stats_to_comment.py | .py | import json
import os
import pandas as pd
from clearml import Task
from github3 import login
from tabulate import tabulate
def create_output_tables(retrieve_scalars_dict):
"""Extract data from ClearML into format for tabulation."""
data = []
for graph_title, graph_values in retrieve_scalars_dict.items():... | 106 | 4,294 |
clearml | examples/cicd/compare_models.py | .py | import os
from clearml import Task
from task_stats_to_comment import get_clearml_task_of_current_commit
def compare_and_tag_task(commit_hash):
"""Compare current performance to best previous performance and only allow equal or better."""
current_task = get_clearml_task_of_current_commit(commit_hash)
best... | 31 | 1,286 |
clearml | clearml/logger.py | .py | import logging
import math
import warnings
from typing import Sequence, Union, List, Optional, Tuple, Dict, TYPE_CHECKING, Any
import numpy as np
import six
from PIL import Image
from pathlib2 import Path
from .debugging.log import LoggerRoot
try:
import pandas as pd
except ImportError:
pd = None
from .back... | 1,671 | 66,503 |
clearml | clearml/errors.py | .py | from typing import List, Any
class UsageError(RuntimeError):
"""An exception raised for illegal usage of clearml objects"""
pass
class ArtifactUriDeleteError(ValueError):
def __init__(self, artifact: str, uri: str, remaining_uris: List[str]) -> None:
super(ArtifactUriDeleteError, self).__init__... | 21 | 656 |
clearml | clearml/model.py | .py | from abc import ABC, abstractmethod
import math
import os
import shutil
import zipfile
from tempfile import mkstemp
from typing import (
List,
Dict,
Union,
Optional,
Mapping,
TYPE_CHECKING,
Sequence,
Tuple,
Callable,
Any,
)
from uuid import uuid4
import numpy as np
try:
imp... | 2,771 | 103,255 |
clearml | clearml/__init__.py | .py | """ ClearML open SDK """
from .version import __version__
from .task import Task
from .model import InputModel, OutputModel, Model
from .logger import Logger
from .storage import StorageManager
from .errors import UsageError
from .datasets import Dataset
from .hyperdatasets import (
HyperDataset,
DataView,
... | 53 | 1,100 |
clearml | clearml/task_parameters.py | .py | from typing import (
Optional,
Union,
Iterable,
List,
Callable,
Tuple,
Type,
Dict,
TYPE_CHECKING,
Any,
)
import attr
from attr import validators
if TYPE_CHECKING:
from clearml import Task
__all__ = ["range_validator", "param", "percent_param", "TaskParameters"]
def _cano... | 177 | 5,455 |
clearml | clearml/task.py | .py | import numpy
import copy
import json
import os
import shutil
import sys
import threading
import time
import warnings
from argparse import ArgumentParser
from logging import getLogger
from tempfile import mkstemp, mkdtemp
from zipfile import ZipFile, ZIP_DEFLATED
try:
# noinspection PyCompatibility
from collect... | 5,690 | 258,389 |
clearml | clearml/backend_interface/logger.py | .py | import logging
import sys
from time import time
from typing import Optional, Callable, Any
from ..binding.frameworks import _patched_call # noqa
from ..config import running_remotely, config, DEBUG_SIMULATE_REMOTE_TASK
from ..utilities.process.mp import ForkSafeRLock
class StdStreamPatch:
_stdout_proxy = None
... | 350 | 13,398 |
clearml | clearml/backend_interface/setupuploadmixin.py | .py | from abc import abstractproperty
from typing import Optional
import warnings
from ..backend_config.bucket_config import (
S3BucketConfig,
AzureContainerConfig,
GSBucketConfig,
)
from ..storage.helper import StorageHelper
class SetupUploadMixin:
log = abstractproperty()
storage_uri = abstractprope... | 171 | 7,366 |
clearml | clearml/backend_interface/model.py | .py | import logging
from collections import namedtuple
from functools import partial
from typing import Optional, Callable, Union, Dict, List, Any
from pathlib2 import Path
from .base import IdObjectBase
from .util import make_message
from ..backend_api import Session
from ..backend_api.services import models, tasks
from ... | 678 | 22,559 |
clearml | clearml/backend_interface/util.py | .py | import getpass
import re
from _socket import gethostname
from datetime import datetime, timezone
from typing import Optional, Any, Tuple, Union
from ..backend_api.services import projects, queues
from ..debugging.log import get_logger, LoggerRoot
def make_message(s: str, **kwargs: Any) -> str:
# noinspection PyB... | 299 | 10,084 |
clearml | clearml/backend_interface/__init__.py | .py | """ High-level abstractions for backend API """
from .task import Task
__all__ = ["Task"]
| 5 | 91 |
clearml | clearml/backend_interface/routers.py | .py | from typing import Any, Dict, List, Optional
from .base import InterfaceBase
from ..backend_api import Session
class RouterService(InterfaceBase):
"""
Interface to the ``routers`` backend service, used to query router routes.
"""
def get_routes(self, name: Optional[str] = None) -> List[Dict[str, Any... | 93 | 3,146 |
clearml | clearml/backend_interface/session.py | .py | from abc import ABC, abstractmethod
from typing import Any
class SendError(Exception):
"""A session send() error class"""
@property
def result(self) -> Any:
return self._result
def __init__(self, result: Any, *args: Any, **kwargs: Any) -> None:
super(SendError, self).__init__(*args, ... | 34 | 769 |
clearml | clearml/backend_interface/base.py | .py | from abc import ABC, abstractmethod
import logging
from typing import Any, Optional
import requests.exceptions
import jsonschema
from ..backend_api import Session, CallResult
from ..backend_api.session.session import MaxRequestSizeError
from ..backend_api.session.response import ResponseMeta
from ..backend_api.sessio... | 235 | 8,030 |
clearml | clearml/backend_interface/datasets/save_frames_request_no_validate.py | .py | # do not import this file directly, as dereferncing datasets will result in a server call
# import from save_frames_request_no_validate_wrapped
from ...backend_api.services import datasets
_SaveFramesRequest = datasets.SaveFramesRequest if getattr(datasets, "SaveFramesRequest", None) else object
class _SaveFramesRe... | 12 | 407 |
clearml | clearml/backend_interface/datasets/__init__.py | .py | """Backend dataset helpers for HyperDatasets."""
from .hyper_dataset import HyperDatasetManagementBackend
from .hyper_dataset_data_view import DataViewManagementBackend
__all__ = [
"HyperDatasetManagementBackend",
"DataViewManagementBackend",
]
| 10 | 255 |
clearml | clearml/backend_interface/datasets/hyper_dataset_data_view.py | .py | from typing import (
Any,
Iterable,
List,
Mapping,
Optional,
Sequence,
Tuple,
Union,
)
from ..base import IdObjectBase
from ..util import exact_match_regex, get_or_create_project, get_single_result, make_message
from ...backend_api.services import dataviews, frames
class DataViewManag... | 561 | 20,594 |
clearml | clearml/backend_interface/datasets/hyper_dataset.py | .py | from typing import Optional, List, Dict, Any, Sequence, Union
from ...backend_api.services import datasets
from ...backend_api import Session
from ..base import IdObjectBase
from ..util import exact_match_regex
from ..session import SendError
from ...task import Task
from .save_frames_request_no_validate_wrapped impor... | 667 | 25,459 |
clearml | clearml/backend_interface/datasets/save_frames_request_no_validate_wrapped.py | .py | _SaveFramesRequestNoValidate = None
def _get_save_frames_request_no_validate():
"""
Make sure the _SaveFramesRequestNoValidate class is not created at import time.
Creating it at import time will result in an API call being made to the server
which won't work on machines with no network connectivity/m... | 20 | 734 |
clearml | clearml/backend_interface/metrics/reporter.py | .py | import atexit
import datetime
import json
import logging
import math
import os
from time import sleep, time
from types import TracebackType
from typing import Optional, Union, List, Tuple, Type, Dict, TYPE_CHECKING, Any
from typing import Iterable as _Iterable
import PIL
import numpy
import numpy as np
if TYPE_CHECKI... | 1,239 | 44,079 |
clearml | clearml/backend_interface/metrics/__init__.py | .py | """ Metrics management and batching support """
from .interface import Metrics
from .reporter import Reporter
from .events import ScalarEvent, VectorEvent, PlotEvent, ImageEvent
__all__ = [
"Metrics",
"Reporter",
"ScalarEvent",
"VectorEvent",
"PlotEvent",
"ImageEvent",
]
| 14 | 297 |
clearml | clearml/backend_interface/metrics/interface.py | .py | import json
import logging
import os
from functools import partial
from logging import warning
from multiprocessing.pool import ThreadPool, AsyncResult
from time import time
from typing import Optional, Callable, List, Union, TYPE_CHECKING, Any
from pathlib2 import Path
from ...backend_api import Session, CallResult
... | 426 | 17,488 |
clearml | clearml/backend_interface/metrics/events.py | .py | from abc import ABC, abstractmethod
import time
from functools import reduce
from logging import getLevelName
from typing import Optional, List, Dict, Union, Tuple, Any
import io
import attr
import numpy as np
import pathlib2
import six
from PIL import Image
from six.moves.urllib.parse import urlparse, urlunparse
fro... | 511 | 19,514 |
clearml | clearml/backend_interface/task/models.py | .py | import re
import typing
from typing import Any
from collections import OrderedDict
from collections.abc import KeysView
try:
from collections import UserList
except ImportError:
UserList = list
try:
from collections import UserDict
except ImportError:
UserDict = dict
from clearml.backend_api import S... | 122 | 4,067 |
clearml | clearml/backend_interface/task/hyperparams.py | .py | from collections import defaultdict
from typing import (
Optional,
Sequence,
Callable,
Mapping,
Union,
Dict,
Iterable,
Generator,
Tuple,
Any,
)
from ...backend_api import Session
from ...backend_api.services import tasks
class HyperParams:
def __init__(self, task: Any) -> ... | 240 | 9,325 |
clearml | clearml/backend_interface/task/__init__.py | .py | from .task import Task
__all__ = ["Task"]
| 4 | 43 |
clearml | clearml/backend_interface/task/populate.py | .py | import inspect
import json
import os
import re
import tempfile
from functools import reduce
from logging import getLogger
from sys import platform
from typing import Optional, Sequence, Union, Tuple, List, Callable, Dict, Any
from pathlib2 import Path
from six.moves.urllib.parse import urlparse
from .args import _Arg... | 1,269 | 59,728 |
clearml | clearml/backend_interface/task/args.py | .py | import argparse
import yaml
from enum import Enum
from inspect import isfunction
from argparse import (
_StoreAction, # noqa
ArgumentError, # noqa
_StoreConstAction, # noqa
_SubParsersAction, # noqa
_AppendAction, # noqa
SUPPRESS, # noqa
) # noqa
from copy import copy
from typing impo... | 775 | 33,563 |
clearml | clearml/backend_interface/task/task.py | .py | """ Backend task management support """
import itertools
import json
import logging
import os
import sys
import warnings
from copy import copy
from datetime import datetime
from enum import Enum
from multiprocessing import RLock
from operator import itemgetter
from tempfile import gettempdir
from threading import Threa... | 3,353 | 138,039 |
clearml | clearml/backend_interface/task/log.py | .py | import json
import sys
from typing import List, Any
from pathlib2 import Path
from logging import (
LogRecord,
getLogger,
basicConfig,
getLevelName,
INFO,
WARNING,
Formatter,
makeLogRecord,
warning,
)
from logging.handlers import BufferingHandler
from .development.worker import Dev... | 369 | 14,153 |
clearml | clearml/backend_interface/task/access.py | .py | import itertools
import operator
from abc import abstractproperty
from typing import Dict, Optional, Any
from pathlib2 import Path
class AccessMixin:
"""A mixin providing task fields access functionality"""
session = abstractproperty()
data = abstractproperty()
cache_dir = abstractproperty()
lo... | 128 | 4,596 |
clearml | clearml/backend_interface/task/development/worker.py | .py | from typing import Optional, Callable, Union, Any
import attr
from threading import Thread
from time import time
from ....config import deferred_config
from ....backend_interface.task.development.stop_signal import TaskStopSignal
from ....backend_api.services import tasks
from ....utilities.lowlevel.threads import k... | 183 | 6,570 |
clearml | clearml/backend_interface/task/development/stop_signal.py | .py | from typing import Optional, TYPE_CHECKING
from ....config import deferred_config
if TYPE_CHECKING:
from ....backend_interface import Task
class TaskStopReason:
stopped = "stopped"
reset = "reset"
status_changed = "status_changed"
class TaskStopSignal:
enabled = deferred_config("development.su... | 74 | 2,750 |
clearml | clearml/backend_interface/task/repo/freeze.py | .py | import sys
import os
import json
from typing import Tuple
from .util import get_command_output
def pip_freeze(combine_conda_with_pip: bool = False) -> Tuple[str, str]:
req_lines = []
local_packages = []
conda_lines = []
conda_prefix = os.environ.get("CONDA_PREFIX")
if conda_prefix and not conda_p... | 79 | 3,508 |
clearml | clearml/backend_interface/task/repo/util.py | .py | import os
from subprocess import check_output
from typing import List, Optional
from furl import furl
def get_command_output(command: List[str], path: Optional[str] = None, strip: bool = True) -> str:
"""
Run a command and return its output
:raises CalledProcessError: when command execution fails
:ra... | 37 | 1,264 |
clearml | clearml/backend_interface/task/repo/__init__.py | .py | from .scriptinfo import ScriptInfo
from .freeze import pip_freeze
__all__ = ["ScriptInfo", "pip_freeze"]
| 5 | 106 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.