amazon-sagemaker-examples
amazon-sagemaker-examples copied to clipboard
[Bug Report] ImportError: IProgress not found. Please update jupyter and ipywidgets
Link to the notebook https://github.com/aws/amazon-sagemaker-examples/blob/main/sagemaker_neo_compilation_jobs/deploy_huggingface_model_on_Inf1_instance/inf1_bert_compile_and_deploy.ipynb
Describe the bug
Running the cell to get model from HuggingFace Model Hub in SageMaker Studio result in ImportError: IProgress not found. Please update jupyter and ipywidgets
.
To reproduce Run the notebook in SageMaker Studio.
Logs
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-4-e1f590cc0eb4> in <module>
----> 1 tokenizer = transformers.AutoTokenizer.from_pretrained("distilbert-base-uncased")
2
3 model = transformers.AutoModelForSequenceClassification.from_pretrained(
4 "distilbert-base-uncased", return_dict=False
5 )
/opt/conda/lib/python3.6/site-packages/transformers/models/auto/tokenization_auto.py in from_pretrained(cls, pretrained_model_name_or_path, *inputs, **kwargs)
461
462 # Next, let's try to use the tokenizer_config file to get the tokenizer class.
--> 463 tokenizer_config = get_tokenizer_config(pretrained_model_name_or_path, **kwargs)
464 config_tokenizer_class = tokenizer_config.get("tokenizer_class")
465 tokenizer_auto_map = tokenizer_config.get("auto_map")
/opt/conda/lib/python3.6/site-packages/transformers/models/auto/tokenization_auto.py in get_tokenizer_config(pretrained_model_name_or_path, cache_dir, force_download, resume_download, proxies, use_auth_token, revision, local_files_only, **kwargs)
331 use_auth_token=use_auth_token,
332 revision=revision,
--> 333 local_files_only=local_files_only,
334 )
335 if resolved_config_file is None:
/opt/conda/lib/python3.6/site-packages/transformers/file_utils.py in get_file_from_repo(path_or_repo, filename, cache_dir, force_download, resume_download, proxies, use_auth_token, revision, local_files_only)
2240 resume_download=resume_download,
2241 local_files_only=local_files_only,
-> 2242 use_auth_token=use_auth_token,
2243 )
2244
/opt/conda/lib/python3.6/site-packages/transformers/file_utils.py in cached_path(url_or_filename, cache_dir, force_download, proxies, resume_download, user_agent, extract_compressed_file, force_extract, use_auth_token, local_files_only)
1852 user_agent=user_agent,
1853 use_auth_token=use_auth_token,
-> 1854 local_files_only=local_files_only,
1855 )
1856 elif os.path.exists(url_or_filename):
/opt/conda/lib/python3.6/site-packages/transformers/file_utils.py in get_from_cache(url, cache_dir, force_download, proxies, etag_timeout, resume_download, user_agent, use_auth_token, local_files_only)
2140 logger.info(f"{url} not found in cache or force_download set to True, downloading to {temp_file.name}")
2141
-> 2142 http_get(url_to_download, temp_file, proxies=proxies, resume_size=resume_size, headers=headers)
2143
2144 logger.info(f"storing {url} in cache at {cache_path}")
/opt/conda/lib/python3.6/site-packages/transformers/file_utils.py in http_get(url, temp_file, proxies, resume_size, headers)
1997 total=total,
1998 initial=resume_size,
-> 1999 desc="Downloading",
2000 )
2001 for chunk in r.iter_content(chunk_size=1024):
/opt/conda/lib/python3.6/site-packages/transformers/utils/logging.py in __call__(self, *args, **kwargs)
310 def __call__(self, *args, **kwargs):
311 if _tqdm_active:
--> 312 return tqdm_lib.tqdm(*args, **kwargs)
313 else:
314 return EmptyTqdm(*args, **kwargs)
/opt/conda/lib/python3.6/site-packages/tqdm/notebook.py in __init__(self, *args, **kwargs)
222 total = self.total * unit_scale if self.total else self.total
223 self.container = self.status_printer(
--> 224 self.fp, total, self.desc, self.ncols)
225 self.sp = self.display
226 self.colour = colour
/opt/conda/lib/python3.6/site-packages/tqdm/notebook.py in status_printer(_, total, desc, ncols)
95 if IProgress is None: # #187 #451 #558 #872
96 raise ImportError(
---> 97 "IProgress not found. Please update jupyter and ipywidgets."
98 " See https://ipywidgets.readthedocs.io/en/stable"
99 "/user_install.html")
ImportError: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html
Hi @eitansela,
You can solve this problem if you include in the notebook lifecycle configurations script the following lines:
conda activate the environment_you_intend_to_use
pip install --upgrade --quiet jupyter_client ipywidgets
I hope this helps.
Hi. Did you solve this problem? I get the same error.
If you run this notebook in SageMaker Studio, you need to make sure ipywidgets is installed and restart the kernel, so please uncomment the code in the next cell, and run it.
# %%capture
# import IPython
# import sys
# !{sys.executable} -m pip install ipywidgets
# IPython.Application.instance().kernel.do_shutdown(True) # has to restart kernel so changes are used
This specifically worked for my Sagemaker Studio Notebook
This solution is not working on SageMaker Studio Notebook with images pytorch 1.12 python 3.8 CPU
and pytorch 1.10 python 3.8 CPU
.
When importing tqdm in notebook, it is showing error: IProgress not found. Please update jupyter and ipywidgets.
Have not tested on other images yet.
If you run this notebook in SageMaker Studio, you need to make sure ipywidgets is installed and restart the kernel, so please uncomment the code in the next cell, and run it.
# %%capture # import IPython # import sys # !{sys.executable} -m pip install ipywidgets # IPython.Application.instance().kernel.do_shutdown(True) # has to restart kernel so changes are used