Skip to content

Commit 686f105

Browse files
committed
Disables grads in extract tool
1 parent 14e0a01 commit 686f105

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

ig65m/cli/extract.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,15 @@ def main(args):
6767

6868
features = []
6969

70-
for inputs in tqdm(loader, total=len(dataset) // args.batch_size):
71-
inputs = inputs.to(device)
70+
with torch.no_grad():
71+
for inputs in tqdm(loader, total=len(dataset) // args.batch_size):
72+
inputs = inputs.to(device)
7273

73-
outputs = model(inputs)
74-
outputs = outputs.data.cpu().numpy()
74+
outputs = model(inputs)
75+
outputs = outputs.data.cpu().numpy()
7576

76-
for output in outputs:
77-
features.append(output)
77+
for output in outputs:
78+
features.append(output)
7879

7980
np.save(args.features, np.array(features), allow_pickle=False)
8081
print("🍪 Done", file=sys.stderr)

0 commit comments

Comments
 (0)