Esempio n. 1
0
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

from examples.entity_linking.config.config import project_dir, PATH
import os
import sys

sys.path.append(project_dir)
os.chdir(sys.path[-1])

import random

from examples.entity_linking.lib.lib_tools import seed_everything

seed_everything(seed=42)

import paddlepalm as palm
import json
import os
import shutil

if __name__ == '__main__':
    # configs
    max_seqlen = 512
    batch_size = 16
    lr = 2e-5
    num_classes = 24
    random_seed = 1
    print_steps = 100
    task_name = 'Quora Question Pairs matching'
Esempio n. 2
0
# -*- coding:utf-8 -*-
import os
from examples.entity_linking.lib import lib_tools

lib_tools.seed_everything()

project_dir = '/'.join(os.path.abspath(__file__).split('/')[:-4])

import pandas as pd


class PATH(object):
    DATA_DIR = os.path.join(project_dir, 'examples', 'entity_linking', 'data')

    # -*- input -*-
    INPUT_DIR = os.path.join(DATA_DIR, 'input')
    OUTPUT_DIR = os.path.join(DATA_DIR, 'output')
    MODEL_DIR = os.path.join(DATA_DIR, 'model')
    SUBMIT_DIR = os.path.join(DATA_DIR, 'submit')

    # -*- pretrain model -*-
    MODEL_ERNIE_PYTORCH = os.path.join(MODEL_DIR, 'model')

    # -*--*- 初赛 -*--*-
    input_train_json_path = os.path.join(INPUT_DIR, 'train.json')
    input_test_json_path = os.path.join(INPUT_DIR, 'test.json')
    input_dev_json_path = os.path.join(INPUT_DIR, 'dev.json')
    input_kb_json_path = os.path.join(INPUT_DIR, 'kb.json')

    # -*- output -*-
    OUTPUT_ENTITY_LINK_DIR = os.path.join(OUTPUT_DIR, 'entity_link')