python3 download_model_from_HG.py
if __name__ == '__main__':
task = 'ner'
# modify the name of the task and the weights will be saved under the ./pretrained folder
CONFIG_FILE = 'model_{}.csv'.format(task)
model = HFModel(task, CONFIG_FILE)
# # download model files
model.download_model()
Evaluate the performance in terms of accuracy, f1 score, precision, recall;
Evaluate the performance in terms of efficiency, i.e., execution speed per instance
python3 inference.py
if __name__ == '__main__':
task = 'ner' #'sentiment' #'ner' #'pos'
purpose = 'experiment' # 'experiment' 'evaluate'
# evaluate: evaluate all the models on its origin dataset
# experiment: evaluate the models on dedicated dataset with groundtruth being retrieved
dataset_name = 'tweet_eval' #'tweet_eval'#'conll2003'
addition = '_val' #'_val' # ''
# val: validation set
# test: test set
## results will be saved to '../evaluation/{}_{}_{}_results.csv'.format(dataset_name,addition,task)
# Modify this function in inference.py by adding topic classification task (topic)
def write_gt(dataset,path,task,purpose,dataset_name):
if not os.path.exists(path):
# evaluate: model inference
if purpose == 'evaluate':
if task == 'sentiment':
tag_list = dataset['label']
else:
tag_list = dataset['{}_tags'.format(task)]
convert_label(path,tag_list,task)
# experiment: gather gt and evaluate on SOA models
if purpose == 'experiment':
if task == 'ner':
model_name = 'flair/ner-multi'
m_type = 'flair'
elif task == 'pos':
model_name = 'flair/upos-english'
m_type = 'flair'
elif task == 'sentiment':
model_name = 'cardiffnlp/twitter-roberta-base-sentiment'
m_type = 'pipeline'
model = load_model(model_name,m_type,task,'pytorch')
inference_time = inference(model,dataset,task,path,m_type,dataset_name)
python3 new_finetune.py
# new_finetune.py will retrieve the above function before finetuning it
# new_finetune include step 3 & 4
python3 new_finetune.py
if __name__ == '__main__':
task = 'ner' #'sentiment' #'ner' #'pos'
purpose = 'evaluate' # 'experiment' 'evaluate'
finetune = False
dataset_name = 'tweet_eval' #'tweet_eval'#'conll2003'
addition = 'train' #'_val' # ''
data = get_ground_truth(dataset_name,task)
training_set, val_set = createDataset(data)
1 commits
Python
97.9%
Dockerfile
2.1%
python3 download_model_from_HG.py
if __name__ == '__main__':
task = 'ner'
# modify the name of the task and the weights will be saved under the ./pretrained folder
CONFIG_FILE = 'model_{}.csv'.format(task)
model = HFModel(task, CONFIG_FILE)
# # download model files
model.download_model()
Evaluate the performance in terms of accuracy, f1 score, precision, recall;
Evaluate the performance in terms of efficiency, i.e., execution speed per instance
python3 inference.py
if __name__ == '__main__':
task = 'ner' #'sentiment' #'ner' #'pos'
purpose = 'experiment' # 'experiment' 'evaluate'
# evaluate: evaluate all the models on its origin dataset
# experiment: evaluate the models on dedicated dataset with groundtruth being retrieved
dataset_name = 'tweet_eval' #'tweet_eval'#'conll2003'
addition = '_val' #'_val' # ''
# val: validation set
# test: test set
## results will be saved to '../evaluation/{}_{}_{}_results.csv'.format(dataset_name,addition,task)
# Modify this function in inference.py by adding topic classification task (topic)
def write_gt(dataset,path,task,purpose,dataset_name):
if not os.path.exists(path):
# evaluate: model inference
if purpose == 'evaluate':
if task == 'sentiment':
tag_list = dataset['label']
else:
tag_list = dataset['{}_tags'.format(task)]
convert_label(path,tag_list,task)
# experiment: gather gt and evaluate on SOA models
if purpose == 'experiment':
if task == 'ner':
model_name = 'flair/ner-multi'
m_type = 'flair'
elif task == 'pos':
model_name = 'flair/upos-english'
m_type = 'flair'
elif task == 'sentiment':
model_name = 'cardiffnlp/twitter-roberta-base-sentiment'
m_type = 'pipeline'
model = load_model(model_name,m_type,task,'pytorch')
inference_time = inference(model,dataset,task,path,m_type,dataset_name)
python3 new_finetune.py
# new_finetune.py will retrieve the above function before finetuning it
# new_finetune include step 3 & 4
python3 new_finetune.py
if __name__ == '__main__':
task = 'ner' #'sentiment' #'ner' #'pos'
purpose = 'evaluate' # 'experiment' 'evaluate'
finetune = False
dataset_name = 'tweet_eval' #'tweet_eval'#'conll2003'
addition = 'train' #'_val' # ''
data = get_ground_truth(dataset_name,task)
training_set, val_set = createDataset(data)
1 commits
Python
97.9%
Dockerfile
2.1%