Python progressbar.Counter() Examples
The following are 8
code examples of progressbar.Counter().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
progressbar
, or try the search function
.
Example #1
Source File: __init__.py From attention-lvcsr with MIT License | 6 votes |
def create_bar(self): """Create a new progress bar. Calls `self.get_iter_per_epoch()`, selects an appropriate set of widgets and creates a ProgressBar. """ iter_per_epoch = self.get_iter_per_epoch() epochs_done = self.main_loop.log.status['epochs_done'] if iter_per_epoch is None: widgets = ["Epoch {}, step ".format(epochs_done), progressbar.Counter(), ' ', progressbar.BouncingBar(), ' ', progressbar.Timer()] iter_per_epoch = progressbar.UnknownLength else: widgets = ["Epoch {}, step ".format(epochs_done), progressbar.Counter(), ' (', progressbar.Percentage(), ') ', progressbar.Bar(), ' ', progressbar.Timer(), ' ', progressbar.ETA()] return progressbar.ProgressBar(widgets=widgets, max_value=iter_per_epoch)
Example #2
Source File: optimization.py From angler with MIT License | 6 votes |
def _make_progressbar(self, N): """ Returns a progressbar to use during optimization""" if self.max_ind_shift is not None: bar = progressbar.ProgressBar(widgets=[ ' ', progressbar.DynamicMessage('ObjectiveFn'), ' ', progressbar.DynamicMessage('ObjectiveFn_Normalized'), ' Iteration: ', ' ', progressbar.Counter(), '/%d' % N, ' ', progressbar.AdaptiveETA(), ], max_value=N) else: bar = progressbar.ProgressBar(widgets=[ ' ', progressbar.DynamicMessage('ObjectiveFn'), ' Iteration: ', ' ', progressbar.Counter(), '/%d' % N, ' ', progressbar.AdaptiveETA(), ], max_value=N) return bar
Example #3
Source File: laika.py From laikaboss with Apache License 2.0 | 6 votes |
def run(self): try: from progressbar import ProgressBar, Bar, Counter, Timer, ETA, Percentage, RotatingMarker widgets = [Percentage(), Bar(left='[', right=']'), ' Processed: ', Counter(), '/', "%s" % self.task_count, ' total files (', Timer(), ') ', ETA()] pb = ProgressBar(widgets=widgets, maxval=self.task_count).start() while self.task_queue.qsize(): pb.update(self.task_count - self.task_queue.qsize()) time.sleep(0.5) pb.finish() except KeyboardInterrupt: warning("progressbar interrupted by user\n") return 1 except ImportError: warning("progressbar module not available") except: warning("unknown error from progress bar") return 0
Example #4
Source File: diskover.py From diskover with Apache License 2.0 | 5 votes |
def progress_bar(event): if event == 'Checking' or event == 'Calculating': widgets = [progressbar.AnimatedMarker(), ' ', event + ' (Queue: ', progressbar.Counter(), ') ', progressbar.Timer()] bar = progressbar.ProgressBar(widgets=widgets, max_value=progressbar.UnknownLength) else: widgets = [event + ' ', progressbar.Bar(), progressbar.Percentage(), ' (', progressbar.Timer(), ', ', progressbar.ETA(), ')'] bar = progressbar.ProgressBar(widgets=widgets, max_value=100) return bar
Example #5
Source File: codebook.py From AugmentedAutoencoder with MIT License | 5 votes |
def update_embedding(self, session, batch_size): embedding_size = self._dataset.embedding_size J = self._encoder.latent_space_size embedding_z = np.empty( (embedding_size, J) ) obj_bbs = np.empty( (embedding_size, 4) ) widgets = ['Creating embedding ..: ', progressbar.Percentage(), ' ', progressbar.Bar(), ' ', progressbar.Counter(), ' / %s' % embedding_size, ' ', progressbar.ETA(), ' '] bar = progressbar.ProgressBar(maxval=embedding_size,widgets=widgets) bar.start() for a, e in u.batch_iteration_indices(embedding_size, batch_size): batch, obj_bbs_batch = self._dataset.render_embedding_image_batch(a, e) embedding_z[a:e] = session.run(self._encoder.z, feed_dict={self._encoder.x: batch}) if self.embed_bb: obj_bbs[a:e] = obj_bbs_batch bar.update(e) bar.finish() # embedding_z = embedding_z.T normalized_embedding = embedding_z / np.linalg.norm( embedding_z, axis=1, keepdims=True ) session.run(self.embedding_assign_op, {self.embedding: normalized_embedding}) if self.embed_bb: session.run(self.embed_obj_bbs_assign_op, {self.embed_obj_bbs: obj_bbs})
Example #6
Source File: ProgressManager.py From EventMonkey with Apache License 2.0 | 5 votes |
def __init__(self,interface_type,count=None,description=None): self.interface_type = interface_type self.current_value = 0 if self.interface_type == Config.UI_CLI: widgets = [] if description is not None: widgets.append('{}: '.format(description)) if count is not None: widgets.append(Percentage()) widgets.append(' ') widgets.append(Bar()) else: widgets.append(Counter()) widgets.append(' ') widgets.append(AnimatedMarker(markers='.oO@* ')) if count is not None: self.progressBar = ProgressBar(widgets=widgets, max_value=count) else: self.progressBar = ProgressBar(max_value=progressbar.UnknownLength,widgets=widgets) else: PROGRESS_LOGGER.error('interface type not handled: {}'.format(self.interface_type)) raise Exception('interface type not handled: {}'.format(self.interface_type))
Example #7
Source File: solve.py From angr-doc with BSD 2-Clause "Simplified" License | 5 votes |
def bruteforce_possibilities(possibilities): # let's try those values! print('[*] example guess: %r' % b''.join(possibilities[0])) print('[*] brute-forcing %d possibilities' % len(possibilities)) for guess in progressbar.ProgressBar(widgets=[progressbar.Counter(), ' ', progressbar.Percentage(), ' ', progressbar.Bar(), ' ', progressbar.ETA()])(possibilities): guess_str = b''.join(guess) stdout,_ = subprocess.Popen(["./whitehat_crypto400", guess_str.decode("ascii")], stdout=subprocess.PIPE, stderr=subprocess.STDOUT).communicate() if b'FLAG IS' in stdout: return next(filter(lambda s: guess_str in s, stdout.split()))
Example #8
Source File: training.py From reweighted-ws with GNU Affero General Public License v3.0 | 4 votes |
def perform_epoch(self): n_datapoints = self.dataset.n_datapoints batch_size = self.batch_size n_batches = n_datapoints // batch_size epoch = self.step // n_batches LL_epoch = 0 self.update_shvars() self.shuffle_train_data() # Update learning rated self.shvar['lr_p'].set_value((self.calc_learning_rates(self.learning_rate_p / self.lr_decay**epoch)).astype(floatX)) self.shvar['lr_q'].set_value((self.calc_learning_rates(self.learning_rate_q / self.lr_decay**epoch)).astype(floatX)) self.shvar['lr_s'].set_value((self.calc_learning_rates(self.learning_rate_s / self.lr_decay**epoch)).astype(floatX)) widgets = ["Epoch %d, step "%(epoch+1), pbar.Counter(), ' (', pbar.Percentage(), ') ', pbar.Bar(), ' ', pbar.Timer(), ' ', pbar.ETA()] bar = pbar.ProgressBar(widgets=widgets, maxval=n_batches).start() t0 = time() while True: LL = self.perform_step(update=False) LL_epoch += LL batch_idx = self.step % n_batches bar.update(batch_idx) if self.step % n_batches == 0: break t = time()-t0 bar.finish() LL_epoch /= n_batches self.logger.info("Completed epoch %d in %.1fs (%.1fms/step). Calling epoch_monitors..." % (epoch+1, t, t/n_batches*1000)) for m in self.epoch_monitors: m.on_iter(self.model) self.dlog.append_all({ 'timing.epoch': t, 'timing.step': t/n_batches }) return LL_epoch