# coding: utf-8 # Python 2 and 3 compatibility from __future__ import ( print_function, absolute_import, division, unicode_literals, with_statement, ) # Make sure python version is compatible with fasttext from cleanlab.util import VersionWarning python_version = VersionWarning( warning_str="fastText supports Python 3 versions (not python 2).", list_of_compatible_versions=[3.4, 3.5, 3.6, 3.7], ) # fasttext only exists for these versions that are also compatible with cleanlab # if python_version.is_compatible(): # pragma: no cover import time import os import copy from sklearn.metrics import accuracy_score import numpy as np # You need to install fasttext using pip for this library to work from fasttext import train_supervised, load_model LABEL = '__label__' NEWLINE = ' __newline__ '
# # ## Note to use this model you'll need to have pytorch installed # See: https://pytorch.org/get-started/locally/ # In[ ]: # Python 2 and 3 compatibility from __future__ import print_function, absolute_import, division, unicode_literals, with_statement # In[ ]: # Make sure python version is compatible with pyTorch from cleanlab.util import VersionWarning python_version = VersionWarning( warning_str="pyTorch supports Python version 2.7, 3.5, 3.6, 3.7.", list_of_compatible_versions=[2.7, 3.5, 3.6], ) # In[ ]: if python_version.is_compatible(): # pragma: no cover import argparse 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 import Variable from torch.utils.data.sampler import SubsetRandomSampler import numpy as np
#!/usr/bin/env python # coding: utf-8 # Python 2 and 3 compatibility from __future__ import ( print_function, absolute_import, division, unicode_literals, with_statement, ) # Make sure python version is compatible with pyTorch from cleanlab.util import VersionWarning python_version = VersionWarning( warning_str="pyTorch supports Python version 3.5, 3.6, 3.7, 3.8", list_of_compatible_versions=[3.5, 3.6, 3.7, 3.8, ], ) if python_version.is_compatible(): from cleanlab.models.mnist_pytorch import ( CNN, SKLEARN_DIGITS_TEST_SIZE, SKLEARN_DIGITS_TRAIN_SIZE, ) import cleanlab import numpy as np from sklearn.metrics import accuracy_score from sklearn.datasets import load_digits from torch import from_numpy import pytest