Search is not available for this dataset
repo stringlengths 2 152 ⌀ | file stringlengths 15 239 | code stringlengths 0 58.4M | file_length int64 0 58.4M | avg_line_length float64 0 1.81M | max_line_length int64 0 12.7M | extension_type stringclasses 364
values |
|---|---|---|---|---|---|---|
null | ceph-main/src/tools/rbd_mirror/image_sync/Types.h | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
#ifndef RBD_MIRROR_IMAGE_SYNC_TYPES_H
#define RBD_MIRROR_IMAGE_SYNC_TYPES_H
#include "cls/rbd/cls_rbd_types.h"
#include "librbd/Types.h"
#include <list>
#include <string>
#include <boost/optional.hpp>
struct Context;
n... | 2,017 | 25.906667 | 70 | h |
null | ceph-main/src/tools/rbd_mirror/image_sync/Utils.cc | // -*- mode:c++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
#include "Utils.h"
namespace rbd {
namespace mirror {
namespace image_sync {
namespace util {
namespace {
static const std::string SNAP_NAME_PREFIX(".rbd-mirror");
} // anonymous namespace
std::string get_snapshot_na... | 519 | 19.8 | 76 | cc |
null | ceph-main/src/tools/rbd_mirror/image_sync/Utils.h | // -*- mode:c++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
#include <string>
namespace rbd {
namespace mirror {
namespace image_sync {
namespace util {
std::string get_snapshot_name_prefix(const std::string& local_mirror_uuid);
} // namespace util
} // namespace image_sync
} /... | 358 | 20.117647 | 75 | h |
null | ceph-main/src/tools/rbd_mirror/instance_watcher/Types.cc | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
#include "Types.h"
#include "include/ceph_assert.h"
#include "include/stringify.h"
#include "common/Formatter.h"
namespace rbd {
namespace mirror {
namespace instance_watcher {
namespace {
class EncodePayloadVisitor : ... | 6,335 | 24.756098 | 86 | cc |
null | ceph-main/src/tools/rbd_mirror/instance_watcher/Types.h | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
#ifndef RBD_MIRROR_INSTANCE_WATCHER_TYPES_H
#define RBD_MIRROR_INSTANCE_WATCHER_TYPES_H
#include <string>
#include <set>
#include <boost/variant.hpp>
#include "include/buffer_fwd.h"
#include "include/encoding.h"
#includ... | 5,146 | 24.994949 | 79 | h |
null | ceph-main/src/tools/rbd_mirror/instances/Types.h | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
#ifndef CEPH_RBD_MIRROR_INSTANCES_TYPES_H
#define CEPH_RBD_MIRROR_INSTANCES_TYPES_H
#include <string>
#include <vector>
namespace rbd {
namespace mirror {
namespace instances {
struct Listener {
typedef std::vector<s... | 624 | 20.551724 | 70 | h |
null | ceph-main/src/tools/rbd_mirror/leader_watcher/Types.cc | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
#include "Types.h"
#include "include/ceph_assert.h"
#include "include/stringify.h"
#include "common/Formatter.h"
namespace rbd {
namespace mirror {
namespace leader_watcher {
namespace {
class EncodePayloadVisitor : pu... | 3,880 | 22.95679 | 82 | cc |
null | ceph-main/src/tools/rbd_mirror/leader_watcher/Types.h | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
#ifndef RBD_MIRROR_LEADER_WATCHER_TYPES_H
#define RBD_MIRROR_LEADER_WATCHER_TYPES_H
#include "include/int_types.h"
#include "include/buffer_fwd.h"
#include "include/encoding.h"
#include <string>
#include <vector>
#includ... | 2,870 | 23.330508 | 79 | h |
null | ceph-main/src/tools/rbd_mirror/pool_watcher/RefreshImagesRequest.cc | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
#include "tools/rbd_mirror/pool_watcher/RefreshImagesRequest.h"
#include "common/debug.h"
#include "common/errno.h"
#include "cls/rbd/cls_rbd_client.h"
#include "librbd/Utils.h"
#include <map>
#define dout_context g_ceph... | 2,281 | 24.355556 | 82 | cc |
null | ceph-main/src/tools/rbd_mirror/pool_watcher/RefreshImagesRequest.h | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
#ifndef CEPH_RBD_MIRROR_POOL_WATCHER_REFRESH_IMAGES_REQUEST_H
#define CEPH_RBD_MIRROR_POOL_WATCHER_REFRESH_IMAGES_REQUEST_H
#include "include/buffer.h"
#include "include/rados/librados.hpp"
#include "tools/rbd_mirror/Typ... | 1,718 | 22.22973 | 88 | h |
null | ceph-main/src/tools/rbd_mirror/pool_watcher/Types.h | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
#ifndef CEPH_RBD_MIRROR_POOL_WATCHER_TYPES_H
#define CEPH_RBD_MIRROR_POOL_WATCHER_TYPES_H
#include "tools/rbd_mirror/Types.h"
#include <string>
namespace rbd {
namespace mirror {
namespace pool_watcher {
struct Listene... | 656 | 22.464286 | 70 | h |
null | ceph-main/src/tools/rbd_mirror/service_daemon/Types.cc | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
#include "tools/rbd_mirror/service_daemon/Types.h"
#include <iostream>
namespace rbd {
namespace mirror {
namespace service_daemon {
std::ostream& operator<<(std::ostream& os, const CalloutLevel& callout_level) {
swit... | 609 | 19.333333 | 79 | cc |
null | ceph-main/src/tools/rbd_mirror/service_daemon/Types.h | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
#ifndef CEPH_RBD_MIRROR_SERVICE_DAEMON_TYPES_H
#define CEPH_RBD_MIRROR_SERVICE_DAEMON_TYPES_H
#include "include/int_types.h"
#include <iosfwd>
#include <string>
#include <boost/variant.hpp>
namespace rbd {
namespace mir... | 782 | 22.029412 | 78 | h |
null | ceph-main/src/tools/rbd_nbd/nbd-netlink.h | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
/*
* Copyright (C) 2017 Facebook. All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License v2 as published by the Free Software Foundation.
*
* This progra... | 2,423 | 23 | 68 | h |
null | ceph-main/src/tools/rbd_nbd/rbd-nbd.cc | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
/*
* rbd-nbd - RBD in userspace
*
* Copyright (C) 2015 - 2016 Kylin Corporation
*
* Author: Yunchuan Wen <yunchuan.wen@kylin-cloud.com>
* Li Wang <li.wang@kylin-cloud.com>
*
* This is free software; you ca... | 62,839 | 25.270903 | 116 | cc |
null | ceph-main/src/tools/rbd_recover_tool/test_rbd_recover_tool.sh | #!/usr/bin/env bash
#
# Copyright (C) 2015 Ubuntu Kylin
#
# Author: Min Chen <minchen@ubuntukylin.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Library Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# a... | 13,603 | 24.053407 | 165 | sh |
null | ceph-main/src/tools/rbd_wnbd/rbd_wnbd.cc | /*
* rbd-wnbd - RBD in userspace
*
* Copyright (C) 2020 SUSE LINUX GmbH
*
* This is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software
* Foundation. See file COPYING.
*
*/
#include <objidl.h>
// L... | 58,098 | 30.035791 | 95 | cc |
null | ceph-main/src/tools/rbd_wnbd/rbd_wnbd.h | /*
* Ceph - scalable distributed file system
*
* Copyright (C) 2020 SUSE LINUX GmbH
*
* This is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software
* Foundation. See file COPYING.
*
*/
#ifndef RBD... | 4,685 | 23.154639 | 76 | h |
null | ceph-main/src/tools/rbd_wnbd/wnbd_handler.cc | /*
* Ceph - scalable distributed file system
*
* Copyright (C) 2020 SUSE LINUX GmbH
*
* This is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software
* Foundation. See file COPYING.
*
*/
#define dou... | 12,469 | 26.286652 | 85 | cc |
null | ceph-main/src/tools/rbd_wnbd/wnbd_handler.h | /*
* Ceph - scalable distributed file system
*
* Copyright (C) 2020 SUSE LINUX GmbH
*
* This is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software
* Foundation. See file COPYING.
*
*/
#ifndef WNB... | 4,886 | 24.857143 | 80 | h |
null | ceph-main/src/tools/rbd_wnbd/wnbd_wmi.cc | /*
* Ceph - scalable distributed file system
*
* Copyright (c) 2019 SUSE LLC
* Copyright (C) 2022 Cloudbase Solutions
*
* This is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software
* Foundation. Se... | 6,511 | 23.854962 | 78 | cc |
null | ceph-main/src/tools/rbd_wnbd/wnbd_wmi.h | /*
* Ceph - scalable distributed file system
*
* Copyright (c) 2019 SUSE LLC
* Copyright (C) 2022 Cloudbase Solutions
*
* This is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software
* Foundation. Se... | 2,059 | 17.727273 | 74 | h |
null | ceph-main/src/tools/rgw/parse-cr-dump.py | #!/usr/bin/python
from __future__ import print_function
from collections import Counter
import argparse
import json
import re
import sys
def gen_mgrs(args, cr_dump):
""" traverse and return one manager at a time """
mgrs = cr_dump['coroutine_managers']
if args.manager is not None:
yield mgrs[args.m... | 5,850 | 33.621302 | 125 | py |
null | ceph-main/src/tracing/README.md | Installation
============
The LTTng libraries that ship with Ubuntu 12.04 have been very buggy, and the
generated header files using `lttng-gen-tp` have needed to be fixed just to
compile in the Ceph tree. The packages available in Ubuntu 14.04 seem to work
alright, and for older versions please install LTTng from the... | 2,257 | 42.423077 | 83 | md |
null | ceph-main/src/tracing/bluestore.c | #define TRACEPOINT_CREATE_PROBES
/*
* The header containing our TRACEPOINT_EVENTs.
*/
#include "tracing/bluestore.h"
| 119 | 19 | 47 | c |
null | ceph-main/src/tracing/cyg_profile.c | #define TRACEPOINT_CREATE_PROBES
/*
* The header containing our TRACEPOINT_EVENTs.
*/
#include "tracing/cyg_profile.h"
| 122 | 16.571429 | 47 | c |
null | ceph-main/src/tracing/cyg_profile_functions.c | #include "acconfig.h"
#ifdef WITH_LTTNG
#define TRACEPOINT_DEFINE
#define TRACEPOINT_PROBE_DYNAMIC_LINKAGE
#include "tracing/cyg_profile.h"
#undef TRACEPOINT_PROBE_DYNAMIC_LINKAGE
#undef TRACEPOINT_DEFINE
#endif
void __cyg_profile_func_enter(void *this_fn, void *call_site)
__attribute__((no_instrument_function));... | 754 | 22.59375 | 70 | c |
null | ceph-main/src/tracing/eventtrace.c | #define TRACEPOINT_CREATE_PROBES
/*
* The header containing our TRACEPOINT_EVENTs.
*/
#include "tracing/eventtrace.h"
| 120 | 19.166667 | 47 | c |
null | ceph-main/src/tracing/librados.c |
#define TRACEPOINT_CREATE_PROBES
/*
* The header containing our TRACEPOINT_EVENTs.
*/
#include "tracing/librados.h"
| 119 | 16.142857 | 47 | c |
null | ceph-main/src/tracing/librbd.c |
#define TRACEPOINT_CREATE_PROBES
/*
* The header containing our TRACEPOINT_EVENTs.
*/
#include "tracing/librbd.h"
| 117 | 15.857143 | 47 | c |
null | ceph-main/src/tracing/objectstore.c |
#define TRACEPOINT_CREATE_PROBES
/*
* The header containing our TRACEPOINT_EVENTs.
*/
#include "tracing/objectstore.h"
| 122 | 16.571429 | 47 | c |
null | ceph-main/src/tracing/oprequest.c |
#define TRACEPOINT_CREATE_PROBES
/*
* The header containing our TRACEPOINT_EVENTs.
*/
#include "tracing/oprequest.h"
| 120 | 16.285714 | 47 | c |
null | ceph-main/src/tracing/osd.c |
#define TRACEPOINT_CREATE_PROBES
/*
* The header containing our TRACEPOINT_EVENTs.
*/
#include "tracing/osd.h"
| 114 | 15.428571 | 47 | c |
null | ceph-main/src/tracing/pg.c |
#define TRACEPOINT_CREATE_PROBES
/*
* The header containing our TRACEPOINT_EVENTs.
*/
#include "tracing/pg.h"
| 113 | 15.285714 | 47 | c |
null | ceph-main/src/tracing/rgw_op.c |
#define TRACEPOINT_CREATE_PROBES
/*
* The header containing our TRACEPOINT_EVENTs.
*/
#include "tracing/rgw_op.h"
| 117 | 15.857143 | 47 | c |
null | ceph-main/src/tracing/rgw_rados.c |
#define TRACEPOINT_CREATE_PROBES
/*
* The header containing our TRACEPOINT_EVENTs.
*/
#include "tracing/rgw_rados.h"
| 120 | 16.285714 | 47 | c |
null | ceph-main/src/tracing/tracing-common.h | #if !defined(TRACING_COMMON_H)
#define TRACING_COMMON_H
// Amount of buffer data to dump when using ceph_ctf_sequence or ceph_ctf_sequencep.
// If 0, then *_data field is omitted entirely.
#if !defined(CEPH_TRACE_BUF_TRUNC_LEN)
#define CEPH_TRACE_BUF_TRUNC_LEN 0u
#endif
// TODO: This is GCC-specific. Replace CEPH_MA... | 4,279 | 40.553398 | 141 | h |
lightly | lightly-master/.pre-commit-config.yaml | repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
hooks:
- id: detect-private-key # check for private keys
- id: check-added-large-files # prevent commit of files >500kB
args: ['--maxkb=500']
- repo: local
hooks:
- id: pytest-check # run all tests
nam... | 830 | 26.7 | 92 | yaml |
lightly | lightly-master/.readthedocs.yml | # .readthedocs.yml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
# Required
version: 2
# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/source/conf.py
# Optionally build your docs in additional formats such as PDF
... | 538 | 24.666667 | 83 | yml |
lightly | lightly-master/CONTRIBUTING.md | # How to contribute to lightly?
Everyone is welcome to contribute, and we value everybody's contribution. Code is thus not the only way to help the community. Answering questions, helping others, reaching out and improving the documentations are immensely valuable to the community.
It also helps us if you spread the ... | 5,628 | 37.292517 | 303 | md |
lightly | lightly-master/DOCS.md | # Lightly
Lightly is a PIP package for self-supervised learning.
> We, at [Lightly](https://www.lightly.ai), are passionate engineers who want to make deep learning more efficient. We want to help popularize the use of self-supervised methods to understand and filter raw image data. Our solution can be applied before... | 830 | 38.571429 | 404 | md |
lightly | lightly-master/PRECOMMITHOOKS.md | # Pre-Commit Hooks
We use pre-commit hooks to identify simple issues before submission to code review. In particular, our hooks currently check for:
* Private keys in the commit
* Large files in the commit (>500kB)
* Units which don't pass their unit tests (on push only)
## Install Pre-Commit
`pre-commit` comes as a ... | 1,383 | 25.113208 | 129 | md |
lightly | lightly-master/README.md |



[](https://pypi.org/project/lightly/)
[
builtins.__LIGHTLY_SETUP__ = True
import lightly
def load_description(path_dir=PATH_ROOT, filename="DOCS.md"):
"""Load long description from ... | 4,985 | 32.24 | 90 | py |
lightly | lightly-master/.github/PULL_REQUEST_TEMPLATE/PR_template_checklist.md | closes #issue_number
## Description
- [ ] My change is breaking
Please_describe_what_you_changed_and_why___You_do_not_need_to_repeat_stuff_from_the_issue
## Tests
- [ ] My change is covered by existing tests.
- [ ] My change needs new tests.
- [ ] I have added/adapted the tests accordingly.
- [ ] I have manually test... | 710 | 31.318182 | 89 | md |
lightly | lightly-master/.github/PULL_REQUEST_TEMPLATE/PR_template_checklist_full.md | closes #issue_number
## Description
- [ ] My change is breaking
Please_describe_what_you_changed_and_why___You_do_not_need_to_repeat_stuff_from_the_issue
## Tests
- [ ] My change is covered by existing tests
- [ ] My change needs new tests
- [ ] I have added/adapted tests accordingly.
- [ ] I have manually tested the... | 1,012 | 31.677419 | 89 | md |
lightly | lightly-master/.github/PULL_REQUEST_TEMPLATE/PR_template_minimal.md | closes #issue_number
## Description
Please_describe_what_you_changed_and_why___You_do_not_need_to_repeat_stuff_from_the_issue
## Documentation
- [ ] I have updated the documentation.
- [ ] I need help on it.
## Tests
- [ ] I have updated the tests.
- [ ] I need help on it. | 276 | 22.083333 | 89 | md |
lightly | lightly-master/.github/workflows/release_pypi.yml | name: Build and release lightly
on:
workflow_dispatch:
# TODO(Philipp, 03/23): Enable me after proper testing.
# release:
# types: [published]
jobs:
build:
name: Build and release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-dept... | 1,905 | 32.438596 | 110 | yml |
lightly | lightly-master/.github/workflows/test.yml | name: Unit Tests
on:
push:
paths-ignore:
- 'docs/**'
pull_request:
paths-ignore:
- 'docs/**'
workflow_dispatch:
jobs:
test:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.7", "3.10"]
steps:
- name: Checkout Code
uses: actions/che... | 1,307 | 24.153846 | 111 | yml |
lightly | lightly-master/.github/workflows/test_code_format.yml | name: Code Format Check
on:
push:
pull_request:
workflow_dispatch:
jobs:
test:
name: Check
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Hack to get setup-python to work on nektos/act
run: |
if [ ! -f "/etc/lsb-release" ] ; then
... | 861 | 23.628571 | 83 | yml |
lightly | lightly-master/.github/workflows/test_setup.yml | name: check setup.py
on:
push:
paths-ignore:
- 'docs/**'
pull_request:
paths-ignore:
- 'docs/**'
workflow_dispatch:
jobs:
test:
name: Test setup.py
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Hack to get setup-python to ... | 1,458 | 27.057692 | 97 | yml |
lightly | lightly-master/.github/workflows/tests_unmocked.yml | name: run unmocked tests
on: [workflow_dispatch]
# Why is this only triggered manually with workflow_dispatch?
# - We have many unittests anyway
# - We ran into quota problems with too many tests (3000mins for the pip package)
# - The tests are unreliable / not deterministic, as they depend on the API from staging
# -... | 1,087 | 34.096774 | 107 | yml |
lightly | lightly-master/.github/workflows/weekly_dependency_test.yml | # Install lightly from scratch and run tests.
# Python environment for regular unit tests is cached. In this workflow,
# we always pick up the latest dependencies and therefore check if a new
# external release breaks lightly.
name: Weekly Dependency Test
on:
workflow_dispatch:
schedule:
- cron: '0 22 * * THU'... | 1,127 | 27.923077 | 72 | yml |
lightly | lightly-master/benchmarks/imagenet/resnet50/README.md | # ImageNet ResNet50
Reference implementations for self-supervised learning (SSL) methods on ImageNet with
ResNet50 backbones.
**Note**
> The benchmarks are still in beta phase and there will be breaking changes and
frequent updates. PRs for new methods are highly welcome!
**Goals**
* Provide easy to use/adapt refere... | 3,022 | 34.564706 | 185 | md |
lightly | lightly-master/benchmarks/imagenet/resnet50/byol.py | import copy
from typing import List, Tuple
import torch
from pytorch_lightning import LightningModule
from torch import Tensor
from torch.nn import Identity
from torchvision.models import resnet50
from lightly.loss import NegativeCosineSimilarity
from lightly.models.modules import BYOLPredictionHead, BYOLProjectionHe... | 6,095 | 39.912752 | 134 | py |
lightly | lightly-master/benchmarks/imagenet/resnet50/dcl.py | import math
from typing import List, Tuple
import torch
from pytorch_lightning import LightningModule
from torch import Tensor
from torch.nn import Identity
from torchvision.models import resnet50
from lightly.loss.dcl_loss import DCLLoss
from lightly.models.modules import SimCLRProjectionHead
from lightly.models.uti... | 4,528 | 38.72807 | 124 | py |
lightly | lightly-master/benchmarks/imagenet/resnet50/dclw.py | import math
from typing import List, Tuple
import torch
from pytorch_lightning import LightningModule
from torch import Tensor
from torch.nn import Identity
from torchvision.models import resnet50
from lightly.loss.dcl_loss import DCLWLoss
from lightly.models.modules import SimCLRProjectionHead
from lightly.models.ut... | 4,547 | 38.894737 | 124 | py |
lightly | lightly-master/benchmarks/imagenet/resnet50/dino.py | import copy
from typing import List, Tuple, Union
import torch
from pytorch_lightning import LightningModule
from torch import Tensor
from torch.nn import Identity
from torch.optim import SGD
from torch.optim.optimizer import Optimizer
from torchvision.models import resnet50
from lightly.loss import DINOLoss
from lig... | 6,242 | 36.383234 | 89 | py |
lightly | lightly-master/benchmarks/imagenet/resnet50/finetune_eval.py | from pathlib import Path
from pytorch_lightning import Trainer
from pytorch_lightning.callbacks import DeviceStatsMonitor, LearningRateMonitor
from pytorch_lightning.loggers import TensorBoardLogger
from torch.nn import Module
from torch.optim import SGD
from torch.utils.data import DataLoader
from torchvision import ... | 4,040 | 29.156716 | 88 | py |
lightly | lightly-master/benchmarks/imagenet/resnet50/knn_eval.py | from pathlib import Path
import torch
from pytorch_lightning import LightningModule, Trainer
from pytorch_lightning.callbacks import DeviceStatsMonitor
from pytorch_lightning.loggers import TensorBoardLogger
from torch.utils.data import DataLoader
from torchvision import transforms as T
from lightly.data import Light... | 2,573 | 26.978261 | 88 | py |
lightly | lightly-master/benchmarks/imagenet/resnet50/linear_eval.py | from pathlib import Path
from pytorch_lightning import Trainer
from pytorch_lightning.callbacks import DeviceStatsMonitor, LearningRateMonitor
from pytorch_lightning.loggers import TensorBoardLogger
from torch.nn import Module
from torch.utils.data import DataLoader
from torchvision import transforms as T
from lightl... | 3,233 | 28.135135 | 88 | py |
lightly | lightly-master/benchmarks/imagenet/resnet50/main.py | from argparse import ArgumentParser
from datetime import datetime
from pathlib import Path
from typing import Sequence, Union
import byol
import dcl
import dclw
import dino
import finetune_eval
import knn_eval
import linear_eval
import simclr
import swav
import torch
from pytorch_lightning import LightningModule, Trai... | 7,370 | 30.909091 | 88 | py |
lightly | lightly-master/benchmarks/imagenet/resnet50/simclr.py | import math
from typing import List, Tuple
import torch
from pytorch_lightning import LightningModule
from torch import Tensor
from torch.nn import Identity
from torchvision.models import resnet50
from lightly.loss.ntx_ent_loss import NTXentLoss
from lightly.models.modules import SimCLRProjectionHead
from lightly.mod... | 4,429 | 38.553571 | 124 | py |
lightly | lightly-master/benchmarks/imagenet/resnet50/swav.py | import math
from typing import List, Tuple
import torch
from pytorch_lightning import LightningModule
from torch import Tensor
from torch.nn import Identity, ModuleList
from torch.nn import functional as F
from torchvision.models import resnet50
from lightly.loss.memory_bank import MemoryBankModule
from lightly.loss.... | 7,494 | 36.475 | 100 | py |
lightly | lightly-master/docs/README.md | # Documentation Guide
## Prerequisites
Make sure you installed dev dependencies:
```
pip install -r ../requirements/dev.txt
```
You may have to set up a clean environment (e.g. with Conda) and use setuptools from the parent directory:
```
conda create -n lightly python=3.7
conda activate lightly
pip install -e .["all... | 4,904 | 30.044304 | 170 | md |
lightly | lightly-master/docs/app.yaml | # When using the first time you need to authenticate your machine
# running `gcloud auth login` in your terminal.
#
# To deploy the app simply run `gcloud app deploy` from a terminal
# within the docs folder.
runtime: python27
api_version: 1
threadsafe: true
service: docs
handlers:
- url: /
secure: always
redirec... | 538 | 21.458333 | 66 | yaml |
lightly | lightly-master/docs/source/conf.py | # Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... | 3,329 | 29.833333 | 79 | py |
lightly | lightly-master/docs/source/_static/my-styles.css | body{
font-family:Arial, Helvetica, sans-serif;
}
h1{
font-family:Arial, Helvetica, sans-serif !important;
} | 116 | 18.5 | 56 | css |
lightly | lightly-master/docs/source/_templates/footer.html | <!--
Copied from https://github.com/readthedocs/sphinx_rtd_theme/blob/ddf840cb7206d7c45270560f077b12daa147f915/sphinx_rtd_theme/footer.html
Adapted to add link to website from copyright in the footer, see comment below
-->
<footer>
{% if (theme_prev_next_buttons_location == 'bottom' or theme_prev_next_buttons... | 2,704 | 44.083333 | 269 | html |
lightly | lightly-master/docs/source/_templates/layout.html | {% extends "!layout.html" %}
{# Custom CSS overrides #}
{% set bootswatch_css_custom = ['/_static/my-styles.css'] %}
<!--
Copy from https://github.com/readthedocs/sphinx_rtd_theme/blob/ddf840cb7206d7c45270560f077b12daa147f915/sphinx_rtd_theme/layout.html#L184-L205
We need this to override the footer
-->
{%- blo... | 2,190 | 25.083333 | 145 | html |
lightly | lightly-master/docs/source/docker/advanced/code_examples/load_model_from_checkpoint.py | from collections import OrderedDict
import torch
import lightly
def load_ckpt(ckpt_path, model_name="resnet-18", model_width=1, map_location="cpu"):
ckpt = torch.load(ckpt_path, map_location=map_location)
state_dict = OrderedDict()
for key, value in ckpt["state_dict"].items():
if ("projection_h... | 1,782 | 32.018519 | 143 | py |
lightly | lightly-master/docs/source/docker/advanced/code_examples/python_create_dataset_azure_example.py | import json
import lightly
from lightly.openapi_generated.swagger_client.models.dataset_type import DatasetType
from lightly.openapi_generated.swagger_client.models.datasource_purpose import (
DatasourcePurpose,
)
# Create the Lightly client to connect to the API.
client = lightly.api.ApiWorkflowClient(token="YOU... | 852 | 27.433333 | 84 | py |
lightly | lightly-master/docs/source/docker/advanced/code_examples/python_create_dataset_gcs_example.py | import json
import lightly
from lightly.openapi_generated.swagger_client.models.dataset_type import DatasetType
from lightly.openapi_generated.swagger_client.models.datasource_purpose import (
DatasourcePurpose,
)
# Create the Lightly client to connect to the API.
client = lightly.api.ApiWorkflowClient(token="YOU... | 925 | 29.866667 | 84 | py |
lightly | lightly-master/docs/source/docker/advanced/code_examples/python_create_dataset_s3_example.py | import json
import lightly
from lightly.openapi_generated.swagger_client.models.dataset_type import DatasetType
from lightly.openapi_generated.swagger_client.models.datasource_purpose import (
DatasourcePurpose,
)
# Create the Lightly client to connect to the API.
client = lightly.api.ApiWorkflowClient(token="YOU... | 920 | 27.78125 | 84 | py |
lightly | lightly-master/docs/source/docker/advanced/code_examples/python_create_frame_predictions.py | import json
from pathlib import Path
from typing import Dict, List
import av
dataset_dir = Path("/datasets/my_dataset")
predictions_dir = dataset_dir / ".lightly" / "predictions" / "my_prediction_task"
def model_predict(frame) -> List[Dict]:
# This function must be overwritten to generate predictions for a fram... | 2,462 | 30.987013 | 95 | py |
lightly | lightly-master/docs/source/docker/advanced/code_examples/python_run_datapool_example.py | import lightly
# Create the Lightly client to connect to the API.
client = lightly.api.ApiWorkflowClient(token="YOUR_TOKEN")
# Let's fetch the dataset we created above, by name
client.set_dataset_id_by_name("pedestrian-videos-datapool")
# Schedule the compute run using our custom config.
# We show here the full defa... | 1,812 | 29.216667 | 83 | py |
lightly | lightly-master/docs/source/docker/advanced/code_examples/python_run_datapool_example_2.py | import lightly
# Create the Lightly client to connect to the API.
client = lightly.api.ApiWorkflowClient(token="YOUR_TOKEN")
# Let's fetch the dataset we created above, by name
client.set_dataset_id_by_name("pedestrian-videos-datapool")
# Schedule the compute run using our custom config.
# We show here the full defa... | 1,812 | 29.216667 | 83 | py |
lightly | lightly-master/docs/source/docker/advanced/code_examples/python_run_object_level.py | import json
import lightly
from lightly.openapi_generated.swagger_client.models.dataset_type import DatasetType
from lightly.openapi_generated.swagger_client.models.datasource_purpose import (
DatasourcePurpose,
)
# Create the Lightly client to connect to the API.
client = lightly.api.ApiWorkflowClient(token="YOU... | 4,122 | 29.316176 | 84 | py |
lightly | lightly-master/docs/source/docker/advanced/code_examples/python_run_object_level_pretagging.py | import json
import lightly
from lightly.openapi_generated.swagger_client.models.dataset_type import DatasetType
from lightly.openapi_generated.swagger_client.models.datasource_purpose import (
DatasourcePurpose,
)
# Create the Lightly client to connect to the API.
client = lightly.api.ApiWorkflowClient(token="YOU... | 3,506 | 27.983471 | 84 | py |
lightly | lightly-master/docs/source/docker/advanced/code_examples/python_run_pretagging.py | import json
import lightly
from lightly.openapi_generated.swagger_client.models.dataset_type import DatasetType
from lightly.openapi_generated.swagger_client.models.datasource_purpose import (
DatasourcePurpose,
)
# Create the Lightly client to connect to the API.
client = lightly.api.ApiWorkflowClient(token="YOU... | 3,540 | 28.756303 | 86 | py |
lightly | lightly-master/docs/source/docker/advanced/code_examples/python_run_sequence_selection.py | import json
import lightly
from lightly.openapi_generated.swagger_client.models.dataset_type import DatasetType
from lightly.openapi_generated.swagger_client.models.datasource_purpose import (
DatasourcePurpose,
)
# Create the Lightly client to connect to the API.
client = lightly.api.ApiWorkflowClient(token="YOU... | 3,355 | 28.699115 | 86 | py |
lightly | lightly-master/docs/source/docker/advanced/code_examples/semantic_segmentation_inference.py | import json
import os
import numpy as np
TASK_NAME = "lightly_semantic_segmentation"
CATEGORIES = ["background", "car", "person"]
def get_dummy_prediction(height: int = 500, width: int = 500):
"""Returns a dummy prediction of shape h x w x n_classes.
Height and width are in pixels.
"""
return np.ra... | 3,854 | 30.598361 | 78 | py |
lightly | lightly-master/docs/source/docker/integration/examples/create_dataset.py | import lightly
# Create the Lightly client to connect to the API.
client = lightly.api.ApiWorkflowClient(token="LIGHTLY_TOKEN")
# Create a new dataset on the Lightly Platform.
client.create_dataset("dataset-name")
# Connect the dataset to your cloud bucket.
# AWS S3
client.set_s3_config(
resource_path="s3://buc... | 854 | 22.108108 | 64 | py |
lightly | lightly-master/docs/source/docker/integration/examples/trigger_job.py | import time
from lightly.openapi_generated.swagger_client import (
DockerRunScheduledState,
DockerRunState,
)
# You can reuse the client from previous scripts. If you want to create a new
# one you can uncomment the following line:
# import lightly
# client = lightly.api.ApiWorkflowClient(token="LIGHTLY_TOKEN... | 2,169 | 28.726027 | 98 | py |
lightly | lightly-master/docs/source/docker_archive/advanced/code_examples/python_run_active_learning.py | import lightly
# Create the Lightly client to connect to the API.
client = lightly.api.ApiWorkflowClient(token="LIGHTLY_TOKEN", dataset_id="DATASET_ID")
# Schedule the docker run with
# - "active_learning.task_name" set to your task name
# - "method" set to "coral"
# All other settings are default values and we sho... | 1,832 | 32.327273 | 86 | py |
lightly | lightly-master/docs/source/docker_archive/advanced/code_examples/python_run_object_level.py | import lightly
# Create the Lightly client to connect to the API.
client = lightly.api.ApiWorkflowClient(token="LIGHTLY_TOKEN", dataset_id="DATASET_ID")
# Schedule the docker run with the "object_level.task_name" argument set.
# All other settings are default values and we show them so you can easily edit
# the value... | 1,805 | 34.411765 | 86 | py |
lightly | lightly-master/docs/source/docker_archive/advanced/code_examples/python_run_object_level_pretagging.py | import lightly
# Create the Lightly client to connect to the API.
client = lightly.api.ApiWorkflowClient(token="LIGHTLY_TOKEN", dataset_id="DATASET_ID")
# Schedule the docker run with the "object_level.task_name" argument set to
# "lightly_pretagging" and with "pretagging" set to True.
# All other settings are defaul... | 1,856 | 34.711538 | 86 | py |
lightly | lightly-master/docs/source/docker_archive/integration/examples/create_dataset.py | import lightly
# Create the Lightly client to connect to the API.
client = lightly.api.ApiWorkflowClient(token="LIGHTLY_TOKEN")
# Create a new dataset on the Lightly Platform.
client.create_dataset("dataset-name")
# Connect the dataset to your cloud bucket.
# AWS S3
client.set_s3_config(
resource_path="s3://buc... | 854 | 22.108108 | 64 | py |
lightly | lightly-master/docs/source/docker_archive/integration/examples/trigger_job.py | # You can reuse the client from the previous script. If you want to create a new
# one you can uncomment the following line:
# client = lightly.api.ApiWorkflowClient(token="LIGHTLY_TOKEN", dataset_id="DATASET_ID")
# Schedule the compute run using our custom config.
# We show here the full default config so you can eas... | 1,675 | 33.916667 | 88 | py |
lightly | lightly-master/docs/source/getting_started/benchmarks/cifar10_benchmark.py | # -*- coding: utf-8 -*-
"""
Benchmark Results
Updated: 27.03.2023 (42a6a924b1b6d5b6cc89a6b2a0a0942cc4af93ab)
------------------------------------------------------------------------------------------
| Model | Batch Size | Epochs | KNN Test Accuracy | Time | Peak GPU Usage |
---------------------------... | 36,355 | 36.022403 | 122 | py |
lightly | lightly-master/docs/source/getting_started/benchmarks/imagenet100_benchmark.py | # -*- coding: utf-8 -*-
"""
Benchmark Results
Updated: 13.02.2023
------------------------------------------------------------------------------------------
| Model | Batch Size | Epochs | KNN Test Accuracy | Time | Peak GPU Usage |
----------------------------------------------------------------------... | 27,467 | 35 | 122 | py |
lightly | lightly-master/docs/source/getting_started/benchmarks/imagenette_benchmark.py | # -*- coding: utf-8 -*-
"""
Note that this benchmark also supports a multi-GPU setup. If you run it on
a system with multiple GPUs make sure that you kill all the processes when
killing the application. Due to the way we setup this benchmark the distributed
processes might continue the benchmark if one of the nodes is ... | 57,415 | 37.150166 | 122 | py |
lightly | lightly-master/docs/source/getting_started/code_examples/plot_image_augmentations.py | import glob
from PIL import Image
import lightly
# let's get all jpg filenames from a folder
glob_to_data = "/datasets/clothing-dataset/images/*.jpg"
fnames = glob.glob(glob_to_data)
# load the first two images using pillow
input_images = [Image.open(fname) for fname in fnames[:2]]
# create our colalte function
co... | 836 | 30 | 88 | py |
lightly | lightly-master/docs/source/tutorials_source/package/Base-RCNN-FPN.yaml | MODEL:
META_ARCHITECTURE: "GeneralizedRCNN"
BACKBONE:
NAME: "build_resnet_fpn_backbone"
RESNETS:
OUT_FEATURES: ["res2", "res3", "res4", "res5"]
FPN:
IN_FEATURES: ["res2", "res3", "res4", "res5"]
ANCHOR_GENERATOR:
SIZES: [[32], [64], [128], [256], [512]] # One size for each in feature map
... | 1,318 | 29.674419 | 96 | yaml |
lightly | lightly-master/docs/source/tutorials_source/package/tutorial_custom_augmentations.py | """
.. _lightly-custom-augmentation-5:
Tutorial 5: Custom Augmentations
==============================================
In this tutorial, we will train a model on chest X-ray images in a self-supervised manner.
In self-supervised learning, X-ray images can pose some problems: They are often more
than eight bits deep w... | 15,483 | 34.513761 | 155 | py |
lightly | lightly-master/docs/source/tutorials_source/package/tutorial_moco_memory_bank.py | # -*- coding: utf-8 -*-
"""
.. _lightly-moco-tutorial-2:
Tutorial 2: Train MoCo on CIFAR-10
==============================================
In this tutorial, we will train a model based on the MoCo Paper
`Momentum Contrast for Unsupervised Visual Representation Learning <https://arxiv.org/abs/1911.05722>`_.
When tra... | 13,053 | 31.472637 | 132 | py |
lightly | lightly-master/docs/source/tutorials_source/package/tutorial_pretrain_detectron2.py | """
.. _lightly-detectron-tutorial-6:
.. role:: bash(code)
:language: bash
Tutorial 6: Pre-train a Detectron2 Backbone with Lightly
==========================================================
In this tutorial we show how you can do self-supervised pre-training of a
`Detectron2 <https://github.com/facebookresearch/... | 9,875 | 33.055172 | 395 | py |
lightly | lightly-master/docs/source/tutorials_source/package/tutorial_simclr_clothing.py | """
.. _lightly-simclr-tutorial-3:
Tutorial 3: Train SimCLR on Clothing
==============================================
In this tutorial, we will train a SimCLR model using lightly. The model,
augmentations and training procedure is from
`A Simple Framework for Contrastive Learning of Visual Representations <https://... | 10,155 | 30.638629 | 108 | py |
lightly | lightly-master/docs/source/tutorials_source/package/tutorial_simsiam_esa.py | """
.. _lightly-simsiam-tutorial-4:
Tutorial 4: Train SimSiam on Satellite Images
==============================================
In this tutorial we will train a SimSiam model in old-school PyTorch style on a
set of satellite images of Italy. We will showcase how the generated embeddings
can be used for exploration a... | 14,744 | 31.839644 | 118 | py |
lightly | lightly-master/docs/source/tutorials_source/platform/tutorial_label_studio_export.py | """
.. _lightly-tutorial-export-labelstudio:
Tutorial 10: Export to LabelStudio
=============================================
This tutorial shows how you can easily label all images of a tag from Lightly
using the open-source data labeling tool `LabelStudio <https://labelstud.io>`_.
What you will learn
-----------... | 2,887 | 37 | 128 | py |