Skip to content

Commit

Permalink
Suspicious unused loop iteration variable (#320)
Browse files Browse the repository at this point in the history
* Fix keyword argument error

* Add download option

* Fix raise for Value error in mini-imagenet

* Remove a couple of used variables

* Remove a couple of used variables

* Update CHANGELOG.md

Co-authored-by: Séb Arnold <[email protected]>
  • Loading branch information
nightlessbaron and seba-1511 authored Mar 15, 2022
1 parent 387915d commit df3c329
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

* example for `detach_module`. ([Nimish Sanghi](https://github.com/nsanghi))
* Example for `detach_module`. ([Nimish Sanghi](https://github.com/nsanghi))
* Loading duplicate FGVC Aircraft images.

## v0.1.7

Expand Down
2 changes: 1 addition & 1 deletion examples/rl/dist_promp.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def make_env():
print('adaptation_reward', adaptation_reward)

# ProMP meta-optimization
for ppo_step in tqdm(range(ppo_steps), leave=False, desc='Optim'):
for _ in tqdm(range(ppo_steps), leave=False, desc='Optim'):
promp_loss = 0.0
kl_total = 0.0
for task_replays, old_policies in zip(iteration_replays, iteration_policies):
Expand Down
2 changes: 1 addition & 1 deletion examples/rl/promp.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def make_env():
print('adaptation_reward', adaptation_reward)

# ProMP meta-optimization
for ppo_step in tqdm(range(ppo_steps), leave=False, desc='Optim'):
for _ in tqdm(range(ppo_steps), leave=False, desc='Optim'):
promp_loss = 0.0
kl_total = 0.0
for task_replays, old_policies in zip(iteration_replays, iteration_policies):
Expand Down
4 changes: 2 additions & 2 deletions examples/text/news_topic_classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,15 +136,15 @@ def main(lr=0.005, maml_lr=0.01, iterations=1000, ways=5, shots=1, tps=32, fas=5
tqdm_bar = tqdm(range(iterations))

accs = []
for iteration in tqdm_bar:
for _ in tqdm_bar:
iteration_error = 0.0
iteration_acc = 0.0
for _ in range(tps):
learner = meta_model.clone()
train_task, valid_task = train_gen.sample(), validation_gen.sample()

# Fast Adaptation
for step in range(fas):
for _ in range(fas):
train_error, _ = compute_loss(train_task, roberta, device, learner, loss_func, batch=shots * ways)
learner.adapt(train_error)

Expand Down
2 changes: 1 addition & 1 deletion learn2learn/vision/datasets/fgvc_aircraft.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def download(self):
'images_family_test.txt']
images_labels = []
for family in family_names:
with open(os.path.join(data_path, DATA_DIR, family_names[0]), 'r') as family_file:
with open(os.path.join(data_path, DATA_DIR, family), 'r') as family_file:
for line in family_file.readlines():
image, label = line.split(' ', 1)
images_labels.append((image.strip(), label.strip()))
Expand Down

0 comments on commit df3c329

Please sign in to comment.