Issue
import numpy as np
import pandas as pd
import torch
from torch.utils.data import Dataset
import stanza
stanza.download('en')
nlp = stanza.Pipeline(lang='en')
above code used for Creating a Pipeline
Stanza provides a plethora of pre-trained NLP models for 66 human languages that we can make use of. Downloading a pre-trained model and creating a pipeline is as easy as: this code showing this error below shown
Downloading https://raw.githubusercontent.com/stanfordnlp/stanza-resources/main/resources_1.5.0.json
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[21], line 8
----> 8 stanza.download('en')
--> 547 download_resources_json
--> 441 request_file(
--> 152 download_file(url, temppath, proxies, raise_for_status)
--> 119 with tqdm(total=file_size, unit='B', unit_scale=True, \
--> 245 self.colour = colour
--> 204 self.container.children[-2].style.bar_color = bar_color
i have also upgraded jupyter notebook , tqdm and stanza
pip install --upgrade stanza
pip install --upgrade tqdm
but problem still persist. this is project regarding
Solution
I had the same problem with another library. In the terminal, it works and shows a progress bar, in a notebook-cell it raised the error above.
I worked around the issue by capturing the output of the command that tries to show the progress bar:
from contextlib import redirect_stdout
f = io.StringIO()
with redirect_stdout(f):
problematic_function()
(The problematic function in my case was SentenceTransformerEmbeddings from langchain)
Answered By - julaine
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.