Skip to content

Commit

Permalink
Made tqdm import optionnal
Browse files Browse the repository at this point in the history
  • Loading branch information
aunetx committed Dec 4, 2019
1 parent cfcfb47 commit e825048
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"code-runner.executorMap": {
"python": "python3 $workspaceRoot/scripts/train.py"
}
}
7 changes: 5 additions & 2 deletions scripts/loulou.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from tqdm import tqdm
import numpy as np
import json
import sys
Expand Down Expand Up @@ -92,7 +91,11 @@ def train(weights: list, trX: np.ndarray, trY: np.ndarray, teX: np.ndarray, teY:
# Epochs loop
for i in range(epochs):
if reduce_output < 1:

try:
from tqdm import tqdm
except ImportError:
print('Cannot find module `tqdm`!\nInstall it with `pip3 install tqdm` (or equivalent), or run the program with the argument `-r`.')
exit(1)
pbar = tqdm(range(0, len(trX), batch))
else:
pbar = range(0, len(trX), batch)
Expand Down
2 changes: 1 addition & 1 deletion scripts/train.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3

import json
import argparse
import json

from loulou import runTrain
from utils import listToArch
Expand Down

0 comments on commit e825048

Please sign in to comment.