提交 2243468e 编写于 作者: Z Zeyu Chen

add strategy __str__()

上级 96f2f432
......@@ -23,16 +23,11 @@ class FinetuneConfig(object):
eval_interval=100,
save_ckpt_interval=None,
use_cuda=False,
learning_rate=1e-4,
checkpoint_dir=None,
num_epoch=10,
batch_size=None,
max_seq_len=128,
weight_decay=None,
warmup_proportion=0.0,
enable_memory_optim=True,
strategy=None,
optimizer="adam"):
strategy=None):
""" Construct finetune Config """
self._log_interval = log_interval
self._eval_interval = eval_interval
......@@ -82,18 +77,6 @@ class FinetuneConfig(object):
def batch_size(self):
return self._batch_size
@property
def max_seq_len(self):
return self._max_seq_len
@property
def weight_decay(self):
return self._weight_decay
@property
def warmup_proportion(self):
return self._warmup_proportion
@property
def strategy(self):
return self._strategy
......@@ -101,7 +84,3 @@ class FinetuneConfig(object):
@property
def enable_memory_optim(self):
return self._enable_memory_optim
@property
def optimizer(self):
return self._optimizer
......@@ -37,6 +37,10 @@ class DefaultStrategy(object):
else:
raise ValueError("DefaultStrategy's optimizer is None")
# TODO complete __str__()
def __str__(self):
return "DefaultStrategy"
class BERTFinetuneStrategy(DefaultStrategy):
def __init__(self,
......@@ -88,3 +92,7 @@ class BERTFinetuneStrategy(DefaultStrategy):
os.environ.get('CPU_NUM', multiprocessing.cpu_count()))
return dev_count
# TODO complete __str__()
def __str__(self):
return "BERTFintuneStrategy"
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册