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 random | |
import itertools | |
import os | |
import shutil | |
import tempfile | |
import argparse | |
import numpy as np | |
import torch | |
from tqdm import trange |
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 pandas as pd | |
from easynmt import EasyNMT | |
#read csv | |
split_0 = pd.read_csv("/content/drive/MyDrive/datasets/Image-Captioning-ACL/splits_0") | |
#turn that into list | |
split_0_captions = split_0['caption'].tolist() | |
#load the mbart50 english to many model | |
model = EasyNMT('mbart50_en2m') |
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 time | |
import json | |
import multiprocessing | |
from multiprocessing import Pool | |
txt_path = "tamil_dataset.txt" | |
json_path = "tamil_final_dataset.json" | |
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 re | |
import wandb | |
from datasets import load_dataset, concatenate_datasets | |
from functools import partial | |
import logging | |
logger = logging.getLogger(__name__) | |
def load_hf_format_dataset(file_path,split): |
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
from waitress import serve | |
import io | |
from flask import Flask, request,jsonify | |
from PIL import Image | |
import base64 | |
from spacymodels.activeorpassive.model import find_passive_or_active | |
import spacy | |
import pandas as pd | |
import torch | |
import numpy as np |
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
for i, data in enumerate(test_dataloader, 0): | |
x0, x1 = data | |
concat = torch.cat((x0, x1), 0) | |
output1, output2 = model(x0.to(device), x1.to(device)) | |
eucledian_distance = F.pairwise_distance(output1, output2) | |
if label == torch.FloatTensor([[0]]): | |
label = "Original Pair Of Signature" | |
else: | |
label = "Forged Pair Of Signature" |
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 convert_annot_to_yolov5(x_min, y_min, x_max, y_max, img): | |
""" | |
Convert annotations into required yolov5 formamt | |
x_center, y_center, width, height | |
""" | |
w = x_max - x_min | |
h = y_max - y_min | |
imgheight,imgwidth = img.shape[0], img.shape[1] | |
#x,y,w,h = a['hbox'] //for each tag in gtboxes object | |
""" |
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
[verbose]: Creating arXiv submission AutoTeX object | |
[verbose]: *** Using TeX Live 2020 *** | |
[verbose]: Calling arXiv submission AutoTeX process | |
[verbose]: TeX/AutoTeX.pm: admin_timeout = minion | |
[verbose]: <Copyright-logo.txt> is of type 'unknown'. | |
[verbose]: <Copyright-lppl.txt> is of type 'unknown'. | |
[verbose]: <Copyright.txt> is of type 'unknown'. | |
[verbose]: <Makefile> is of type 'unknown'. | |
[verbose]: <README.md> is of type 'unknown'. |
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 transformers import AutoTokenizer | |
import torch | |
import numpy as np | |
from collections import Counter | |
import pandas as pd | |
import numpy as np | |
import torch | |
import torch.nn as nn | |
import torch.nn.functional as F |
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 numpy as np | |
from transformers import AutoConfig, AutoModelWithHeads | |
from transformers import TrainingArguments, Trainer, EvalPrediction | |
config = AutoConfig.from_pretrained( | |
"distilbert-base-uncased", | |
num_labels=2, | |
) | |
model = AutoModelWithHeads.from_pretrained( |
NewerOlder