示例#1
0
import torch
from hatemtl.features.preprocessing import preprocess as pp

import torch


def model_exists(mname):
    if not os.path.exists("models"):
        os.mkdir("models")
    return os.path.exists(os.path.join("models", "{0}.model".format(mname)))


if __name__ == "__main__":
    SimpleRandom.set_seeds()
    mname = "expt4" + ("emb" if is_embedding_model() else
                       "") + ("large" if is_large_model() else "")

    sexism_file_tr = os.path.join("data", "waseem_s.tr.json")
    racism_file_tr = os.path.join("data", "waseem_r.tr.json")
    neither_file_tr = os.path.join("data", "waseem_n.tr.json")
    waseem_hovy_tr = os.path.join("data", "amateur_expert.tr.json")

    sexism_file_dv = os.path.join("data", "waseem_s.dv.json")
    racism_file_dv = os.path.join("data", "waseem_r.dv.json")
    neither_file_dv = os.path.join("data", "waseem_n.dv.json")
    waseem_hovy_dv = os.path.join("data", "amateur_expert.dv.json")

    csvreader = CSVReader(encoding="ISO-8859-1")
    jlr = JSONLineReader()
    formatter = TextAnnotationFormatter(WaseemLabelSchema(), preprocessing=pp)
    formatter2 = TextAnnotationFormatter(WaseemHovyLabelSchema(),
示例#2
0
from torch import nn, autograd

import torch
from hatemtl.features.preprocessing import preprocess as pp


def model_exists(mname):
    if not os.path.exists("models"):
        os.mkdir("models")
    return os.path.exists(os.path.join("models","{0}.model".format(mname)))

if __name__ == "__main__":

    SimpleRandom.set_seeds()
    mname = "expt6" + ("emb" if is_embedding_model() else "") + ("large" if is_large_model() else "")

    sexism_file_tr = os.path.join("data","waseem_s.tr.json")
    racism_file_tr = os.path.join("data","waseem_r.tr.json")
    neither_file_tr = os.path.join("data","waseem_n.tr.json")
    waseem_hovy_tr = os.path.join("data","amateur_expert.tr.json")

    sexism_file_de = os.path.join("data","waseem_s.dv.json")
    racism_file_de = os.path.join("data","waseem_r.dv.json")
    neither_file_de = os.path.join("data","waseem_n.dv.json")
    waseem_hovy_de = os.path.join("data","amateur_expert.dv.json")


    sexism_file_te = os.path.join("data","waseem_s.te.json")
    racism_file_te = os.path.join("data","waseem_r.te.json")
    neither_file_te = os.path.join("data","waseem_n.te.json")