<filename>main.py
import argparse
from model.config import Config
from model.model import DRUGCla
from model.utils import Dataset, positional_encoding
parser = argparse.ArgumentParser()

import os
# Press the green button in the gutter to run the script.
if __name__ == '__main__':
    config = Config(parser)
    gpu_id = config.gpu
    os.environ["CUDA_VISIBLE_DEVICES"] = '%s' % gpu_id

    model = DRUGCla(config)
    model.build()

    # create datasets
    dev = Dataset(config.filename_dev,
                  config.processing_word,
                  config.processing_tag)
    train = Dataset(config.filename_train,
                    config.processing_word,
                    config.processing_tag)
    test = Dataset(config.filename_test,
                   config.processing_word,
                   config.processing_tag)
    train_word_position = positional_encoding(config.word_position_train, position='word')
    train_sentence_position = positional_encoding(config.sentence_position_train, position='sentence')
    dev_word_position = positional_encoding(config.word_position_dev, position='word')
    dev_sentence_position = positional_encoding(config.sentence_position_dev, position='sentence')
    test_word_position = positional_encoding(config.word_position_test, position='word')
    test_sentence_position = positional_encoding(config.sentence_position_test, position='sentence')


    # train model
    model.train(train, dev,
                train_word_position,train_sentence_position,
                dev_word_position,dev_sentence_position)

    # evaluate model
    model.restore_session(config.dir_model)
    model.evaluate(test,test_word_position,test_sentence_position)

<filename>main.py
import argparse
from model.config import Config
from model.model import DRUGCla
from model.utils import Dataset, positional_encoding
parser = argparse.ArgumentParser()

import os
# Press the green button in the gutter to run the script.
if __name__ == '__main__':
    config = Config(parser)
    gpu_id = config.gpu
    os.environ["CUDA_VISIBLE_DEVICES"] = '%s' % gpu_id

    model = DRUGCla(config)
    model.build()

    # create datasets
    dev = Dataset(config.filename_dev,
                  config.processing_word,
                  config.processing_tag)
    train = Dataset(config.filename_train,
                    config.processing_word,
                    config.processing_tag)
    test = Dataset(config.filename_test,
                   config.processing_word,
                   config.processing_tag)
    train_word_position = positional_encoding(config.word_position_train, position='word')
    train_sentence_position = positional_encoding(config.sentence_position_train, position='sentence')
    dev_word_position = positional_encoding(config.word_position_dev, position='word')
    dev_sentence_position = positional_encoding(config.sentence_position_dev, position='sentence')
    test_word_position = positional_encoding(config.word_position_test, position='word')
    test_sentence_position = positional_encoding(config.sentence_position_test, position='sentence')


    # train model
    model.train(train, dev,
                train_word_position,train_sentence_position,
                dev_word_position,dev_sentence_position)

    # evaluate model
    model.restore_session(config.dir_model)
    model.evaluate(test,test_word_position,test_sentence_position)

# Press the green button in the gutter to run the script. # create datasets # train model # evaluate model