mirror of
https://github.com/hate-alert/DE-LIMIT.git
synced 2021-05-12 18:32:23 +03:00
add requiremnts
This commit is contained in:
@@ -130,7 +130,7 @@ def Eval_phase(params,which_files='test',model=None):
|
||||
|
||||
params={
|
||||
'logging':'locals',
|
||||
'language':'English',
|
||||
'language':'German',
|
||||
'is_train':False,
|
||||
'is_model':False,
|
||||
'learning_rate':5e-5,
|
||||
|
||||
@@ -19,24 +19,24 @@ from tqdm import tqdm
|
||||
from BERT_inference import *
|
||||
import os
|
||||
|
||||
# If there's a GPU available...
|
||||
if torch.cuda.is_available():
|
||||
# Tell PyTorch to use the GPU.
|
||||
device = torch.device("cuda")
|
||||
print('There are %d GPU(s) available.' % torch.cuda.device_count())
|
||||
print('We will use the GPU:', torch.cuda.get_device_name(0))
|
||||
# If not...
|
||||
else:
|
||||
print('No GPU available, using the CPU instead.')
|
||||
device = torch.device("cpu")
|
||||
# # If there's a GPU available...
|
||||
# if torch.cuda.is_available():
|
||||
# # Tell PyTorch to use the GPU.
|
||||
# device = torch.device("cuda")
|
||||
# print('There are %d GPU(s) available.' % torch.cuda.device_count())
|
||||
# print('We will use the GPU:', torch.cuda.get_device_name(0))
|
||||
# # If not...
|
||||
# else:
|
||||
# print('No GPU available, using the CPU instead.')
|
||||
# device = torch.device("cpu")
|
||||
|
||||
|
||||
neptune.init(project_name,api_token=api_token,proxies=proxies)
|
||||
neptune.set_project(project_name)
|
||||
# neptune.init(project_name,api_token=api_token,proxies=proxies)
|
||||
# neptune.set_project(project_name)
|
||||
|
||||
print("current gpu device", torch.cuda.current_device())
|
||||
torch.cuda.set_device(0)
|
||||
print("current gpu device",torch.cuda.current_device())
|
||||
# print("current gpu device", torch.cuda.current_device())
|
||||
# torch.cuda.set_device(0)
|
||||
# print("current gpu device",torch.cuda.current_device())
|
||||
|
||||
|
||||
|
||||
@@ -359,7 +359,6 @@ def train_multitask_model(params):
|
||||
|
||||
if(params['save_only_bert']):
|
||||
model=model.bert
|
||||
print(model)
|
||||
output_dir=output_dir+'_only_bert/'
|
||||
else:
|
||||
output_dir=output_dir+'/'
|
||||
@@ -417,46 +416,46 @@ def train_multitask_model(params):
|
||||
|
||||
|
||||
|
||||
# params={
|
||||
# 'logging':'local',
|
||||
# 'language':'Italian',
|
||||
# 'is_train':True,
|
||||
# 'is_model':True,
|
||||
# 'learning_rate':2e-5,
|
||||
# 'epsilon':1e-8,
|
||||
# 'path_files':'models_saved/multilingual_bert_English_all_multitask_0.1_only_bert/',
|
||||
# 'sample_ratio':100,
|
||||
# 'how_train':'baseline',
|
||||
# 'epochs':5,
|
||||
# 'batch_size':8,
|
||||
# 'to_save':True,
|
||||
# 'weights':[1.0,1.0],
|
||||
# 'what_bert':'weighted',
|
||||
# 'save_only_bert':True,
|
||||
# 'columns_to_consider':['directness','target','group']
|
||||
# }
|
||||
#### multitask
|
||||
params={
|
||||
'logging':'local',
|
||||
'language':'English',
|
||||
'language':'Arabic',
|
||||
'is_train':True,
|
||||
'is_model':True,
|
||||
'learning_rate':2e-5,
|
||||
'epsilon':1e-8,
|
||||
'path_files':'multilingual_bert/',
|
||||
'path_files':'models_saved/multilingual_bert_English_all_multitask_0.1_only_bert/',
|
||||
'sample_ratio':100,
|
||||
'how_train':'all_multitask',
|
||||
'epochs':10,
|
||||
'batch_size':32,
|
||||
'how_train':'baseline',
|
||||
'epochs':5,
|
||||
'batch_size':8,
|
||||
'to_save':True,
|
||||
'weights':[1.0,1.0],
|
||||
'what_bert':'multitask',
|
||||
'save_only_bert':True,
|
||||
'what_bert':'weighted',
|
||||
'save_only_bert':False,
|
||||
'columns_to_consider':['directness','target','group']
|
||||
}
|
||||
#### multitask
|
||||
# params={
|
||||
# 'logging':'local',
|
||||
# 'language':'English',
|
||||
# 'is_train':True,
|
||||
# 'is_model':True,
|
||||
# 'learning_rate':2e-5,
|
||||
# 'epsilon':1e-8,
|
||||
# 'path_files':'multilingual_bert/',
|
||||
# 'sample_ratio':100,
|
||||
# 'how_train':'all_multitask',
|
||||
# 'epochs':20,
|
||||
# 'batch_size':32,
|
||||
# 'to_save':True,
|
||||
# 'weights':[1.0,1.0],
|
||||
# 'what_bert':'multitask',
|
||||
# 'save_only_bert':True,
|
||||
# 'columns_to_consider':['directness','target','group']
|
||||
# }
|
||||
|
||||
|
||||
|
||||
if __name__=='__main__':
|
||||
train_multitask_model(params)
|
||||
#train_model(params)
|
||||
# train_multitask_model(params)
|
||||
train_model(params)
|
||||
|
||||
Binary file not shown.
12
requirements.txt
Normal file
12
requirements.txt
Normal file
@@ -0,0 +1,12 @@
|
||||
emoji==0.5.4
|
||||
numpy==1.16.3
|
||||
knockknock==0.1.7
|
||||
transformers==2.1.1
|
||||
Keras==2.2.4
|
||||
neptune_client==0.4.95
|
||||
torch==1.1.0
|
||||
tqdm==4.32.1
|
||||
pandas==0.24.2
|
||||
GPUtil==1.4.0
|
||||
gtrans==0.2
|
||||
scikit_learn==0.22.1
|
||||
Reference in New Issue
Block a user