transformers icon indicating copy to clipboard operation
transformers copied to clipboard

Pycharm Debug Mode Errors

Open taeyeopl opened this issue 1 year ago • 2 comments

System Info

I am using Pycham debug mode, and It has no problem in transformers==4.24.0, but after version 4.24.0, it get below errors during debug mode due to transformers. The code works without debug mode but only gets a problem during debug modes due to the transformer library when the version is above 4.24.0). My environment is Ubuntu 18.04, Torch 1.12.1, CUDA 11.3

/home/miruware/anaconda3/envs/dreamfusion/bin/python /snap/pycharm-professional/331/plugins/python/helpers/pydev/pydevd.py --multiprocess --qt-support=auto --client 127.0.0.1 --port 32875 --file /home/miruware/ssd_4tb/diffusion/workspace/stable-dreamfusion/main.py -O --image data/hamburger_rgba.png --workspace results/test --iters 5000 
/home/miruware/anaconda3/envs/dreamfusion/lib/python3.9/site-packages/transformers/models/clip/feature_extraction_clip.py:28: FutureWarning: The class CLIPFeatureExtractor is deprecated and will be removed in version 5 of Transformers. Please use CLIPImageProcessor instead.
  warnings.warn(
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /snap/pycharm-professional/331/plugins/python/helpers/pydev/pydevd.py:55 in  │
│ <module>                                                                     │
│                                                                              │
│     52 from _pydevd_bundle.pydevd_custom_frames import CustomFramesContainer │
│     53 from _pydevd_bundle.pydevd_frame_utils import add_exception_to_frame, │
│     54 from _pydevd_bundle.pydevd_kill_all_pydevd_threads import kill_all_py │
│ ❱   55 from _pydevd_bundle.pydevd_trace_dispatch import (                    │
│     56 │   trace_dispatch as _trace_dispatch, global_cache_skips, global_cac │
│     57 from _pydevd_frame_eval.pydevd_frame_eval_main import (               │
│     58 │   frame_eval_func, dummy_trace_dispatch, show_frame_eval_warning)   │
│                                                                              │
│ /snap/pycharm-professional/331/plugins/python/helpers/pydev/_pydevd_bundle/p │
│ ydevd_trace_dispatch.py:60 in <module>                                       │
│                                                                              │
│   57 elif use_cython is None:                                                │
│   58 │   # Regular: use fallback if not found and give message to user       │
│   59 │   try:                                                                │
│ ❱ 60 │   │   from _pydevd_bundle.pydevd_cython_wrapper import trace_dispatch │
│   61 │   │   def trace_dispatch(py_db, frame, event, arg):                   │
│   62 │   │   │   if _trace_dispatch is None:                                 │
│   63 │   │   │   │   return None                                             │
│                                                                              │
│ /snap/pycharm-professional/331/plugins/python/helpers/pydev/_pydevd_bundle/p │
│ ydevd_cython_wrapper.py:4 in <module>                                        │
│                                                                              │
│    1 import sys                                                              │
│    2                                                                         │
│    3 # This version number is always available                               │
│ ❱  4 from _pydevd_bundle.pydevd_additional_thread_info_regular import versio │
│    5                                                                         │
│    6 try:                                                                    │
│    7 │   try:                                                                │
│                                                                              │
│ /snap/pycharm-professional/331/plugins/python/helpers/pydev/_pydevd_bundle/p │
│ ydevd_additional_thread_info_regular.py:7 in <module>                        │
│                                                                              │
│     4 # IFDEF CYTHON                                                         │
│     5 # pydev_log.debug("Using Cython speedups")                             │
│     6 # ELSE                                                                 │
│ ❱   7 from _pydevd_bundle.pydevd_frame import PyDBFrame                      │
│     8 # ENDIF                                                                │
│     9                                                                        │
│    10 version = 37                                                           │
│                                                                              │
│ /snap/pycharm-professional/331/plugins/python/helpers/pydev/_pydevd_bundle/p │
│ ydevd_frame.py:32 in <module>                                                │
│                                                                              │
│    29 from _pydevd_bundle.pydevd_constants import IS_PY2                     │
│    30                                                                        │
│    31 try:                                                                   │
│ ❱  32 │   from _pydevd_bundle.pydevd_signature import send_signature_call_tr │
│    33 except ImportError:                                                    │
│    34 │   def send_signature_call_trace(*args, **kwargs):                    │
│    35 │   │   pass                                                           │
│                                                                              │
│ /snap/pycharm-professional/331/plugins/python/helpers/pydev/_pydevd_bundle/p │
│ ydevd_signature.py:3 in <module>                                             │
│                                                                              │
│     1                                                                        │
│     2 try:                                                                   │
│ ❱   3 │   import trace                                                       │
│     4 except ImportError:                                                    │
│     5 │   pass                                                               │
│     6 else:                                                                  │
│                                                                              │
│ /home/miruware/ssd_4tb/diffusion/workspace/stable-dreamfusion/trace.py:31 in │
│ <module>                                                                     │
│                                                                              │
│   28 unet.forward = functools.partial(unet.forward, return_dict=False)  # se │
│   29                                                                         │
│   30 # load inputs                                                           │
│ ❱ 31 train_latent_model_input = torch.load("train_latent_model_input.pt").to │
│   32 train_t = torch.load("train_t.pt").to(torch.float16)                    │
│   33 train_text_embeddings = torch.load("train_text_embeddings.pt").to(torch │
│   34                                                                         │
│                                                                              │
│ /home/miruware/anaconda3/envs/dreamfusion/lib/python3.9/site-packages/torch/ │
│ serialization.py:699 in load                                                 │
│                                                                              │
│    696 │   if 'encoding' not in pickle_load_args.keys():                     │
│    697 │   │   pickle_load_args['encoding'] = 'utf-8'                        │
│    698 │                                                                     │
│ ❱  699 │   with _open_file_like(f, 'rb') as opened_file:                     │
│    700 │   │   if _is_zipfile(opened_file):                                  │
│    701 │   │   │   # The zipfile reader is going to advance the current file │
│    702 │   │   │   # If we want to actually tail call to torch.jit.load, we  │
│                                                                              │
│ /home/miruware/anaconda3/envs/dreamfusion/lib/python3.9/site-packages/torch/ │
│ serialization.py:230 in _open_file_like                                      │
│                                                                              │
│    227                                                                       │
│    228 def _open_file_like(name_or_buffer, mode):                            │
│    229 │   if _is_path(name_or_buffer):                                      │
│ ❱  230 │   │   return _open_file(name_or_buffer, mode)                       │
│    231 │   else:                                                             │
│    232 │   │   if 'w' in mode:                                               │
│    233 │   │   │   return _open_buffer_writer(name_or_buffer)                │
│                                                                              │
│ /home/miruware/anaconda3/envs/dreamfusion/lib/python3.9/site-packages/torch/ │
│ serialization.py:211 in __init__                                             │
│                                                                              │
│    208                                                                       │
│    209 class _open_file(_opener):                                            │
│    210 │   def __init__(self, name, mode):                                   │
│ ❱  211 │   │   super(_open_file, self).__init__(open(name, mode))            │
│    212 │                                                                     │
│    213 │   def __exit__(self, *args):                                        │
│    214 │   │   self.file_like.close()                                        │
╰──────────────────────────────────────────────────────────────────────────────╯
FileNotFoundError: [Errno 2] No such file or directory: 
'train_latent_model_input.pt'

Process finished with exit code 1

Who can help?

No response

Information

  • [X] The official example scripts
  • [ ] My own modified scripts

Tasks

  • [ ] An officially supported task in the examples folder (such as GLUE/SQuAD, ...)
  • [ ] My own task or dataset (give details below)

Reproduction

Any example using official diffusers(0.15.1) code with transformers(4.28.1) library!

Expected behavior

No Errors during Pycharm debug modes

taeyeopl avatar Apr 26 '23 10:04 taeyeopl

There is nothing in that traceback that is linked to the Transformers package. It is all in stable-dreamfusion.

sgugger avatar Apr 26 '23 11:04 sgugger

Thanks, I will recheck it!

taeyeopl avatar Apr 27 '23 02:04 taeyeopl