Skip to content

Commit fd01453

Browse files
committed
add progress bar for data preprocessing during training
1 parent bd08ef7 commit fd01453

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ numpy
66
pandas
77
openai
88
google-generativeai
9-
requests
9+
requests
10+
tqdm

training/variable_predictor.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
#!/usr/bin/env python
2-
# coding: utf-8
3-
41

52
from torch.nn.utils import clip_grad_norm_
63
import pandas as pd
@@ -18,6 +15,7 @@
1815
from transformers import AutoModelForMaskedLM
1916
import torch.nn.functional as F
2017
import argparse
18+
from tqdm import tqdm
2119

2220

2321

@@ -57,7 +55,9 @@ def __init__(self,file_name, tokenizer):
5755
df = pd.read_csv(file_name)
5856
df = df.fillna("")
5957
self.inp_dicts = []
60-
for r in range(df.shape[0]):
58+
pbar = tqdm(range(df.shape[0]))
59+
print("Preprocessing training data")
60+
for r in pbar:
6161
X_init = df['X'][r]
6262
y = df['y'][r]
6363
y = y.rstrip("\n")
@@ -163,8 +163,8 @@ def train(csv_file, device = "cpu"):
163163
#model = nn.DataParallel(model,device_ids=[0,1])
164164
#model.to(device)
165165

166-
167-
for epoch in range(EPOCHS):
166+
pbar = tqdm(range(EPOCHS))
167+
for epoch in pbar:
168168
loop = tqdm(train_loader, leave=True)
169169
tot_loss = 0.0
170170
cntr = 0

0 commit comments

Comments
 (0)