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 | clearml/backend_interface/task/repo/detectors.py | .py | from abc import ABC
import logging
import os
from subprocess import call, CalledProcessError
from typing import Any
import attr
from pathlib2 import Path
from ....config.defs import (
VCS_REPO_TYPE,
VCS_DIFF,
VCS_STATUS,
VCS_ROOT,
VCS_BRANCH,
VCS_COMMIT_ID,
VCS_REPOSITORY_URL,
)
from ....d... | 391 | 13,680 |
clearml | clearml/backend_interface/task/repo/scriptinfo.py | .py | import os
import sys
from copy import copy
from datetime import datetime, timezone
from functools import partial
from tempfile import gettempdir, mkdtemp
from types import TracebackType
from typing import Optional, Tuple, Union, Dict, List, Any
from urllib.parse import urlparse
import attr
import logging
import json
i... | 1,638 | 67,627 |
clearml | clearml/binding/fire_bind.py | .py | from typing import Optional, Callable, List, Dict, Tuple, TYPE_CHECKING, Any
try:
import fire
import fire.core
import fire.helptext
except ImportError:
fire = None
import inspect
from .frameworks import _patched_call_no_recursion_guard # noqa
from ..config import get_remote_task_id, running_remotely... | 391 | 15,791 |
clearml | clearml/binding/matplotlib_bind.py | .py | # -*- coding: utf-8 -*-
import sys
import threading
from copy import deepcopy
from tempfile import mkstemp
from typing import Union, Dict, List, Tuple, TYPE_CHECKING, Any
if TYPE_CHECKING:
import matplotlib
from six import BytesIO
from .import_bind import PostImportHookPatching
from ..config import running_remo... | 806 | 34,324 |
clearml | clearml/binding/joblib_bind.py | .py | import sys
import warnings
from functools import partial
from io import IOBase
from typing import Callable, Union, IO, Any
from pathlib2 import Path
from .import_bind import PostImportHookPatching
from ..binding.frameworks import _patched_call, _Empty, WeightsFileHandler
from ..config import running_remotely
from ..d... | 223 | 8,508 |
clearml | clearml/binding/gradio_bind.py | .py | import sys
import os
from logging import getLogger
from typing import Optional, Callable, Any
from urllib.parse import urlparse
from .frameworks import _patched_call # noqa
from .import_bind import PostImportHookPatching
from ..config import running_remotely
class PatchGradio:
_current_task = None
__patched... | 128 | 4,887 |
clearml | clearml/binding/hydra_bind.py | .py | import io
import sys
from functools import partial
from typing import Callable, List, TYPE_CHECKING, Any
if TYPE_CHECKING:
from omegaconf import omegaconf
from ..config import running_remotely, get_remote_task_id, DEV_TASK_NO_REUSE
from ..debugging.log import LoggerRoot
class PatchHydra:
_original_run_job =... | 291 | 12,540 |
clearml | clearml/binding/absl_bind.py | .py | """ absl-py FLAGS binding utility functions """
from typing import Any
from ..backend_interface.task.args import _Arguments
from ..config import running_remotely
class PatchAbsl:
_original_DEFINE_flag = None
_original_FLAGS_parse_call = None
_current_task = None
__patched = False
@classmethod
... | 143 | 5,140 |
clearml | clearml/binding/environ_bind.py | .py | import os
from functools import partial
from multiprocessing import pool
from time import sleep
from typing import Callable, TYPE_CHECKING, Any
if TYPE_CHECKING:
from .. import Task
from ..config import TASK_LOG_ENVIRONMENT, running_remotely, config
from ..utilities.process.mp import BackgroundMonitor
class Envi... | 314 | 11,707 |
clearml | clearml/binding/artifacts.py | .py | import gzip
import io
import json
import mimetypes
import os
import pickle
from copy import deepcopy
from datetime import datetime
from multiprocessing.pool import ThreadPool
from tempfile import mkdtemp, mkstemp
from threading import Thread
from time import time
from typing import Dict, Union, Optional, Sequence, Call... | 1,375 | 58,240 |
clearml | clearml/binding/click_bind.py | .py | from typing import Optional, Tuple, Dict, Callable, TYPE_CHECKING, Any
if TYPE_CHECKING:
from .. import Task
try:
from click.core import Command, Option, Argument, Group, Context # noqa
from click.types import BoolParamType # noqa
except ImportError:
Command = None
from .frameworks import _patched_... | 186 | 7,122 |
clearml | clearml/binding/args.py | .py | """ Argparse utilities"""
import argparse
import sys
import warnings
from argparse import ArgumentParser, Namespace
from copy import copy
from typing import Optional, List, Union, Dict, Tuple, Callable, Type, Any
try:
from argparse import _SubParsersAction
except ImportError:
_SubParsersAction = type(None)
c... | 317 | 12,879 |
clearml | clearml/binding/jsonargs_bind.py | .py | import copy
import json
import logging
from typing import Optional, Callable, Tuple, Union, List, Dict, TYPE_CHECKING, Any
try:
# public import capabilities of namespace, util, actions will be deprecated
# import from "protected" instead
from jsonargparse._namespace import Namespace
# noinspection Py... | 318 | 14,095 |
clearml | clearml/binding/import_bind.py | .py | import sys
import builtins
import types
from collections import defaultdict
from typing import Callable, Any
class PostImportHookPatching:
_patched = False
_post_import_hooks = defaultdict(list)
@staticmethod
def _init_hook() -> None:
if PostImportHookPatching._patched:
return
... | 75 | 2,753 |
clearml | clearml/binding/frameworks/pytorch_bind.py | .py | import importlib
import sys
import threading
from typing import Callable, Optional, Any
from pathlib2 import Path
from ..frameworks import (
_patched_call,
_patched_call_no_recursion_guard,
WeightsFileHandler,
_Empty,
)
from ..import_bind import PostImportHookPatching
from ...binding.frameworks.base_b... | 356 | 13,137 |
clearml | clearml/binding/frameworks/xgboost_bind.py | .py | import sys
from typing import Callable, Union, IO, Optional, Dict, List, TYPE_CHECKING, Any
from pathlib2 import Path
from ..frameworks import _patched_call, WeightsFileHandler, _Empty
from ..frameworks.base_bind import PatchBaseModelIO
from ..import_bind import PostImportHookPatching
if TYPE_CHECKING:
from ... ... | 217 | 7,449 |
clearml | clearml/binding/frameworks/tensorflow_bind.py | .py | import base64
import json
import logging
import os
import sys
import threading
from collections import defaultdict
from functools import partial
from io import BytesIO
from mimetypes import guess_extension
from tempfile import mkstemp
from typing import Union, List, Dict, Optional, Iterable, Tuple, Callable, Any
impor... | 2,760 | 115,053 |
clearml | clearml/binding/frameworks/__init__.py | .py | import os
import shutil
import sys
import threading
from enum import Enum
from random import randint
from tempfile import mkstemp
from typing import TYPE_CHECKING, Callable, Dict, Optional, Union, Any
from pathlib2 import Path
from ...backend_interface.model import Model
from ...config import running_remotely
from ..... | 557 | 22,501 |
clearml | clearml/binding/frameworks/lightgbm_bind.py | .py | import sys
from typing import Callable, Union, IO, Optional, Any
from pathlib2 import Path
from ..frameworks import _patched_call, WeightsFileHandler, _Empty
from ..frameworks.base_bind import PatchBaseModelIO
from ..import_bind import PostImportHookPatching
from ...config import running_remotely
from ...model import... | 148 | 5,241 |
clearml | clearml/binding/frameworks/megengine_bind.py | .py | import sys
from typing import Callable, Union, IO, Any
from pathlib2 import Path
from ..frameworks import _patched_call, WeightsFileHandler, _Empty
from ..frameworks.base_bind import PatchBaseModelIO
from ..import_bind import PostImportHookPatching
from ...model import Framework
class PatchMegEngineModelIO(PatchBas... | 177 | 5,838 |
clearml | clearml/binding/frameworks/fastai_bind.py | .py | import sys
from typing import Callable, TYPE_CHECKING, Any
import numpy as np
from clearml.utilities.version import Version
from . import _patched_call
from .tensorflow_bind import IsTensorboardInit
from .tensorflow_bind import WeightsGradientHistHelper
from ..import_bind import PostImportHookPatching
from ...debuggi... | 354 | 13,610 |
clearml | clearml/binding/frameworks/base_bind.py | .py | from abc import ABC, abstractmethod
from typing import Callable, Union, IO, TYPE_CHECKING, Any
if TYPE_CHECKING:
from clearml import Task
class PatchBaseModelIO(ABC):
"""
Base class for patched models
:param __main_task: Task to run (Experiment)
:type __main_task: Task
:param __patched: True... | 55 | 1,238 |
clearml | clearml/binding/frameworks/catboost_bind.py | .py | import sys
from typing import Callable, Union, IO, Any
from pathlib2 import Path
from ..frameworks import WeightsFileHandler, _Empty, _patched_call
from ..frameworks.base_bind import PatchBaseModelIO
from ..import_bind import PostImportHookPatching
from ...model import Framework
class PatchCatBoostModelIO(PatchBase... | 154 | 5,915 |
clearml | clearml/hyperdatasets/data_entry_image.py | .py | from typing import Optional, Sequence, Tuple, List, Dict, Any, Union
import logging
from clearml.storage.manager import StorageManagerDiskSpaceFileSizeStrategy
from .data_entry import (
DataEntry,
DataSubEntry,
ENTRY_CLASS_KEY,
SUB_ENTRY_CLASS_KEY,
_copy_without_keys,
_get_class_identifier,
... | 811 | 32,087 |
clearml | clearml/hyperdatasets/data_view.py | .py | import logging
import queue
import threading
from math import ceil
from queue import Queue
from typing import (
Any,
List,
Mapping,
Optional,
Tuple,
Union,
Sequence,
Iterable,
)
from clearml.backend_api import Session
from clearml.backend_api.services import dataviews as _dataviews
from... | 1,755 | 69,544 |
clearml | clearml/hyperdatasets/util.py | .py | """Utilities for HyperDataset DataView interactions used by Task."""
from typing import Any, Dict, Mapping, Optional, Sequence, TYPE_CHECKING
from clearml.debugging import get_logger
if TYPE_CHECKING:
from clearml.backend_interface.task.task import Task
def _rebuild_mapping_rules(mapping: Any, backend_cls: Any)... | 519 | 23,538 |
clearml | clearml/hyperdatasets/__init__.py | .py | """
HyperDataset package exposing data entry types, management helpers, and dataview utilities.
"""
from .data_entry import DataEntry, DataSubEntry
from .data_entry_image import DataEntryImage, DataSubEntryImage
from .core import HyperDataset
from .management import HyperDatasetManagement
from .data_view import DataVi... | 21 | 532 |
clearml | clearml/hyperdatasets/management.py | .py | from typing import (
Optional,
Sequence,
List,
Dict,
Any,
Tuple,
Type,
TypeVar,
)
from clearml.backend_api import Session
from clearml.backend_interface.util import get_existing_project, mutually_exclusive
from clearml.backend_interface.datasets.hyper_dataset import HyperDatasetManageme... | 329 | 13,470 |
clearml | clearml/hyperdatasets/data_entry.py | .py | import importlib
import logging
import uuid
from collections import deque
from typing import Any, Dict, Iterable, Iterator, List, Optional, Sequence, Set, Type, TypeVar
from clearml.storage.manager import StorageManagerDiskSpaceFileSizeStrategy
ENTRY_CLASS_KEY = "_clearml_data_entry_class"
SUB_ENTRY_CLASS_KEY = "_c... | 569 | 20,882 |
clearml | clearml/hyperdatasets/core.py | .py | import logging
import os
import re
from concurrent.futures import ThreadPoolExecutor
from typing import Optional, List, Any, Sequence, Dict, Union
import psutil
from requests.compat import json as requests_json
from clearml.backend_api import Session
from clearml.backend_interface.datasets.hyper_dataset import HyperD... | 928 | 37,680 |
clearml | clearml/storage/manager.py | .py | import fnmatch
import logging
import shutil
from multiprocessing.pool import ThreadPool
from random import random
from time import time
from typing import Iterator, List, Optional, Union
from six.moves.urllib.parse import quote
from pathlib2 import Path
from .cache import CacheManager
from .callbacks import ProgressR... | 633 | 27,931 |
clearml | clearml/storage/util.py | .py | import fnmatch
import sys
from typing import Optional, Callable, Any
from six.moves.urllib.parse import quote
# Imports backwards compatibility
from .filepaths import get_common_path # noqa: F401
from .hashing import ( # noqa: F401
sha256sum,
md5text,
crc32text,
hash_text,
hash_dict,
)
from .url ... | 77 | 2,006 |
clearml | clearml/storage/__init__.py | .py | """ Local and remote storage support """
from .manager import StorageManager
__all__ = ["StorageManager"]
| 6 | 108 |
clearml | clearml/storage/callbacks.py | .py | import logging
import os
from time import time
from typing import Optional, AnyStr, IO, Any
from ..config import config
try:
from tqdm import tqdm # noqa
except ImportError:
tqdm = None
class ProgressReport:
report_upload_chunk_size_mb = None
report_download_chunk_size_mb = None
def __init__(
... | 217 | 7,655 |
clearml | clearml/storage/size.py | .py | import re
import math
from enum import Enum
from typing import Union, Tuple, Dict, Set
FORMATTING_BASES = {
"binary": 1024,
"decimal": 1000,
}
BINARY_SCALE: Tuple[str] = ("B", "KiB", "MiB", "GiB", "TiB", "PiB")
DECIMAL_SCALE: Tuple[str] = ("B", "KB", "MB", "GB", "TB", "PB")
def format_size(
size_in_bytes... | 182 | 5,908 |
clearml | clearml/storage/url.py | .py | from typing import Sequence
from six.moves.urllib.parse import quote, urlparse, urlunparse
def quote_url(
url: str,
valid_schemes: Sequence[str] = ("http", "https"),
) -> str:
parsed = urlparse(url)
if parsed.scheme not in valid_schemes:
return url
parsed = parsed._replace(path=quote(pars... | 15 | 365 |
clearml | clearml/storage/hashing.py | .py | import json
from typing import Optional, Union, Dict, Tuple
from zlib import crc32
from clearml.debugging.log import LoggerRoot
from clearml.utilities.hashing import (
safe_hash,
sha256_safe_hash,
StrHashFunction,
)
STR_HASH_FUNCTIONS = {"md5", "sha256", "sha384", "sha512"}
DICT_HASH_FUNCTIONS = {"crc32",... | 140 | 4,588 |
clearml | clearml/storage/filepaths.py | .py | import os
from itertools import takewhile
from typing import Optional, Union, Sequence
from pathlib import Path
def get_common_path(filepaths: Sequence[Union[str, Path]]) -> Optional[str]:
"""
Return the common path of a list of file paths
:param filepaths: list of files (str or Path objects)
:retur... | 73 | 2,724 |
clearml | clearml/storage/cache.py | .py | import atexit
import os
import shutil
from collections import OrderedDict
from threading import RLock
from typing import Union, Optional, Tuple, Dict
from pathlib2 import Path
from clearml.utilities.hashing import md5_safe_hash
from .helper import StorageHelper
from .url import quote_url
from ..config import get_cac... | 418 | 16,491 |
clearml | clearml/storage/helper.py | .py | from __future__ import with_statement
import errno
import getpass
import itertools
import json
import logging
import mimetypes
import os
import platform
import shutil
import sys
import threading
from uuid import uuid4
from _socket import gethostname
from abc import ABC, abstractmethod
from collections import namedtupl... | 4,805 | 182,728 |
clearml | clearml/storage/archive.py | .py | import os
import tarfile
from typing import Union, Any
from pathlib import Path
from zipfile import ZipFile
from .filepaths import is_within_directory
def extract_zip_archive(
archive_path: str,
target: str = ".",
) -> None:
"""
Extracts a .zip archive file to a target location.
:param str archi... | 116 | 3,629 |
clearml | clearml/datasets/__init__.py | .py | from .dataset import FileEntry, Dataset
__all__ = [
"FileEntry",
"Dataset",
]
| 7 | 87 |
clearml | clearml/datasets/dataset.py | .py | import calendar
import itertools
import json
import logging
import mimetypes
import os
import re
import shutil
from concurrent.futures import ThreadPoolExecutor
from copy import deepcopy, copy
from multiprocessing.pool import ThreadPool
from tempfile import mkdtemp
from typing import Union, Optional, Sequence, List, Di... | 4,282 | 189,643 |
clearml | clearml/automation/monitor.py | .py | from datetime import datetime
from time import time, sleep
from typing import Optional, Sequence
from ..backend_api.session.client import APIClient
from ..backend_interface.util import exact_match_regex
from ..task import Task
class Monitor:
"""
Base class for monitoring Tasks on the system.
Inherit to i... | 188 | 6,319 |
clearml | clearml/automation/aws_driver.py | .py | import base64
from typing import Dict, Optional
import attr
from attr.validators import instance_of
from .. import Task
from ..utilities.pyhocon import ConfigFactory, ConfigTree
from .auto_scaler import CloudDriver
from .cloud_driver import parse_tags
try:
# noinspection PyPackageRequirements
import boto3
... | 209 | 8,572 |
clearml | clearml/automation/parameters.py | .py | import sys
from itertools import product
from random import Random as BaseRandom
from typing import Mapping, Sequence, Optional, Union, Any
class RandomSeed:
"""
The base class controlling random sampling for every optimization strategy.
"""
_random = BaseRandom(1337)
_seed = 1337
@staticmet... | 389 | 12,982 |
clearml | clearml/automation/scheduler.py | .py | import json
import logging
from datetime import datetime, timezone
from threading import Thread, enumerate as enumerate_threads
from time import sleep, time
from typing import List, Union, Optional, Callable, Sequence, Dict, Any
from attr import attrs, attrib
from dateutil.relativedelta import relativedelta
from .con... | 1,097 | 43,715 |
clearml | clearml/automation/cloud_driver.py | .py | import logging
from abc import ABC, abstractmethod
import os
from typing import List, Tuple, Any
import attr
from ..backend_api import Session
from ..backend_api.session.defs import ENV_AUTH_TOKEN
env_git_user = "CLEARML_AUTOSCALER_GIT_USER"
env_git_pass = "CLEARML_AUTOSCALER_GIT_PASSWORD"
bash_script_template = ""... | 236 | 6,905 |
clearml | clearml/automation/trigger.py | .py | import json
import logging
from datetime import datetime, timezone
from threading import enumerate as enumerate_threads
from typing import List, Optional, Union, Callable, Set, Any
from attr import attrs, attrib
from .job import ClearmlJob
from .scheduler import BaseScheduleJob, BaseScheduler, ExecutedJob
from ..back... | 967 | 39,625 |
clearml | clearml/automation/__init__.py | .py | from .job import ClearmlJob
from .controller import PipelineController, PipelineDecorator
from .optimization import GridSearch, RandomSearch, HyperParameterOptimizer, Objective
from .parameters import (
UniformParameterRange,
DiscreteParameterRange,
UniformIntegerParameterRange,
ParameterSet,
LogUni... | 30 | 779 |
clearml | clearml/automation/optimization.py | .py | import json
from copy import copy, deepcopy
from datetime import datetime
from itertools import product
from logging import getLogger
from threading import Thread, Event
from time import time
from typing import (
List,
Set,
Union,
Sequence,
Optional,
Mapping,
Callable,
Tuple,
Generat... | 2,720 | 112,698 |
clearml | clearml/automation/job.py | .py | import json
import os
import subprocess
import sys
import tempfile
import warnings
from copy import deepcopy
from datetime import datetime
from logging import getLogger
from time import time, sleep
from typing import Optional, Mapping, Sequence, Callable, Union, Tuple, List, Any
from pathlib2 import Path
from clearml... | 927 | 36,025 |
clearml | clearml/automation/controller.py | .py | import atexit
import functools
import itertools
import inspect
import json
import os
import re
import warnings
from copy import copy, deepcopy
from datetime import datetime
from logging import getLogger
from multiprocessing import Process, Queue
from multiprocessing.pool import ThreadPool
from threading import Thread,... | 5,635 | 272,645 |
clearml | clearml/automation/auto_scaler.py | .py | import logging
import re
from collections import defaultdict, deque
from enum import Enum
from itertools import chain
from threading import Event, Thread
from time import sleep, time
from typing import Tuple, Dict, Optional, List, Generator, Any
import attr
from attr.validators import instance_of
from .cloud_driver i... | 483 | 19,698 |
clearml | clearml/automation/hpbandster/bandster.py | .py | import sys
from logging import getLogger
from time import sleep, time
from typing import Optional, Sequence, Any
from ..optimization import Objective, SearchStrategy
from ..parameters import (
DiscreteParameterRange,
UniformParameterRange,
RandomSeed,
UniformIntegerParameterRange,
Parameter,
)
from... | 458 | 20,815 |
clearml | clearml/automation/hpbandster/__init__.py | .py | from .bandster import OptimizerBOHB
__all__ = ["OptimizerBOHB"]
| 4 | 65 |
clearml | clearml/automation/optuna/__init__.py | .py | from .optuna import OptimizerOptuna
__all__ = ["OptimizerOptuna"]
| 4 | 67 |
clearml | clearml/automation/optuna/optuna.py | .py | from time import sleep
from typing import Optional, Sequence, Any
from ..optimization import Objective, SearchStrategy
from ..parameters import (
DiscreteParameterRange,
Parameter,
UniformIntegerParameterRange,
UniformParameterRange,
LogUniformParameterRange,
)
from ...task import Task
try:
# ... | 286 | 12,944 |
clearml | clearml/config/remote.py | .py | from typing import Optional
from .defs import TASK_ID_ENV_VAR
running_remotely_task_id = TASK_ID_ENV_VAR.get()
def override_current_task_id(task_id: Optional[str]) -> None:
"""
Overrides the current task id to simulate remote running with a specific task.
Use for testing and debug only.
:param tas... | 24 | 625 |
clearml | clearml/config/__init__.py | .py | """ Configuration module. Uses backend_config to load system configuration. """
import logging
import os
import sys
from os.path import expandvars, expanduser
from typing import Optional, Callable, Iterable, Tuple, List, Any
from pathlib2 import Path
from clearml.utilities.hashing import md5_safe_hash
from .defs impo... | 292 | 8,617 |
clearml | clearml/config/cache.py | .py | import json
from os.path import expanduser
from pathlib2 import Path
from . import running_remotely
from .defs import SESSION_CACHE_FILE
class SessionCache:
"""
Handle SDK session cache.
TODO: Improve error handling to something like "except (FileNotFoundError, PermissionError, JSONDecodeError)"
TOD... | 54 | 1,714 |
clearml | clearml/config/defs.py | .py | import tempfile
from pathlib2 import Path
from ..backend_config import EnvEntry
from ..backend_config.converters import base64_to_text, or_
SESSION_CACHE_FILE = ".session.json"
DEFAULT_CACHE_DIR = str(Path(tempfile.gettempdir()) / "clearml_cache")
TASK_ID_ENV_VAR = EnvEntry("CLEARML_TASK_ID", "TRAINS_TASK_ID")
DOCK... | 61 | 3,238 |
clearml | clearml/cli/debug/__main__.py | .py | import argparse
import sys
from argparse import ArgumentParser
from pprint import pprint
from clearml import Task
from clearml.backend_api.session import Session
from clearml.config import ConfigWrapper
from clearml.utilities.pyhocon import HOCONConverter
from clearml.utilities.pyhocon.exceptions import ConfigMissingE... | 127 | 3,742 |
clearml | clearml/cli/config/__main__.py | .py | """ ClearML configuration wizard"""
from __future__ import print_function
import argparse
import os
import urllib
from typing import Tuple, List, Dict, Optional, Any
from urllib.parse import ParseResult
import six
from pathlib2 import Path
from six.moves import input
from six.moves.urllib.parse import urlparse
from ... | 388 | 15,010 |
clearml | clearml/cli/task/__main__.py | .py | import sys
from argparse import ArgumentParser
from pathlib2 import Path
import clearml.backend_api.session
from clearml import Task, PipelineController
from clearml.backend_interface.task.populate import CreateAndPopulate
from clearml.version import __version__
clearml.backend_api.session.Session.add_client("clearm... | 355 | 13,252 |
clearml | clearml/cli/data/__main__.py | .py | import json
import os
import shutil
from argparse import ArgumentParser, HelpFormatter
from functools import partial
from typing import Sequence, Optional, Dict, Any
from pathlib2 import Path
import clearml.backend_api.session
from clearml.datasets import Dataset
from clearml.version import __version__
clearml.backe... | 980 | 33,133 |
clearml | clearml/cli/hpo/__main__.py | .py | import argparse
import json
import sys
from argparse import ArgumentParser, RawTextHelpFormatter
from typing import List, Union
import clearml.backend_api.session
from clearml import Task
from clearml.automation import (
DiscreteParameterRange,
UniformIntegerParameterRange,
UniformParameterRange,
LogUn... | 365 | 13,638 |
clearml | clearml/external/kerastuner.py | .py | from logging import getLogger
from typing import Optional, Any
from ..task import Task
_logger = getLogger("clearml.external.kerastuner")
try:
import pandas as pd
except ImportError:
pd = None
_logger.warning("Pandas is not installed, summary table reporting will be skipped.")
try:
from kerastuner i... | 124 | 5,178 |
clearml | clearml/utilities/resource_monitor.py | .py | import logging
import os
import platform
import sys
import warnings
from time import time
from typing import Dict, List, Any
import psutil
from pathlib2 import Path
from .process.mp import BackgroundMonitor
from ..backend_api import Session
from ..binding.frameworks.tensorflow_bind import IsTensorboardInit
from ..con... | 649 | 28,742 |
clearml | clearml/utilities/files.py | .py | import os
from sys import platform
import pathlib2
import psutil
def get_filename_max_length(dir_path: str) -> int:
default = 255 # Common filesystems like NTFS, EXT4 and HFS+ limited with 255
try:
dir_path = pathlib2.Path(os.path.abspath(dir_path))
if platform == "win32":
# noin... | 37 | 1,286 |
clearml | clearml/utilities/enum.py | .py | from typing import Dict, List, Any
class EnumOptions:
"""Base class for enum-like classes using class-attributes with string values to represent enum key/value pairs"""
__cache = None
@classmethod
def values(cls) -> List[str]:
"""Extract list of enum-like options based on the derived classes... | 31 | 1,077 |
clearml | clearml/utilities/seed.py | .py | import random
import sys
try:
import numpy as np
except Exception:
np = None
def make_deterministic(seed: int = 1337, cudnn_deterministic: bool = False) -> None:
"""
Ensure deterministic behavior across PyTorch using the provided random seed.
This function makes sure that torch, numpy and random ... | 72 | 2,173 |
clearml | clearml/utilities/async_manager.py | .py | import os
import time
from typing import Optional, Callable, Any
from .process.mp import SingletonLock
class AsyncManagerMixin:
_async_results_lock = SingletonLock()
# per pid (process) list of async jobs (support for sub-processes forking)
_async_results = {}
@classmethod
def _add_async_result(... | 69 | 2,415 |
clearml | clearml/utilities/distutils_version.py | .py | #
# distutils/version.py
#
# Implements multiple version numbering conventions for the
# Python Module Distribution Utilities.
#
# $Id$
#
"""Provides classes to represent module version numbers (one class for
each style of version numbering). There are currently two such classes
implemented: StrictVersion and LooseVe... | 335 | 12,566 |
clearml | clearml/utilities/parallel.py | .py | import os
from collections import deque
from concurrent.futures import ThreadPoolExecutor
from copy import deepcopy
from tempfile import mkstemp
from threading import Thread
from time import sleep
from typing import Callable, Optional, Union, Generator, List, Type, Dict, Any
from zipfile import ZipFile, ZIP_DEFLATED
f... | 508 | 19,974 |
clearml | clearml/utilities/deferred.py | .py | import threading
from functools import wraps
from typing import Callable, List, Type, Union, Any
import attr
class DeferredExecutionPool:
@attr.s
class _DeferredAction:
method = attr.ib()
args = attr.ib()
kwargs = attr.ib()
def __init__(self, instance: Any) -> None:
self.... | 146 | 5,453 |
clearml | clearml/utilities/__init__.py | .py | from .dicts import Logs
__all__ = ["Logs"]
| 4 | 44 |
clearml | clearml/utilities/io_manager.py | .py | from typing import Any
class IOCallsManager:
def __init__(self) -> None:
self.threads_io = {}
def add_io_to_thread(self, thread_id: int, io_object: Any) -> None:
if thread_id in self.threads_io:
self.threads_io[thread_id].add(id(io_object))
else:
self.threads_i... | 34 | 1,236 |
clearml | clearml/utilities/dicts.py | .py | """ Utilities """
from typing import Optional, Any
_epsilon = 0.00001
class ReadOnlyDict(dict):
"""A read-only dictionary that can only be accessed via its keys."""
def __readonly__(self, *args: Any, **kwargs: Any) -> None:
raise ValueError("This is a read only dictionary")
__setitem__ = __reado... | 203 | 5,870 |
clearml | clearml/utilities/check_updates.py | .py | from __future__ import absolute_import, division, print_function
import json
import os
from typing import Union, Tuple, List
import requests
from .version import Version
from ..backend_api.session import Session
from ..backend_config import EnvEntry
class CheckPackageUpdates:
_package_version_checked = False
... | 84 | 2,732 |
clearml | clearml/utilities/version.py | .py | from __future__ import absolute_import, division, print_function
import re
from copy import deepcopy
from typing import Callable, Union, List, Optional, Tuple, Any
from attr import attrs, attrib
from math import inf
class InvalidVersion(ValueError):
"""
An invalid version was found, users should refer to PEP... | 338 | 11,229 |
clearml | clearml/utilities/matching.py | .py | from fnmatch import fnmatch
from typing import Union
from pathlib2 import Path
def matches_any_wildcard(path: str, wildcards: Union[str, list], recursive: bool = True) -> bool:
"""
Checks if given pattern matches any supplied wildcard
:param path: path to check
:param wildcards: wildcards to check a... | 45 | 1,582 |
clearml | clearml/utilities/networking.py | .py | import socket
import subprocess
import requests
from typing import Optional
from ..backend_config import EnvEntry
def get_private_ip() -> str:
"""
Get the private IP of this machine
:return: A string representing the IP of this machine
"""
approaches = (
_get_private_ip_from_env_vars,
... | 108 | 3,205 |
clearml | clearml/utilities/proxy_object.py | .py | import itertools
import json
from copy import copy
from logging import getLogger
from typing import Callable, Union, Optional, Mapping, Tuple, Dict, Any
import yaml
class ProxyDictPostWrite(dict):
"""Dictionary wrapper that updates an arguments instance on any item set in the dictionary"""
def __init__(
... | 537 | 17,487 |
clearml | clearml/utilities/hashing.py | .py | import hashlib
import sys
StrHashFunction = str # Literal["md5", "sha256", "sha384", "sha512"]
# ``usedforsecurity`` was added to hashlib constructors in Python 3.9.
# All hashing in this SDK is non-cryptographic
# (caching, deduplication, identity, path shortening),
# so we pass ``usedforsecurity=False`` where supp... | 115 | 2,706 |
clearml | clearml/utilities/config.py | .py | from __future__ import division
import json
from typing import Union, Any
import pyparsing
from .dicts import hocon_quote_key, hocon_unquote_key
from .pyhocon import ConfigFactory, HOCONConverter
from ..storage.size import parse_size
def parse_human_size(value: Any) -> Any:
if isinstance(value, str):
r... | 126 | 3,982 |
clearml | clearml/utilities/py3_interop.py | .py | """ Convenience classes supporting python3-like concepts """
from abc import ABC, abstractmethod
from types import TracebackType
from typing import Optional, Type
class AbstractContextManager(ABC):
"""An abstract base class for context managers. Supported in contextlib from python 3.6 and up"""
def __enter__... | 43 | 1,360 |
clearml | clearml/utilities/plotly_reporter.py | .py | import json
from typing import List, Optional, Dict, Union, Tuple, Any
import numpy
import numpy as np
from ..errors import UsageError
from ..utilities.dicts import merge_dicts
try:
import pandas as pd
except ImportError:
pd = None
from attr import attrs, attrib
def create_2d_histogram_plot(
np_row_wis... | 700 | 22,969 |
clearml | clearml/utilities/attrs.py | .py | from typing import Any
import attr
from .version import Version
try:
# noinspection PyUnresolvedReferences
import importlib.metadata
attr_version = importlib.metadata.version("attrs")
except ImportError:
attr_version = attr.__version__
class attrs:
def __init__(self, *args: Any, **kwargs: Any)... | 29 | 808 |
clearml | clearml/utilities/gpu/pynvml.py | .py | #####
# Copyright (c) 2011-2023, NVIDIA Corporation. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list... | 4,967 | 166,329 |
clearml | clearml/utilities/gpu/gpustat.py | .py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Implementation of gpustat
@author Jongwook Choi
@url https://github.com/wookayin/gpustat
@ copied from gpu-stat 0.6.0
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_litera... | 673 | 25,590 |
clearml | clearml/utilities/gpu/pyrsmi.py | .py | # MIT License
#
# Copyright (c) 2023 Advanced Micro Devices, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy... | 609 | 20,905 |
clearml | clearml/utilities/requests_toolbelt/_compat.py | .py | """Private module full of compatibility hacks.
Primarily this is for downstream redistributions of requests that unvendor
urllib3 without providing a shim.
.. warning::
This module is private. If you use it, and something breaks, you were
warned
"""
import sys
import requests
try:
from requests.package... | 328 | 9,956 |
clearml | clearml/utilities/requests_toolbelt/__init__.py | .py | # -*- coding: utf-8 -*-
"""
requests-toolbelt
=================
See https://toolbelt.readthedocs.io/ for documentation
:copyright: (c) 2014 by Ian Cordasco and Cory Benfield
:license: Apache v2.0, see LICENSE for more details
"""
from .multipart import (
MultipartEncoder, MultipartEncoderMonitor, MultipartDecode... | 30 | 918 |
clearml | clearml/utilities/requests_toolbelt/multipart/__init__.py | .py | """
requests_toolbelt.multipart
===========================
See https://toolbelt.readthedocs.io/ for documentation
:copyright: (c) 2014 by Ian Cordasco and Cory Benfield
:license: Apache v2.0, see LICENSE for more details
"""
from .encoder import MultipartEncoder, MultipartEncoderMonitor
from .decoder import Multipa... | 32 | 854 |
clearml | clearml/utilities/requests_toolbelt/multipart/encoder.py | .py | # -*- coding: utf-8 -*-
"""
requests_toolbelt.multipart.encoder
===================================
This holds all of the implementation details of the MultipartEncoder
"""
import contextlib
import io
import os
from uuid import uuid4
import requests
from .._compat import fields
class FileNotSupportedError(Except... | 658 | 20,739 |
clearml | clearml/utilities/requests_toolbelt/multipart/decoder.py | .py | # -*- coding: utf-8 -*-
"""
requests_toolbelt.multipart.decoder
===================================
This holds all the implementation details of the MultipartDecoder
"""
import sys
import email.parser
from .encoder import encode_with
from requests.structures import CaseInsensitiveDict
def _split_on_find(content, ... | 157 | 4,861 |
clearml | clearml/utilities/pigar/utils.py | .py | # -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import
import difflib
import os
import re
import sys
from typing import Callable, Union, List, Tuple, Any, Generator
from typing import Dict as _Dict
PY32 = sys.version_info[:2] == (3, 2)
if sys.version_info[0] == 3:
binary_type =... | 147 | 3,898 |
clearml | clearml/utilities/pigar/__main__.py | .py | # -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import
import codecs
import os
from typing import Callable, Set, Optional, Tuple, List, Any
import six
from .log import logger
from .modules import ReqsModules
from .reqs import project_import_modules, is_std_or_local_lib, is_base_mod... | 217 | 8,897 |
clearml | clearml/utilities/pigar/modules.py | .py | # -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import
import collections
from typing import Tuple, List, Any
# FIXME: Just a workaround, not a radical cure..
_special_cases = {
"dogpile.cache": "dogpile.cache",
"dogpile.core": "dogpile.core",
"ruamel.yaml": "ruamel.yaml... | 109 | 3,251 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.