Skip to content

Commit

Permalink
解决 -bash: ./experiment-rs.sh: /bin/bash^M: 解释器错误: 没有那个文件或目录
Browse files Browse the repository at this point in the history
  • Loading branch information
moguizhizi committed Nov 16, 2021
1 parent 760fde7 commit a7e71ae
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/learn_framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,13 @@ def run_train(self, train_data, dev_data):

for epoch_id in range(self.start_epoch, self.num_epochs):
print('Epoch {}'.format(epoch_id))
if self.rl_variation_tag.startswith('rs'):
# Reward shaping module sanity check:
# Make sure the reward shaping module output value is in the correct range
train_scores = self.test_fn(train_data)
dev_scores = self.test_fn(dev_data)
print('Train set average fact score: {}'.format(float(train_scores.mean())))
print('Dev set average fact score: {}'.format(float(dev_scores.mean())))
# if self.rl_variation_tag.startswith('rs'):
# # Reward shaping module sanity check:
# # Make sure the reward shaping module output value is in the correct range
# train_scores = self.test_fn(train_data)
# dev_scores = self.test_fn(dev_data)
# print('Train set average fact score: {}'.format(float(train_scores.mean())))
# print('Dev set average fact score: {}'.format(float(dev_scores.mean())))

# Update model parameters
self.train()
Expand All @@ -98,7 +98,7 @@ def run_train(self, train_data, dev_data):
if self.run_analysis:
rewards = None
fns = None
for example_id in tqdm(range(0, len(train_data), self.batch_size)):
for example_id in tqdm(range(0, 127, self.batch_size)):

self.optim.zero_grad()

Expand Down Expand Up @@ -154,7 +154,7 @@ def run_train(self, train_data, dev_data):
eta = self.action_dropout_anneal_interval
if len(dev_metrics_history) > eta and metrics < min(dev_metrics_history[-eta:]):
old_action_dropout_rate = self.action_dropout_rate
self.action_dropout_rate *= self.action_dropout_anneal_factor
self.action_dropout_rate *= self.action_dropout_anneal_factor
print('Decreasing action dropout rate: {} -> {}'.format(
old_action_dropout_rate, self.action_dropout_rate))
# Save checkpoint
Expand Down

0 comments on commit a7e71ae

Please sign in to comment.