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

add strategy __str__()

上级 96f2f432
...@@ -23,16 +23,11 @@ class FinetuneConfig(object): ...@@ -23,16 +23,11 @@ class FinetuneConfig(object):
eval_interval=100, eval_interval=100,
save_ckpt_interval=None, save_ckpt_interval=None,
use_cuda=False, use_cuda=False,
learning_rate=1e-4,
checkpoint_dir=None, checkpoint_dir=None,
num_epoch=10, num_epoch=10,
batch_size=None, batch_size=None,
max_seq_len=128,
weight_decay=None,
warmup_proportion=0.0,
enable_memory_optim=True, enable_memory_optim=True,
strategy=None, strategy=None):
optimizer="adam"):
""" Construct finetune Config """ """ Construct finetune Config """
self._log_interval = log_interval self._log_interval = log_interval
self._eval_interval = eval_interval self._eval_interval = eval_interval
...@@ -82,18 +77,6 @@ class FinetuneConfig(object): ...@@ -82,18 +77,6 @@ class FinetuneConfig(object):
def batch_size(self): def batch_size(self):
return self._batch_size 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 @property
def strategy(self): def strategy(self):
return self._strategy return self._strategy
...@@ -101,7 +84,3 @@ class FinetuneConfig(object): ...@@ -101,7 +84,3 @@ class FinetuneConfig(object):
@property @property
def enable_memory_optim(self): def enable_memory_optim(self):
return self._enable_memory_optim return self._enable_memory_optim
@property
def optimizer(self):
return self._optimizer
...@@ -37,6 +37,10 @@ class DefaultStrategy(object): ...@@ -37,6 +37,10 @@ class DefaultStrategy(object):
else: else:
raise ValueError("DefaultStrategy's optimizer is None") raise ValueError("DefaultStrategy's optimizer is None")
# TODO complete __str__()
def __str__(self):
return "DefaultStrategy"
class BERTFinetuneStrategy(DefaultStrategy): class BERTFinetuneStrategy(DefaultStrategy):
def __init__(self, def __init__(self,
...@@ -88,3 +92,7 @@ class BERTFinetuneStrategy(DefaultStrategy): ...@@ -88,3 +92,7 @@ class BERTFinetuneStrategy(DefaultStrategy):
os.environ.get('CPU_NUM', multiprocessing.cpu_count())) os.environ.get('CPU_NUM', multiprocessing.cpu_count()))
return dev_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.
先完成此消息的编辑!
想要评论请 注册