diff options
| -rw-r--r-- | experiments/rain_ep_bias_train.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/experiments/rain_ep_bias_train.py b/experiments/rain_ep_bias_train.py index eb181a3..1ad476d 100644 --- a/experiments/rain_ep_bias_train.py +++ b/experiments/rain_ep_bias_train.py @@ -37,7 +37,8 @@ def parse_args() -> argparse.Namespace: parser.add_argument( "--adapter", choices=("parameter", "layer"), default="parameter") parser.add_argument( - "--beta-policy", choices=("fixed_positive", "random_sign"), + "--beta-policy", + choices=("fixed_positive", "fixed_negative", "random_sign"), default="fixed_positive") parser.add_argument("--beta-seed", type=int, default=7100) parser.add_argument( @@ -98,11 +99,11 @@ def main() -> None: args = parse_args() if args.calibration_batches < 0: raise ValueError("calibration batches must be nonnegative") - if args.beta_policy == "random_sign" and not ( + if args.beta_policy != "fixed_positive" and not ( args.adapter == "layer" and args.mode == "raw" ): raise ValueError( - "random-sign beta is a raw layer-measurement baseline") + "non-positive beta policies are raw layer-measurement baselines") author_root = args.author_root.resolve() author_revision = revision(author_root) if author_revision != PINNED_REVISION: @@ -240,7 +241,13 @@ def main() -> None: total_cost += float(cost.eval().sum()) total_correct += accuracy(cost, batch) * batch total += batch - if args.beta_policy == "random_sign": + if args.beta_policy == "fixed_positive": + beta_sign_counts["positive"] += 1 + elif args.beta_policy == "fixed_negative": + estimator._first_nudging = 0.0 + estimator._second_nudging = -estimator.nudging + beta_sign_counts["negative"] += 1 + else: sign = 1 if int(torch.randint( 0, 2, (), generator=beta_generator)) else -1 estimator._first_nudging = 0.0 |
