Is it possible to override the behavior of tqdm.auto in a loaded library? - tqdm

I am using an Emacs interface to Jupyter notebooks which means that even though tqdm detects that I am in a Jupyter notebook, I would like it to update the progress bar as if it were in a terminal (i.e. I use from tqdm import tqdm) in my Emacs interface.
However, some libraries (e.g. Huggingface) automatically detect whether or not I am in a notebook and use the specified tqdm progress bar. I would like to override this to use tqdm.std. Is this possible?
My current fix is to go into the source code and replace: #from tqdm.auto import tqdm with from tqdm import tqdm everywhere.

Related

Error message while trying to import TextAttack package

from textattack.augmentation import EasyDataAugmenter
I've just downloaded TextAttack package for Text Augmentation, however, I can't seem to be able to import the package. How can I solve this problem please?

How to use PlaidML with nighly Keras bulds?

Whenever I try to use from tensorflow import keras PlaidML refuses to work and import keras uses stable build.
tf.keras only uses tensorflow as backend, it does not have the multi-backend option. Only the keras package has multi-backend support, so if you want to use PlaidML, you can only do it with the keras package.

Qpython - Kivy apps fail "No module named kivy"

I'm using Qpython v2.2.4-8 with python 2.7.12, and am trying to get a kivy app to run. I installed the pip libraries lxml-u4-qpython and kivy-u4-qpython via the app's terminal, and created a new sample kivy app which has this code by default:
#-*-coding:utf8;-*-
#qpy:2
#qpy:kivy
from kivy.app import App
from kivy.uix.button import Button
class TestApp(App):
def build(self):
# display a button with the text : Hello QPython
return Button(text='Hello QPython')
TestApp().run()
However, when I try to run the code, I get the exception ImportError: No module named kivy.app
I belive you need to add the line:
import kivy
at the beginning of your code in order for kivy to run.
I would like to hear your feedback if this actually was the problem or you already found out how it works
I don't think that Qpython comes installed with the kivy library. You can use another android application called pydroid3 . Kivy is already installed in the app, it also has some packages you might need. It can also run kivymd.

Failure to be able to access classes from imported libraries

My research team wrote a script for loading some data from edn files into a Titan database. We are now attempting to migrate our work to a Datastax Enterprise Graph database. When we use :load on gremlin-server the script gets through the import statements but fails as soon as it hits any instance of a class from one of the imported libraries. For instance we import
import static us.bpsm.edn.parser.Parsers.defaultConfiguration;
import us.bpsm.edn.*;
import us.bpsm.edn.parser.*;
import us.bpsm.edn.printer.*;
and after the import we call
parser = Parsers.newParser(defaultConfiguration())
but gremlin returns "No such property: Parsers for class: Script2"
When running the commands one at a time we run into the same issue. Our initial thoughts are that we need to add the libraries to the right class path, but we have tried a few spots with little avail. When we switch from remote to local gremlin we are able to load the script, but don't have access to the graphs in system.
Any thoughts?
MFin, you're on the right track, essentially you will want to add the libraries to the class path on each of the nodes as well as locally.

Rascal slow at importing modules

I am running Rascal from the REPL and it seems like it takes a pretty long time to import some modules. For example import lang::java::\syntax::Java15; takes seconds to run.
I've also noticed cases where modules that depend on other modules don't appear to be reloaded if they are changed. For example:
program 1:
module A::A
....
program 2:
module B::B
import A::A;
...
REPL:
import A::A;
import B::B;
Now I've made some changes to A and B and I import B again. I would imagine the changes to A would get propagated to the new version of B (since it is importing A) but this doesn't seem to happen.
Why is importing this slow and is there a way to speed this up?
How does importing packages with dependencies in the REPL work?
Thanks!
We recently changed quite a bit about this part of the implementation. So could you tell us which version you are using?
Importing is slow right now because we have a bottleneck in the parsing infrastructure, as far as I can remember. Speeding it up; you can do by not using a console in Debug mode (i.e. use Run As...), using more memory for Eclipse also helps (I use 1.8Gb heap and an 80mb stack).
The REPL works in Eclipse by monitoring which modules have changed since running the previous command on the REPL. When a new command is entered, such as an import command, first all modules which have changed and the modules they depend on are purged, this produces an initial worklist for reloading, which is then executed in a fixpoint fashion to load the new modules (each module only once), then finally the command is executed.

Resources