repo
stringlengths
2
99
file
stringlengths
13
225
code
stringlengths
0
18.3M
file_length
int64
0
18.3M
avg_line_length
float64
0
1.36M
max_line_length
int64
0
4.26M
extension_type
stringclasses
1 value
MedCATtrainer
MedCATtrainer-master/webapp/api/api/migrations/0061_project_annotation_guideline_link.py
# Generated by Django 2.2.24 on 2021-11-02 17:09 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('api', '0060_auto_20211022_0940'), ] operations = [ migrations.AddField( model_name='project', name='annotation_guid...
671
34.368421
320
py
MedCATtrainer
MedCATtrainer-master/webapp/api/api/migrations/0020_projectannotateentities_train_model_on_submit.py
# Generated by Django 2.2.9 on 2020-01-08 11:09 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('api', '0019_annotatedentity_correct'), ] operations = [ migrations.AddField( model_name='projectannotateentities', n...
419
21.105263
52
py
MedCATtrainer
MedCATtrainer-master/webapp/api/api/migrations/0013_auto_20191001_2248.py
# Generated by Django 2.2.5 on 2019-10-01 22:48 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('api', '0012_conceptdb_use_for_training'), ] operations = [ migrations.AlterField( model_name='projectannotateentities', ...
455
23
87
py
MedCATtrainer
MedCATtrainer-master/webapp/api/api/migrations/0002_auto_20190923_2342.py
# Generated by Django 2.2.5 on 2019-09-23 23:42 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('api', '0001_initial'), ] operations = [ migrations.AlterField( model_name='annotatedentity', name='correct', ...
897
25.411765
53
py
MedCATtrainer
MedCATtrainer-master/webapp/api/api/migrations/0038_auto_20200407_1418.py
# Generated by Django 2.2.11 on 2020-04-07 14:18 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('api', '0037_auto_20200320_0107'), ] operations = [ migrations.AlterField( model_name='concept', name='cui', ...
382
19.157895
51
py
MedCATtrainer
MedCATtrainer-master/webapp/api/api/migrations/0040_projectannotateentities_restrict_concept_lookup.py
# Generated by Django 2.2.12 on 2020-04-16 19:47 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('api', '0039_project_cuis_file'), ] operations = [ migrations.AddField( model_name='projectannotateentities', name='...
417
21
53
py
MedCATtrainer
MedCATtrainer-master/webapp/api/api/migrations/0024_auto_20200131_2339.py
# Generated by Django 2.2.9 on 2020-01-31 23:39 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('api', '0023_concept_opcs4'), ] operations = [ migrations.CreateModel( name='ICDCode', fields=[ ('id'...
1,560
31.520833
114
py
MedCATtrainer
MedCATtrainer-master/webapp/api/api/migrations/0017_delete_link.py
# Generated by Django 2.2.3 on 2019-10-02 23:28 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('api', '0016_auto_20191002_2306'), ] operations = [ migrations.DeleteModel( name='Link', ), ]
289
16.058824
47
py
MedCATtrainer
MedCATtrainer-master/webapp/api/api/migrations/0041_auto_20200519_1544.py
# Generated by Django 2.2.12 on 2020-05-19 15:44 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('api', '0040_projectannotateentities_restrict_concept_lookup'), ] operations = [ migrations.AlterField( model_name='project', ...
538
27.368421
172
py
MedCATtrainer
MedCATtrainer-master/webapp/api/api/migrations/0014_conceptdb_name.py
# Generated by Django 2.2.3 on 2019-10-02 16:09 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('api', '0013_auto_20191001_2248'), ] operations = [ migrations.AddField( model_name='conceptdb', name='name', ...
406
20.421053
75
py
MedCATtrainer
MedCATtrainer-master/webapp/api/api/migrations/0067_delete_concept.py
# Generated by Django 2.2.28 on 2023-01-24 12:03 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('api', '0066_exportedproject'), ] operations = [ migrations.DeleteModel( name='Concept', ), ]
290
16.117647
48
py
MedCATtrainer
MedCATtrainer-master/webapp/api/api/migrations/0001_initial.py
# Generated by Django 2.2.3 on 2019-09-22 15:49 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ('contenttypes', '0002_remove_content_type_name'), migrations.swa...
9,743
47.964824
205
py
MedCATtrainer
MedCATtrainer-master/webapp/api/api/migrations/0003_auto_20190924_1934.py
# Generated by Django 2.2.3 on 2019-09-24 19:34 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('api', '0002_auto_20190923_2342'), ] operations = [ migrations.RemoveField( model_name='annotatedentity', name='corre...
506
21.043478
53
py
MedCATtrainer
MedCATtrainer-master/webapp/api/api/migrations/0006_concept_icd10.py
# Generated by Django 2.2.5 on 2019-09-26 23:50 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('api', '0005_annotatedentity_alternative'), ] operations = [ migrations.AddField( model_name='concept', name='icd10',...
398
20
59
py
MedCATtrainer
MedCATtrainer-master/webapp/api/api/migrations/0021_auto_20200124_1108.py
# Generated by Django 2.2.9 on 2020-01-24 11:08 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('api', '0020_projectannotateentities_train_model_on_submit'), ] operations = [ migrations.AlterField( model_name='projectannotate...
447
22.578947
70
py
MedCATtrainer
MedCATtrainer-master/webapp/api/api/migrations/0029_auto_20200208_1609.py
# Generated by Django 2.2.9 on 2020-02-08 16:09 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('api', '0028_auto_20200208_1559'), ] operations = [ migrations.RemoveField( model_name='annotate...
961
28.151515
124
py
MedCATtrainer
MedCATtrainer-master/webapp/api/api/migrations/0056_auto_20210417_0926.py
# Generated by Django 2.2.9 on 2021-04-17 09:26 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('api', '0055_auto_20210417_0902'), ] operations = [ migrations.AlterField( model_name='projectannotateentities', name...
560
28.526316
194
py
MedCATtrainer
MedCATtrainer-master/webapp/api/api/migrations/0027_auto_20200208_1443.py
# Generated by Django 2.2.9 on 2020-02-08 14:43 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('api', '0026_auto_20200204_1517'), ] operations = [ migrations.AddField( model_name='annotateden...
1,002
29.393939
124
py
MedCATtrainer
MedCATtrainer-master/webapp/api/api/migrations/0011_projectannotateentities_cdb_search_filter.py
# Generated by Django 2.2.3 on 2019-09-29 17:44 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('api', '0010_annotatedentity_last_modified'), ] operations = [ migrations.AddField( model_name='projectannotateentities', ...
453
22.894737
84
py
MedCATtrainer
MedCATtrainer-master/webapp/api/api/migrations/0046_auto_20200802_1006.py
# Generated by Django 2.2.12 on 2020-08-02 10:06 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('api', '0045_auto_20200603_0934'), ] operations = [ migrations.AlterField( model_name='projectannotateentities', nam...
1,298
37.205882
182
py
MedCATtrainer
MedCATtrainer-master/webapp/api/api/migrations/__init__.py
0
0
0
py
MedCATtrainer
MedCATtrainer-master/webapp/api/api/migrations/0007_concept_cdb.py
# Generated by Django 2.2.3 on 2019-09-27 22:43 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('api', '0006_concept_icd10'), ] operations = [ migrations.AddField( model_name='concept', ...
481
23.1
125
py
MedCATtrainer
MedCATtrainer-master/webapp/api/api/migrations/0034_auto_20200212_0022.py
# Generated by Django 2.2.9 on 2020-02-12 00:22 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('api', '0033_auto_20200212_0021'), ] operations = [ migrations.AlterField( model_name='annotatedentity', name='create...
404
20.315789
58
py
MedCATtrainer
MedCATtrainer-master/webapp/api/api/migrations/0016_auto_20191002_2306.py
# Generated by Django 2.2.3 on 2019-10-02 23:06 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('api', '0015_auto_20191002_1615'), ] operations = [ migrations.RemoveField( model_name='projecta...
1,104
31.5
118
py
MedCATtrainer
MedCATtrainer-master/webapp/api/api/migrations/0048_projectcuicounter.py
# Generated by Django 2.0 on 2021-01-13 03:54 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('api', '0047_auto_20210112_0355'), ] operations = [ migrations.CreateModel( name='ProjectCuiCounte...
762
30.791667
114
py
MedCATtrainer
MedCATtrainer-master/webapp/api/api/migrations/0047_auto_20210112_0355.py
# Generated by Django 2.0 on 2021-01-12 03:55 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('api', '0046_auto_20200802_1006'), ] operations = [ migrations.AlterField( model_name='concept', name='cui', ...
569
22.75
66
py
MedCATtrainer
MedCATtrainer-master/webapp/api/api/migrations/0055_auto_20210417_0902.py
# Generated by Django 2.2.9 on 2021-04-17 09:02 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('api', '0054_remove_concept_vocab'), ] operations = [ migrations.AlterField( model_name='concept', name='cui', ...
411
20.684211
79
py
MedCATtrainer
MedCATtrainer-master/webapp/api/api/migrations/0065_auto_20221129_1102.py
# Generated by Django 2.2.28 on 2022-11-29 11:02 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('api', '0064_auto_20220606_1253'), ] operations = [ migrations.AlterField( model_name='projectannotateentities', nam...
609
31.105263
248
py
MedCATtrainer
MedCATtrainer-master/webapp/api/api/migrations/0049_auto_20210202_1539.py
# Generated by Django 2.0 on 2021-02-02 15:39 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('api', '0048_projectcuicounter'), ] operations = [ migrations.AddField( model_name='annotatedentity', name='irrelevant'...
639
25.666667
114
py
MedCATtrainer
MedCATtrainer-master/webapp/api/api/migrations/0044_projectannotateentities_terminate_available.py
# Generated by Django 2.2.12 on 2020-06-03 08:50 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('api', '0043_auto_20200520_1018'), ] operations = [ migrations.AddField( model_name='projectannotateentities', name=...
468
23.684211
107
py
MedCATtrainer
MedCATtrainer-master/webapp/api/api/migrations/0069_auto_20230711_0938.py
# Generated by Django 2.2.28 on 2023-07-11 09:38 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('api', '0068_auto_20230203_1715'), ] operations = [ migrations.AddField( model_name='project', name='annotation_clas...
1,097
36.862069
207
py
MedCATtrainer
MedCATtrainer-master/webapp/api/api/migrations/0066_exportedproject.py
# Generated by Django 2.2.28 on 2023-01-05 18:04 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('api', '0065_auto_20221129_1102'), ] operations = [ migrations.CreateModel( name='ExportedProject', fields=[ ...
591
27.190476
130
py
MedCATtrainer
MedCATtrainer-master/webapp/api/api/migrations/0025_auto_20200131_2353.py
# Generated by Django 2.2.9 on 2020-01-31 23:53 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('api', '0024_auto_20200131_2339'), ] operations = [ migrations.AddField( model_name='icdcode', ...
711
27.48
125
py
MedCATtrainer
MedCATtrainer-master/webapp/api/api/migrations/0037_auto_20200320_0107.py
# Generated by Django 2.2.11 on 2020-03-20 01:07 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('api', '0036_auto_20200320_0105'), ] operations = [ migrations.AlterField( model_name='projecta...
526
25.35
139
py
MedCATtrainer
MedCATtrainer-master/webapp/api/api/migrations/0015_auto_20191002_1615.py
# Generated by Django 2.2.3 on 2019-10-02 16:15 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('api', '0014_conceptdb_name'), ] operations = [ migrations.AddField( model_name='projectannotateentities', name='task...
750
24.896552
86
py
MedCATtrainer
MedCATtrainer-master/docs/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...
2,184
31.132353
79
py
DESIGNER
DESIGNER-master/designer/__init__.py
1
0
0
py
DESIGNER
DESIGNER-master/utils/mpdenoise.py
"""A Python class containing an implimentation of MPPCA denoising. Inputs are a 4D image with dimentions (X x Y x Z x N) Usage: import mpdenoise as mp imgdn, sigma, nparameters = mp.denoise(img, kernel=[7,7,7], M=60, shrinkage='frobenius') LICENCE Authors: Benjamin Ades-Aron (...
12,009
35.953846
127
py
DESIGNER
DESIGNER-master/utils/__init__.py
from utils import mpdenoise
28
13.5
27
py
DESIGNER
DESIGNER-master/utils/mpdenoise_sj.py
"""A Python class containing an implimentation of MPPCA denoising. Inputs are a 4D image with dimentions (X x Y x Z x N) Usage: import mpdenoise as mp imgdn, sigma, nparameters = mp.denoise(img, kernel=[7,7,7], M=60, shrinkage='frobenius') LICENCE Authors: Benjamin Ades-Aron (...
13,772
35.630319
127
py
RDPD
RDPD-master/main.py
# -*- coding: utf-8 -*- """ """ import os import dill import numpy as np from util import read_pamap, read_ptbdb, read_mimic_diag, my_eval from config import * from time import gmtime, strftime from model import BaseCRNN import torch.optim as optim import torch.nn.functional as F import torch from torch.autograd impo...
13,490
37.65616
148
py
RDPD
RDPD-master/model.py
# -*- coding: utf-8 -*- """ """ import dill import numpy as np import torch import torch.nn as nn import torch.nn.functional as F class BaseCRNN(nn.Module): def __init__(self, config): super(BaseCRNN, self).__init__() self.config = config self.len_data = config['l...
6,785
32.264706
83
py
RDPD
RDPD-master/config.py
# -------------------------------- MIMIC diag -------------------------------- # teacher model config_mimic_diag_teacher = { 'model_type': 'teacher', 'is_debug': False, 'batch_size': 128, 'len_data': 48, 'len_split': 12, 'n_channel': 6, 'n_class': 8, 'temperature': 5, ...
3,028
16.508671
78
py
RDPD
RDPD-master/util.py
# -*- coding: utf-8 -*- """ """ import dill import numpy as np from scipy import interpolate import copy from collections import Counter from sklearn.model_selection import train_test_split from sklearn.metrics import accuracy_score, roc_auc_score, average_precision_score, f1_score, confusion_matrix ## ------------...
6,420
33.154255
141
py
mixture-of-diffusers
mixture-of-diffusers-master/setup.py
import os from setuptools import setup # Read long description from readme with open("README.md", "r", encoding="utf-8") as fh: LONG_DESCRIPTION = fh.read() # Get tag from Github environment variables TAG = os.environ['GITHUB_TAG'] if 'GITHUB_TAG' in os.environ else "0.0.0" setup( name="mixdiff", vers...
1,542
29.86
100
py
mixture-of-diffusers
mixture-of-diffusers-master/generate_grid_from_json.py
import argparse import datetime from diffusers import LMSDiscreteScheduler, DDIMScheduler import json from pathlib import Path import torch from mixdiff.tiling import StableDiffusionTilingPipeline def generate_grid(generation_arguments): model_id = "CompVis/stable-diffusion-v1-4" # Prepared scheduler if g...
2,454
49.102041
145
py
mixture-of-diffusers
mixture-of-diffusers-master/generate_grid.py
from copy import deepcopy import datetime from diffusers import LMSDiscreteScheduler, DDIMScheduler import git import json import numpy as np from pathlib import Path from mixdiff import StableDiffusionTilingPipeline ### CONFIG START n = 3 sche = "lms" gc = 8 seed = None steps = 50 suffix = "elegant, highly detailed...
4,200
33.719008
130
py
mixture-of-diffusers
mixture-of-diffusers-master/mixdiff/canvas.py
from copy import deepcopy from dataclasses import asdict, dataclass from enum import Enum import numpy as np from numpy import pi, exp, sqrt import re import torch from torchvision.transforms.functional import resize from tqdm.auto import tqdm from transformers import CLIPFeatureExtractor, CLIPTextModel, CLIPTokenizer ...
20,181
49.836272
224
py
mixture-of-diffusers
mixture-of-diffusers-master/mixdiff/extrasmixin.py
from copy import deepcopy # TODO: remove after adaptaing tiling to use canvas class StableDiffusionExtrasMixin: """Mixin providing additional convenience method to Stable Diffusion pipelines""" def decode_latents(self, latents, cpu_vae=False): """Decodes a given array of latents into pixel space""" ...
760
30.708333
85
py
mixture-of-diffusers
mixture-of-diffusers-master/mixdiff/tiling.py
from enum import Enum import inspect from ligo.segments import segment from typing import List, Optional, Tuple, Union import torch from tqdm.auto import tqdm from transformers import CLIPFeatureExtractor, CLIPTextModel, CLIPTokenizer from diffusers.models import AutoencoderKL, UNet2DConditionModel from diffusers.pi...
15,330
52.232639
218
py
mixture-of-diffusers
mixture-of-diffusers-master/mixdiff/imgtools.py
import numpy as np import torch from PIL import Image, ImageFilter def preprocess_image(image): """Preprocess an input image Same as https://github.com/huggingface/diffusers/blob/1138d63b519e37f0ce04e027b9f4a3261d27c628/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_img2img.py#L44 ...
1,458
39.527778
180
py
mixture-of-diffusers
mixture-of-diffusers-master/mixdiff/__init__.py
from .canvas import Image2ImageRegion, RerollRegion, StableDiffusionCanvasPipeline, Text2ImageRegion from .imgtools import preprocess_image from .tiling import StableDiffusionTilingPipeline
189
62.333333
100
py
mixture-of-diffusers
mixture-of-diffusers-master/tests/canvas_test.py
from diffusers import LMSDiscreteScheduler from PIL import Image import pytest from mixdiff import Image2ImageRegion, StableDiffusionCanvasPipeline, Text2ImageRegion, preprocess_image from mixdiff.canvas import CanvasRegion ### CanvasRegion tests @pytest.mark.parametrize("region_params", [ {"row_init": 0, "row_e...
7,259
50.126761
191
py
mixture-of-diffusers
mixture-of-diffusers-master/tests/__init__.py
0
0
0
py
ACME
ACME-master/test.py
import os import time import random import numpy as np import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data import torchvision.transforms as transforms import torchvision.datasets as datasets import torchvision.models as models import torch.backends.cudnn as cudnn from ...
5,828
28.145
119
py
ACME
ACME-master/args.py
import argparse def get_parser(): parser = argparse.ArgumentParser(description='tri-joint parameters') # general parser.add_argument('--seed', default=1234, type=int) parser.add_argument('--device', default=[0], type=list) # data parser.add_argument('--img_path', default='../im2recipe-Pytorch...
2,906
47.45
119
py
ACME
ACME-master/data_loader.py
from __future__ import print_function import torch.utils.data as data from PIL import Image import os import sys import pickle import numpy as np import lmdb import torch import pdb import torchvision.transforms as transforms import nltk from build_vocab import Vocabulary from args import get_parser parser = get_pars...
6,119
35
115
py
ACME
ACME-master/triplet_loss.py
from __future__ import print_function import torch from torch import nn from torch.autograd import Variable class TripletLoss(object): """Modified from Tong Xiao's open-reid (https://github.com/Cysu/open-reid). Related Triplet Loss theory can be found in paper 'In Defense of the Triplet Loss for Person Re-Iden...
3,225
30.940594
79
py
ACME
ACME-master/models.py
import torch import torch.nn as nn import torch.nn.parallel import torch.legacy as legacy import torch.optim import torch.utils.data import torchvision.transforms as transforms import torchvision.datasets as datasets import torchvision.models as models import torchwordemb from args import get_parser import pdb import t...
21,061
34.698305
121
py
ACME
ACME-master/train.py
import os import time import random import numpy as np import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data import torchvision.transforms as transforms import torchvision.datasets as datasets import torchvision.models as models import torch.backends.cudnn as cudnn from ...
16,687
34.430998
120
py
ACME
ACME-master/build_vocab.py
import nltk import pickle import argparse from collections import Counter class Vocabulary(object): """Simple vocabulary wrapper.""" def __init__(self): self.word2idx = {} self.idx2word = {} self.idx = 0 def add_word(self, word): if not word in self.word2idx: s...
2,783
31.752941
89
py
czsl
czsl-main/test.py
# Torch imports import torch from torch.utils.tensorboard import SummaryWriter import torch.backends.cudnn as cudnn import numpy as np from flags import DATA_FOLDER cudnn.benchmark = True # Python imports import tqdm from tqdm import tqdm import os from os.path import join as ospj # Local imports from data import d...
6,227
32.12766
120
py
czsl
czsl-main/flags.py
import argparse DATA_FOLDER = "ROOT_FOLDER" parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument('--config', default='configs/args.yml', help='path of the config file (training only)') parser.add_argument('--dataset', default='mitstates', help='mitstates|zappos'...
6,928
77.738636
148
py
czsl
czsl-main/train.py
# Torch imports import torch import torch.nn as nn import torch.nn.functional as F from torch.utils.tensorboard import SummaryWriter import torch.backends.cudnn as cudnn cudnn.benchmark = True # Python imports import tqdm from tqdm import tqdm import os from os.path import join as ospj import csv #Local imports from...
7,551
31.13617
120
py
czsl
czsl-main/models/svm.py
import numpy as np import tqdm from data import dataset as dset import os from utils import utils import torch from torch.autograd import Variable import h5py from sklearn.svm import LinearSVC from sklearn.model_selection import GridSearchCV import torch.nn.functional as F from joblib import Parallel, delayed import gl...
9,922
40.345833
154
py
czsl
czsl-main/models/visual_product.py
import torch import torch.nn as nn import torch.nn.functional as F import torchvision.models as models import numpy as np from .common import MLP class VisualProductNN(nn.Module): def __init__(self, dset, args): super(VisualProductNN, self).__init__() self.attr_clf = MLP(dset.feat_dim, len(dset.att...
1,457
29.375
78
py
czsl
czsl-main/models/symnet.py
import torch import torch.nn as nn import torch.nn.functional as F import numpy as np from .word_embedding import load_word_embeddings from .common import MLP device = 'cuda' if torch.cuda.is_available() else 'cpu' class Symnet(nn.Module): def __init__(self, dset, args): super(Symnet, self).__init__() ...
9,135
41.691589
188
py
czsl
czsl-main/models/manifold_methods.py
import torch import torch.nn as nn import torch.nn.functional as F import numpy as np from .word_embedding import load_word_embeddings from .common import MLP, Reshape from flags import DATA_FOLDER device = 'cuda' if torch.cuda.is_available() else 'cpu' class ManifoldModel(nn.Module): def __init__(self, dset, ar...
15,296
40.681199
118
py
czsl
czsl-main/models/common.py
import torch import torch.nn as nn import torch.nn.functional as F import numpy as np import copy from scipy.stats import hmean device = 'cuda' if torch.cuda.is_available() else 'cpu' class MLP(nn.Module): ''' Baseclass to create a simple MLP Inputs inp_dim: Int, Input dimension out-dim: I...
20,689
39.174757
144
py
czsl
czsl-main/models/gcn.py
import numpy as np import scipy.sparse as sp import math import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.init import xavier_uniform_ device = 'cuda' if torch.cuda.is_available() else 'cpu' def normt_spm(mx, method='in'): if method == 'in': mx = mx.transpose() rows...
5,869
27.634146
122
py
czsl
czsl-main/models/word_embedding.py
import torch import numpy as np from flags import DATA_FOLDER def load_word_embeddings(emb_type, vocab): if emb_type == 'glove': embeds = load_glove_embeddings(vocab) elif emb_type == 'fasttext': embeds = load_fasttext_embeddings(vocab) elif emb_type == 'word2vec': embeds = load_word...
6,636
35.26776
90
py
czsl
czsl-main/models/__init__.py
0
0
0
py
czsl
czsl-main/models/modular_methods.py
# Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # import torch import torch.nn as nn import torch.nn.functional as F import torchvision.models as tmodels import numpy as np...
23,151
34.454824
90
py
czsl
czsl-main/models/compcos.py
import torch import torch.nn as nn import torch.nn.functional as F from .word_embedding import load_word_embeddings from .common import MLP from itertools import product device = 'cuda' if torch.cuda.is_available() else 'cpu' def compute_cosine_similarity(names, weights, return_dict=True): pairing_names = list(p...
10,133
36.533333
111
py
czsl
czsl-main/models/graph_method.py
import torch import torch.nn as nn import torch.nn.functional as F import numpy as np from .common import MLP from .gcn import GCN, GCNII from .word_embedding import load_word_embeddings import scipy.sparse as sp def adj_to_edges(adj): # Adj sparse matrix to list of edges rows, cols = np.nonzero(adj) edge...
7,321
33.701422
151
py
czsl
czsl-main/models/image_extractor.py
import torch import torch.nn as nn import torch.nn.functional as F from torchvision import models from torchvision.models.resnet import ResNet, BasicBlock class ResNet18_conv(ResNet): def __init__(self): super(ResNet18_conv, self).__init__(BasicBlock, [2, 2, 2, 2]) def forward(self, x): ...
2,428
29.3625
99
py
czsl
czsl-main/utils/reorganize_utzap.py
# Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # """ Reorganize the UT-Zappos dataset to resemble the MIT-States dataset root/attr_obj/img1.jpg root/attr_obj/img2.jpg root...
835
25.125
73
py
czsl
czsl-main/utils/config_model.py
import torch import torch.optim as optim from models.image_extractor import get_image_extractor from models.visual_product import VisualProductNN from models.manifold_methods import RedWine, LabelEmbedPlus, AttributeOperator from models.modular_methods import GatedGeneralNN from models.graph_method import GraphFull fr...
3,177
37.289157
123
py
czsl
czsl-main/utils/utils.py
import os from os.path import join as ospj import torch import random import copy import shutil import sys import yaml def chunks(l, n): """Yield successive n-sized chunks from l.""" for i in range(0, len(l), n): yield l[i:i + n] def get_norm_values(norm_family = 'imagenet'): ''' Inputs ...
1,943
28.454545
111
py
czsl
czsl-main/utils/download_embeddings.py
import fasttext.util fasttext.util.download_model('en', if_exists='ignore') # English
88
21.25
65
py
czsl
czsl-main/utils/__init__.py
0
0
0
py
czsl
czsl-main/data/dataset.py
#external libs import numpy as np from tqdm import tqdm from PIL import Image import os import random from os.path import join as ospj from glob import glob #torch libs from torch.utils.data import Dataset import torch import torchvision.transforms as transforms #local libs from utils.utils import get_norm_values, chu...
15,653
34.336343
106
py
czsl
czsl-main/data/__init__.py
0
0
0
py
trimmed_match
trimmed_match-master/setup.py
# Copyright 2020 Google LLC. # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
3,671
30.930435
80
py
trimmed_match
trimmed_match-master/trimmed_match/__init__.py
# Copyright 2020 Google LLC. # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
655
42.733333
78
py
trimmed_match
trimmed_match-master/trimmed_match/estimator.py
# Copyright 2020 Google LLC. # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
8,227
35.087719
80
py
trimmed_match
trimmed_match-master/trimmed_match/estimator_test.py
# Copyright 2020 Google LLC. # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
7,143
37.203209
80
py
trimmed_match
trimmed_match-master/trimmed_match/core/python/__init__.py
# Copyright 2020 Google LLC. # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
656
40.0625
78
py
trimmed_match
trimmed_match-master/trimmed_match/example_datasets/simulation_script.py
# Copyright 2020 Google LLC. # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
5,230
37.463235
78
py
trimmed_match
trimmed_match-master/trimmed_match/post_analysis/trimmed_match_post_analysis.py
# Copyright 2020 Google LLC. # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
11,374
40.213768
80
py
trimmed_match
trimmed_match-master/trimmed_match/post_analysis/__init__.py
# Copyright 2020 Google LLC. # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
655
42.733333
78
py
trimmed_match
trimmed_match-master/trimmed_match/post_analysis/tests/trimmed_match_post_analysis_test.py
# Copyright 2020 Google LLC. # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
19,993
40.224742
96
py
trimmed_match
trimmed_match-master/trimmed_match/design/common_classes.py
# Copyright 2020 Google LLC. # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
5,774
32.381503
79
py
trimmed_match
trimmed_match-master/trimmed_match/design/matched_pairs_rmse.py
# Copyright 2020 Google LLC. # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
12,519
41.730375
80
py
trimmed_match
trimmed_match-master/trimmed_match/design/geo_level_estimators.py
# Copyright 2020 Google LLC. # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
5,706
35.120253
80
py
trimmed_match
trimmed_match-master/trimmed_match/design/plot_utilities.py
# Copyright 2020 Google LLC. # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
10,612
34.976271
103
py
trimmed_match
trimmed_match-master/trimmed_match/design/trimmed_match_design.py
# Copyright 2020 Google LLC. # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
24,543
38.908943
80
py
trimmed_match
trimmed_match-master/trimmed_match/design/util.py
# Copyright 2020 Google LLC. # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
24,073
36.498442
83
py
trimmed_match
trimmed_match-master/trimmed_match/design/geo_assignment.py
# Copyright 2020 Google LLC. # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
11,825
35.726708
80
py
trimmed_match
trimmed_match-master/trimmed_match/design/__init__.py
# Copyright 2020 Google LLC. # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
656
40.0625
78
py