This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [settings] | |
| multi_line_output=3 | |
| lines_after_imports=2 | |
| sections=FUTURE,STDLIB,FIRSTPARTY,THIRDPARTY,LOCALFOLDER | |
| [tool.isort] | |
| profile="black" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # See https://pre-commit.com for more information | |
| # See https://pre-commit.com/hooks.html for more hooks | |
| # For Python 3.10. | |
| repos: | |
| - repo: https://github.com/PyCQA/isort | |
| rev: 5.12.0 | |
| hooks: | |
| - id: isort | |
| language_version: python3.10 | |
| - repo: https://github.com/asottile/add-trailing-comma |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import argparse | |
| from concurrent.futures import ProcessPoolExecutor | |
| import multiprocessing as mp | |
| import os | |
| import numpy as np | |
| from PIL import ( | |
| Image, | |
| UnidentifiedImageError | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import argparse | |
| from concurrent.futures import ProcessPoolExecutor | |
| import multiprocessing as mp | |
| import os | |
| import time | |
| import boto3 | |
| import numpy as np | |
| import pandas as pd | |
| from tqdm import tqdm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import torch | |
| def get_gpu_report(): | |
| device_ids = list(range(torch.cuda.device_count())) | |
| device_names = [torch.cuda.get_device_name(id_) for id_ in device_ids] | |
| mem_reserved = [torch.cuda.max_memory_reserved(id_) for id_ in device_ids] | |
| mem_reserved_fmtd = [f'{mem / (1024 ** 3):.2f}' for mem in mem_reserved] | |
| longest_name = max(len(name) for name in device_names) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import argparse | |
| from concurrent.futures import ProcessPoolExecutor | |
| from datetime import datetime | |
| import multiprocessing as mp | |
| import os | |
| import time | |
| import numpy as np | |
| import pandas as pd | |
| import requests |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def precision_recall_fscore_support( | |
| y_true, | |
| y_pred, | |
| *, | |
| beta=1.0, | |
| labels=None, | |
| pos_label=1, | |
| average=None, | |
| warn_for=("precision", "recall", "f-score"), | |
| sample_weight=None, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import torch | |
| import torch.nn as nn | |
| import torch.nn.functional as F | |
| import torch.optim as optim | |
| import torchvision | |
| import torchvision.transforms as transforms | |
| # ================== Step 1: Basic configuration for the data. ================================ | |
| transform = transforms.Compose([transforms.ToTensor(), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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 applicable law or agreed to in writing, software | |
| # distributed under the License is distributed on an "AS IS" BASIS, |