repo_name
stringclasses
400 values
branch_name
stringclasses
4 values
file_content
stringlengths
16
72.5k
language
stringclasses
1 value
num_lines
int64
1
1.66k
avg_line_length
float64
6
85
max_line_length
int64
9
949
path
stringlengths
5
103
alphanum_fraction
float64
0.29
0.89
alpha_fraction
float64
0.27
0.89
context
stringlengths
0
91.6k
context_file_paths
listlengths
0
3
jesbarlow/CP1404_practicals
refs/heads/master
numbers = [3, 1, 4, 1, 5, 9, 2] #numbers[0] - the value would be 3 #numbers[-1] - #numbers[3] - the value would be 1 #numbers[:-1] - #numbers[3:4] - #5 in numbers - the value would be true #7 in numbers - the value would be false #"3" in numbers - the value would be false #numbers + [6, 5, 3] - will print the list add...
Python
34
20.558823
77
/prac_4/warm_up.py
0.648907
0.590164
sentence = input("Enter a sentence:") words = sentence.split() counting = {} for word in words: if word in counting: counting[word] += 1 else: counting[word] = 1 print("Text: {}".format(sentence)) for key, value in counting.items(): print("{} : {}".format(key,value)) --- FILE SEPARATOR -...
[ "/prac_5/word_count.py", "/Prac_3/print_second_letter_name.py", "/prac_5/colour_codes.py" ]
jesbarlow/CP1404_practicals
refs/heads/master
items = int(input("Please enter the number of items:")) if items <= 0: print("Invalid number of items") items = input("Please enter the number of items:") prices = [] count = 0 for i in range(items): count = count + 1 item_cost = float(input("What is the price of item {}?: $".format(count))) price...
Python
21
24.190475
78
/Prac_1/shop_calculator.py
0.606285
0.595194
""" CP1404/CP5632 - Practical Answer the following questions: 1. When will a ValueError occur? - value errors occur when the input os anything other than a number(including negative numbers),for example - the letter a 2. When will a ZeroDivisionError occur? - this will occur whenever the user input...
[ "/prac_2/exceptions.py", "/prac_4/quickpick_lottery_generator.py", "/prac_4/warm_up.py" ]
jesbarlow/CP1404_practicals
refs/heads/master
def main(): name = get_name() print_name(name) def print_name(name): print(name[::2]) def get_name(): while True: name = input("What is your name?: ") if name.isalpha(): break else: print("Sorry, i didn't understand that.") return name main()
Python
22
13.5
53
/Prac_3/print_second_letter_name.py
0.518868
0.515723
numbers = [3, 1, 4, 1, 5, 9, 2] #numbers[0] - the value would be 3 #numbers[-1] - #numbers[3] - the value would be 1 #numbers[:-1] - #numbers[3:4] - #5 in numbers - the value would be true #7 in numbers - the value would be false #"3" in numbers - the value would be false #numbers + [6, 5, 3] - will print the list add...
[ "/prac_4/warm_up.py", "/prac_2/files.py", "/Prac_1/shop_calculator.py" ]
rlebras/pytorch-pretrained-BERT
refs/heads/master
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors and The HugginFace Inc. 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/LICENS...
Python
1,193
39.125732
117
/examples/run_classifier.py
0.552663
0.547253
from examples.run_classifier import AnliWithCSKProcessor, convert_examples_to_features_mc from pytorch_pretrained_bert import BertTokenizer dir = "../../abductive-nli/data/abductive_nli/one2one-correspondence/anli_with_csk/" processor = AnliWithCSKProcessor() examples = processor.get_train_examples(dir) tokenizer =...
[ "/examples/test_data_processor.py", "/pytorch_pretrained_bert/file_utils.py" ]
rlebras/pytorch-pretrained-BERT
refs/heads/master
""" Utilities for working with the local dataset cache. This file is adapted from the AllenNLP library at https://github.com/allenai/allennlp Copyright by the AllenNLP authors. """ import gzip import csv import os import logging import shutil import tempfile import json from urllib.parse import urlparse from pathlib im...
Python
324
33.370369
100
/pytorch_pretrained_bert/file_utils.py
0.602245
0.596408
from examples.run_classifier import AnliWithCSKProcessor, convert_examples_to_features_mc from pytorch_pretrained_bert import BertTokenizer dir = "../../abductive-nli/data/abductive_nli/one2one-correspondence/anli_with_csk/" processor = AnliWithCSKProcessor() examples = processor.get_train_examples(dir) tokenizer =...
[ "/examples/test_data_processor.py", "/examples/run_classifier.py" ]
rlebras/pytorch-pretrained-BERT
refs/heads/master
from examples.run_classifier import AnliWithCSKProcessor, convert_examples_to_features_mc from pytorch_pretrained_bert import BertTokenizer dir = "../../abductive-nli/data/abductive_nli/one2one-correspondence/anli_with_csk/" processor = AnliWithCSKProcessor() examples = processor.get_train_examples(dir) tokenizer =...
Python
17
30.529411
91
/examples/test_data_processor.py
0.790654
0.783178
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors and The HugginFace Inc. 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/LICENS...
[ "/examples/run_classifier.py", "/pytorch_pretrained_bert/file_utils.py" ]
MistyW/learngit
refs/heads/master
# _*_ coding: utf-8 _*_ # __author__ = wmm class Settings(): """存储《外星人入侵》的所有类""" def __init__(self): """初始化游戏的设置""" # 屏幕设置 self.screen_width = 1200 self.screen_height = 800 self.bg_color = (230, 230, 230)
Python
11
22.09091
39
/alien_invasion_game/Settings.py
0.490119
0.422925
[]
AllenMkandla/oop_person
refs/heads/master
class Person: pass def __init__(self, name, age, gender, interests): self.name = name self.age = age self.gender = gender self.interests = interests def hello(self): interests_str = 'My interests are ' for pos in range(len(self.interests)): ...
Python
21
32.142857
106
/oop.py
0.546763
0.542446
[]
tartaruz/Stein-saks-papir
refs/heads/master
import funk from time import sleep import os clear = lambda: os.system('cls') valg = 0 while (valg!="avslutt"): sleep(1) print() funk.velkommen() funk.meny() print() valg = funk.valg() clear() if valg=="1": print("--------------Spiller 1's tur--------------") pvalg=funk....
Python
55
23
60
/stein-saks-papir.py
0.468986
0.451589
import random from time import sleep#for stein saks papir def velkommen(): print("§-----------------------------------------------------------§") print("§-----| VELKOMMEN TIL STEIN/SAKS/PAPIR! |-----§") print("§-----------------------------------------------------------§") print() def va...
[ "/funk.py" ]
tartaruz/Stein-saks-papir
refs/heads/master
import random from time import sleep#for stein saks papir def velkommen(): print("§-----------------------------------------------------------§") print("§-----| VELKOMMEN TIL STEIN/SAKS/PAPIR! |-----§") print("§-----------------------------------------------------------§") print() def va...
Python
112
23.258928
74
/funk.py
0.361499
0.348273
import funk from time import sleep import os clear = lambda: os.system('cls') valg = 0 while (valg!="avslutt"): sleep(1) print() funk.velkommen() funk.meny() print() valg = funk.valg() clear() if valg=="1": print("--------------Spiller 1's tur--------------") pvalg=funk....
[ "/stein-saks-papir.py" ]
guanjz20/MM21_FME_solution
refs/heads/master
SAMM_ROOT = '/data/gjz_mm21/SAMM' CASME_2_LABEL_DIR = '/data/gjz_mm21/CASME_2_LongVideoFaceCropped/CASME_2_longVideoFaceCropped/labels' # kernel path GAUSS_KERNEL_PATH = { 'sm_kernel': '/home/gjz/lry_kernels/gauss2D-smooth.npy', 'dr1_kernel': '/home/gjz/lry_kernels/gauss1D-derivative1.npy', 'dr2_kernel': '...
Python
9
40
101
/dataset/params.py
0.722826
0.684783
''' generate the emotion intensity of each frame ''' # %% import os import pdb import os.path as osp from numpy.core.numeric import ones from numpy.lib.function_base import percentile import pandas as pd import numpy as np import matplotlib.pyplot as plt import params # %% main anno_dict = {} # intensity label_dict...
[ "/preprocess/samm_2_label_generation.py", "/trainer_cls.py", "/model/network.py" ]
guanjz20/MM21_FME_solution
refs/heads/master
import os import sys import cv2 from timm.utils import reduce_tensor import torch import shutil import numpy as np import os.path as osp import torch.nn.functional as F import matplotlib.pyplot as plt import torch.distributed as dist from torch.nn.modules import loss from datetime import datetime import paths import d...
Python
600
32.474998
98
/utils.py
0.506921
0.491735
import torch import torch.nn as nn import torch.nn.functional as F import numpy as np import glob import os import os.path as osp from torch.serialization import load class MLP(nn.Module): def __init__(self, hidden_units, dropout=0.3): super(MLP, self).__init__() input_feature_dim = hidden_units[...
[ "/model/network.py", "/preprocess/samm_2_label_generation.py", "/dataset/me_dataset.py" ]
guanjz20/MM21_FME_solution
refs/heads/master
# SAMM SAMM_ROOT = '/data/gjz_mm21/SAMM' SAMM_LABEL_DIR = SAMM_ROOT SAMM_VIDEO_DIR = '/data/gjz_mm21/SAMM/SAMM_longvideos' # CASME_2 CASME_2_ROOT = '/data/gjz_mm21/CASME_2_LongVideoFaceCropped/CASME_2_longVideoFaceCropped' CASME_2_LABEL_DIR = '/data/gjz_mm21/CASME_2_LongVideoFaceCropped/CASME_2_longVideoFaceCropped/la...
Python
9
48.111111
115
/paths.py
0.786848
0.741497
import argparse parser = argparse.ArgumentParser(description="x") parser.add_argument('--store_name', type=str, default="") parser.add_argument('--save_root', type=str, default="") parser.add_argument('--tag', type=str, default="") parser.add_argument('--snap', type=str, default="") parser.add_argument('--dataset', ...
[ "/config.py", "/model/network.py", "/preprocess/params.py" ]
guanjz20/MM21_FME_solution
refs/heads/master
from unicodedata import name import cv2 import os import pdb import torch import time import pywt import glob import numpy as np import os.path as osp from tqdm import tqdm from torch.utils.data import Dataset from torch import nn as nn from . import params from . import utils WT_CHANNEL = 4 sm_kernel = np.load(param...
Python
284
36.070423
81
/dataset/me_dataset.py
0.510163
0.495916
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from genericpath import exists import os from typing import Final import cv2 import sys from matplotlib.pyplot import xcorr from numpy.random import f, sample, shuffle from torch.utils.data import dataset from config import parser if len(sys.argv) > 1: # use shell a...
[ "/main_cls.py", "/preprocess/openface/face_crop_align.py", "/submit.py" ]
guanjz20/MM21_FME_solution
refs/heads/master
import torch import torch.nn as nn import torch.nn.functional as F import numpy as np import glob import os import os.path as osp from torch.serialization import load class MLP(nn.Module): def __init__(self, hidden_units, dropout=0.3): super(MLP, self).__init__() input_feature_dim = hidden_units[...
Python
264
35.21212
79
/model/network.py
0.494351
0.472803
''' generate the emotion intensity of each frame ''' # %% import pdb import os import os.path as osp from numpy.core.numeric import ones, ones_like from numpy.lib.function_base import percentile import pandas as pd import numpy as np import matplotlib.pyplot as plt import params # %% ID2NAME and NAME2ID # CASME_2_P...
[ "/preprocess/casme_2_label_generation.py", "/dataset/me_dataset.py", "/dataset/utils.py" ]
guanjz20/MM21_FME_solution
refs/heads/master
import argparse parser = argparse.ArgumentParser(description="x") parser.add_argument('--store_name', type=str, default="") parser.add_argument('--save_root', type=str, default="") parser.add_argument('--tag', type=str, default="") parser.add_argument('--snap', type=str, default="") parser.add_argument('--dataset', ...
Python
132
39.946968
77
/config.py
0.477336
0.46605
import pandas as pd import numpy as np import os.path as osp dataset = 'CASME_2' # dataset = 'SAMM' submit_name = 'submit_{}.csv'.format(dataset) result_dir_name = 'results' submit_npy_name = 'match_regions_record_all.npy' submit_id = 'done_exp_cls_ca_20210708-215035' def convert_key(k, dataset): if dataset == '...
[ "/submit.py", "/utils.py", "/main_cls.py" ]
guanjz20/MM21_FME_solution
refs/heads/master
# CASME_2 CASME_2_ROOT = '/data/gjz_mm21/CASME_2_LongVideoFaceCropped/CASME_2_longVideoFaceCropped' CASME_2_LABEL_DIR = '/data/gjz_mm21/CASME_2_LongVideoFaceCropped/CASME_2_longVideoFaceCropped/labels' CASME_2_VIDEO_DIR = '/data/gjz_mm21/CASME_2_LongVideoFaceCropped/CASME_2_longVideoFaceCropped/longVideoFaceCropped' #...
Python
11
44.454544
115
/preprocess/params.py
0.786
0.742
import torch import torch.nn as nn import torch.nn.functional as F import numpy as np import glob import os import os.path as osp from torch.serialization import load class MLP(nn.Module): def __init__(self, hidden_units, dropout=0.3): super(MLP, self).__init__() input_feature_dim = hidden_units[...
[ "/model/network.py", "/preprocess/CNN_feature_extraction.py", "/dataset/params.py" ]
guanjz20/MM21_FME_solution
refs/heads/master
import pandas as pd import numpy as np import os.path as osp dataset = 'CASME_2' # dataset = 'SAMM' submit_name = 'submit_{}.csv'.format(dataset) result_dir_name = 'results' submit_npy_name = 'match_regions_record_all.npy' submit_id = 'done_exp_cls_ca_20210708-215035' def convert_key(k, dataset): if dataset == '...
Python
47
29.702127
75
/submit.py
0.544006
0.523216
import time from matplotlib.pyplot import winter import torch import torch.nn.functional as F import numpy as np import utils import dataset.utils as dataset_utils import dataset.params as DATASET_PARAMS def train(dataloader, model, criterion, optimizer, epoch, logger, args, amp_autocast, loss_scaler): ...
[ "/trainer_cls.py", "/preprocess/samm_2_label_generation.py", "/dataset/utils.py" ]
guanjz20/MM21_FME_solution
refs/heads/master
import time from matplotlib.pyplot import winter import torch import torch.nn.functional as F import numpy as np import utils import dataset.utils as dataset_utils import dataset.params as DATASET_PARAMS def train(dataloader, model, criterion, optimizer, epoch, logger, args, amp_autocast, loss_scaler): ...
Python
173
36.410404
78
/trainer_cls.py
0.4983
0.489648
# CASME_2 CASME_2_ROOT = '/data/gjz_mm21/CASME_2_LongVideoFaceCropped/CASME_2_longVideoFaceCropped' CASME_2_LABEL_DIR = '/data/gjz_mm21/CASME_2_LongVideoFaceCropped/CASME_2_longVideoFaceCropped/labels' CASME_2_VIDEO_DIR = '/data/gjz_mm21/CASME_2_LongVideoFaceCropped/CASME_2_longVideoFaceCropped/longVideoFaceCropped' #...
[ "/preprocess/params.py", "/dataset/params.py", "/utils.py" ]
guanjz20/MM21_FME_solution
refs/heads/master
''' generate the emotion intensity of each frame ''' # %% import pdb import os import os.path as osp from numpy.core.numeric import ones, ones_like from numpy.lib.function_base import percentile import pandas as pd import numpy as np import matplotlib.pyplot as plt import params # %% ID2NAME and NAME2ID # CASME_2_P...
Python
150
32.060001
78
/preprocess/casme_2_label_generation.py
0.597096
0.571486
import os import os.path as osp from tqdm import tqdm from glob import glob from video_processor import Video_Processor import params # OpenFace parameters save_size = 224 OpenFace_exe = params.OpenFace_exe quiet = True nomask = True grey = False tracked_vid = False noface_save = False # dataset video_root = params....
[ "/preprocess/openface/face_crop_align.py", "/preprocess/samm_2_label_generation.py", "/utils.py" ]
guanjz20/MM21_FME_solution
refs/heads/master
''' generate the emotion intensity of each frame ''' # %% import os import pdb import os.path as osp from numpy.core.numeric import ones from numpy.lib.function_base import percentile import pandas as pd import numpy as np import matplotlib.pyplot as plt import params # %% main anno_dict = {} # intensity label_dict...
Python
116
30.413794
77
/preprocess/samm_2_label_generation.py
0.580955
0.561197
import os import sys import cv2 from timm.utils import reduce_tensor import torch import shutil import numpy as np import os.path as osp import torch.nn.functional as F import matplotlib.pyplot as plt import torch.distributed as dist from torch.nn.modules import loss from datetime import datetime import paths import d...
[ "/utils.py", "/preprocess/CNN_feature_extraction.py", "/model/utils.py" ]
guanjz20/MM21_FME_solution
refs/heads/master
from __future__ import division from typing import Iterable import cv2 import os import time import six import sys from tqdm import tqdm import argparse import pickle import torch import torch.nn as nn import numpy as np import pandas as pd import torch.utils.data import os.path as osp import torch.backends.cudnn as cu...
Python
341
32.498535
80
/preprocess/CNN_feature_extraction.py
0.591701
0.578044
import time from matplotlib.pyplot import winter import torch import torch.nn.functional as F import numpy as np import utils import dataset.utils as dataset_utils import dataset.params as DATASET_PARAMS def train(dataloader, model, criterion, optimizer, epoch, logger, args, amp_autocast, loss_scaler): ...
[ "/trainer_cls.py", "/preprocess/casme_2_label_generation.py", "/model/utils.py" ]
guanjz20/MM21_FME_solution
refs/heads/master
import os import os.path as osp from tqdm import tqdm from glob import glob from video_processor import Video_Processor import params # OpenFace parameters save_size = 224 OpenFace_exe = params.OpenFace_exe quiet = True nomask = True grey = False tracked_vid = False noface_save = False # dataset video_root = params....
Python
31
26.806452
78
/preprocess/openface/face_crop_align.py
0.667053
0.661253
from __future__ import division from typing import Iterable import cv2 import os import time import six import sys from tqdm import tqdm import argparse import pickle import torch import torch.nn as nn import numpy as np import pandas as pd import torch.utils.data import os.path as osp import torch.backends.cudnn as cu...
[ "/preprocess/CNN_feature_extraction.py", "/submit.py", "/dataset/utils.py" ]
guanjz20/MM21_FME_solution
refs/heads/master
import torch.nn as nn def init_weights(model): for k, m in model.named_modules(): if isinstance(m, nn.Conv3d) or isinstance(m, nn.Conv2d): nn.init.kaiming_normal_(m.weight, mode='fan_out', nonlinearity='relu') #...
Python
18
41.166668
76
/model/utils.py
0.520422
0.509881
import os import sys import cv2 from timm.utils import reduce_tensor import torch import shutil import numpy as np import os.path as osp import torch.nn.functional as F import matplotlib.pyplot as plt import torch.distributed as dist from torch.nn.modules import loss from datetime import datetime import paths import d...
[ "/utils.py", "/dataset/params.py", "/trainer_cls.py" ]
guanjz20/MM21_FME_solution
refs/heads/master
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from genericpath import exists import os from typing import Final import cv2 import sys from matplotlib.pyplot import xcorr from numpy.random import f, sample, shuffle from torch.utils.data import dataset from config import parser if len(sys.argv) > 1: # use shell a...
Python
437
36.016018
107
/main_cls.py
0.542718
0.53499
from __future__ import division from typing import Iterable import cv2 import os import time import six import sys from tqdm import tqdm import argparse import pickle import torch import torch.nn as nn import numpy as np import pandas as pd import torch.utils.data import os.path as osp import torch.backends.cudnn as cu...
[ "/preprocess/CNN_feature_extraction.py", "/paths.py", "/preprocess/openface/face_crop_align.py" ]
guanjz20/MM21_FME_solution
refs/heads/master
from albumentations.augmentations.transforms import GaussNoise import cv2 import os import numpy as np import os.path as osp import albumentations as alb # from torch._C import Ident # from torch.nn.modules.linear import Identity class IsotropicResize(alb.DualTransform): def __init__(self, max_si...
Python
195
30.897436
77
/dataset/utils.py
0.521145
0.509085
SAMM_ROOT = '/data/gjz_mm21/SAMM' CASME_2_LABEL_DIR = '/data/gjz_mm21/CASME_2_LongVideoFaceCropped/CASME_2_longVideoFaceCropped/labels' # kernel path GAUSS_KERNEL_PATH = { 'sm_kernel': '/home/gjz/lry_kernels/gauss2D-smooth.npy', 'dr1_kernel': '/home/gjz/lry_kernels/gauss1D-derivative1.npy', 'dr2_kernel': '...
[ "/dataset/params.py", "/config.py", "/paths.py" ]
gowtham59/fgh
refs/heads/master
f12,f22=input().split() f22=int(f22) for y in range(f22): print(f12)
Python
4
16.75
23
/g.py
0.661972
0.492958
[]
wendeehsu/MangoClassification
refs/heads/master
"""# Load libraries""" import os, shutil import matplotlib.pyplot as plt import numpy as np import random import pandas as pd from keras.applications.inception_v3 import InceptionV3 from keras.layers import Activation, Dense, GlobalAveragePooling2D, Dropout from keras.layers.core import Flatten from keras.models impor...
Python
94
29.223404
97
/train_incept.py
0.679099
0.662913
import os, shutil import random import matplotlib.pyplot as plt import numpy as np from tensorflow.python.keras.models import load_model from tensorflow.python.keras.models import Model from tensorflow.python.keras.preprocessing.image import ImageDataGenerator from sklearn.metrics import classification_report, confusio...
[ "/test.py", "/train.py" ]
wendeehsu/MangoClassification
refs/heads/master
import os, shutil import random import matplotlib.pyplot as plt import numpy as np from tensorflow.python.keras.models import load_model from tensorflow.python.keras.models import Model from tensorflow.python.keras.preprocessing.image import ImageDataGenerator from sklearn.metrics import classification_report, confusio...
Python
54
30.037037
87
/test.py
0.741647
0.729117
"""# Load libraries""" import os, shutil import matplotlib.pyplot as plt import numpy as np import random import pandas as pd from keras.applications.inception_v3 import InceptionV3 from keras.layers import Activation, Dense, GlobalAveragePooling2D, Dropout from keras.layers.core import Flatten from keras.models impor...
[ "/train_incept.py", "/train.py" ]
wendeehsu/MangoClassification
refs/heads/master
"""# Load libraries""" import os, shutil import matplotlib.pyplot as plt import numpy as np import random import pandas as pd from keras.applications.resnet import ResNet152 from keras.layers.core import Dense, Flatten from keras.layers import Activation,Dropout from keras.models import Model from keras.optimizers imp...
Python
99
26.464647
97
/train.py
0.651838
0.632353
import os, shutil import random import matplotlib.pyplot as plt import numpy as np from tensorflow.python.keras.models import load_model from tensorflow.python.keras.models import Model from tensorflow.python.keras.preprocessing.image import ImageDataGenerator from sklearn.metrics import classification_report, confusio...
[ "/test.py", "/train_incept.py" ]