neptune-ai / neptune-client

📘 The MLOps stack component for experiment tracking

Home Page:https://neptune.ai

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BUG: 'int' object has no attribute 'split'

apohllo opened this issue · comments

Describe the bug

There's a bug in the neptune/internal/utils/paths.py file (line 26). If an int object is provided, this line causes an error.
The easy work-around is to add call to str:

def parse_path(path: str) -> List[str]:
    return _remove_empty_paths(str(path).split("/"))

Reproduction

Run code examples/torch/question-answering/run_seq2seq.py from Transformers library.

Expected behavior

There should be no error.

Traceback

Traceback (most recent call last):                                                                    
  File "/net/people/plgrid/plgapohl/mt5-classification/question-answering-old/run_seq2seq_qa.py", line 722, in <module>
    main()
  File "/net/people/plgrid/plgapohl/mt5-classification/question-answering-old/run_seq2seq_qa.py", line 658, in main
    train_result = trainer.train(resume_from_checkpoint=checkpoint)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/net/people/plgrid/plgapohl/.conda/envs/lquad2/lib/python3.11/site-packages/transformers/trainer.py", line 1527, in train
    return inner_training_loop(                                                                                                                                                                             
           ^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                               File "/net/people/plgrid/plgapohl/.conda/envs/lquad2/lib/python3.11/site-packages/transformers/trainer.py", line 1704, in _inner_training_loop                                                                self.control = self.callback_handler.on_train_begin(args, self.state, self.control)                                                                                                                     
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/net/people/plgrid/plgapohl/.conda/envs/lquad2/lib/python3.11/site-packages/transformers/trainer_callback.py", line 353, in on_train_begin
    return self.call_event("on_train_begin", args, state, control)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                          
  File "/net/people/plgrid/plgapohl/.conda/envs/lquad2/lib/python3.11/site-packages/transformers/trainer_callback.py", line 397, in call_event
    result = getattr(callback, event)(                                                                                                                                                                      
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/net/people/plgrid/plgapohl/.conda/envs/lquad2/lib/python3.11/site-packages/transformers/integrations.py", line 1228, in on_train_begin
    self._log_model_parameters(model)                                                                 
  File "/net/people/plgrid/plgapohl/.conda/envs/lquad2/lib/python3.11/site-packages/transformers/integrations.py", line 1180, in _log_model_parameters
    self._metadata_namespace[NeptuneCallback.model_parameters_key] = model.config.to_dict()
    ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                          
  File "/net/people/plgrid/plgapohl/.conda/envs/lquad2/lib/python3.11/site-packages/neptune/handler.py", line 117, in __setitem__
    self[key].assign(value)                                                                                                                                                                                 
  File "/net/people/plgrid/plgapohl/.conda/envs/lquad2/lib/python3.11/site-packages/neptune/handler.py", line 86, in inner_fun
    return fun(self, *args, **kwargs)                                                                                                                                                                       
           ^^^^^^^^^^^^^^^^^^^^^^^^^^      
  File "/net/people/plgrid/plgapohl/.conda/envs/lquad2/lib/python3.11/site-packages/neptune/handler.py", line 211, in assign            
    self._container.define(self._path, value)
  File "/net/people/plgrid/plgapohl/.conda/envs/lquad2/lib/python3.11/site-packages/neptune/metadata_containers/metadata_container.py", line 440, in define
    attr.process_assignment(neptune_value, wait=wait)
  File "/net/people/plgrid/plgapohl/.conda/envs/lquad2/lib/python3.11/site-packages/neptune/attributes/attribute.py", line 66, in process_assignment
    return self.assign(value, wait=wait)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/net/people/plgrid/plgapohl/.conda/envs/lquad2/lib/python3.11/site-packages/neptune/attributes/namespace.py", line 109, in assign
    self._container[f"{self._str_path}/{k}"].assign(v, wait=wait)
  File "/net/people/plgrid/plgapohl/.conda/envs/lquad2/lib/python3.11/site-packages/neptune/handler.py", line 86, in inner_fun
    return fun(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/net/people/plgrid/plgapohl/.conda/envs/lquad2/lib/python3.11/site-packages/neptune/handler.py", line 211, in assign
    self._container.define(self._path, value)
  File "/net/people/plgrid/plgapohl/.conda/envs/lquad2/lib/python3.11/site-packages/neptune/metadata_containers/metadata_container.py", line 433, in define
    neptune_value = cast_value(value)
                    ^^^^^^^^^^^^^^^^^
  File "/net/people/plgrid/plgapohl/.conda/envs/lquad2/lib/python3.11/site-packages/neptune/types/type_casting.py", line 86, in cast_value
    return Namespace(value)
           ^^^^^^^^^^^^^^^^
  File "/net/people/plgrid/plgapohl/.conda/envs/lquad2/lib/python3.11/site-packages/neptune/types/namespace.py", line 41, in __init__
    empty_keys = [k for k in self.value.keys() if not parse_path(k)]
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/net/people/plgrid/plgapohl/.conda/envs/lquad2/lib/python3.11/site-packages/neptune/types/namespace.py", line 41, in <listcomp>
    empty_keys = [k for k in self.value.keys() if not parse_path(k)]
                                                      ^^^^^^^^^^^^^
  File "/net/people/plgrid/plgapohl/.conda/envs/lquad2/lib/python3.11/site-packages/neptune/internal/utils/paths.py", line 26, in parse_path
    return _remove_empty_paths(path.split("/"))
                               ^^^^^^^^^^
AttributeError: 'int' object has no attribute 'split'

Environment

The output of pip list:

Package                   Version                                                                                                                                                                  [40/1808]
------------------------- ----------
aiohttp                   3.8.5 
aiosignal                 1.3.1 
arrow                     1.2.3 
async-timeout             4.0.2
attrs                     23.1.0
backoff                   2.2.1
boto3                     1.28.20
botocore                  1.31.20
bravado                   11.0.3
bravado-core              6.1.0 
certifi                   2023.7.22
charset-normalizer        3.2.0 
click                     8.1.6
cmake                     3.27.1
datasets                  2.14.3
dill                      0.3.7
evaluate                  0.4.0
filelock                  3.12.2
fqdn                      1.5.1 
frozenlist                1.4.0 
fsspec                    2023.6.0
future                    0.18.3
gitdb                     4.0.10
GitPython                 3.1.32
huggingface-hub           0.16.4
idna                      3.4   
isoduration               20.11.0
Jinja2                    3.1.2 
jmespath                  1.0.1 
jsonpointer               2.4  
jsonref                   1.1.0
jsonschema                4.19.0
jsonschema-specifications 2023.7.1
lit                       16.0.6 
MarkupSafe                2.1.3
monotonic                 1.6  
mpmath                    1.3.0 
msgpack                   1.0.5
multidict                 6.0.4
multiprocess              0.70.15                                                                     
neptune                   1.4.1
networkx                  3.1
numpy                     1.25.2
nvidia-cublas-cu11        11.10.3.66
nvidia-cuda-cupti-cu11    11.7.101
nvidia-cuda-nvrtc-cu11    11.7.99
nvidia-cuda-runtime-cu11  11.7.99
nvidia-cudnn-cu11         8.5.0.96
nvidia-cufft-cu11         10.9.0.58
nvidia-curand-cu11        10.2.10.91
nvidia-cusolver-cu11      11.4.0.1
nvidia-cusparse-cu11      11.7.4.91
nvidia-nccl-cu11          2.14.3
nvidia-nvtx-cu11          11.7.91
oauthlib                  3.2.2
packaging                 23.1
pandas                    2.0.3
Pillow                    10.0.0
pip                       23.2.1
protobuf                  3.20.0
psutil                    5.9.5
pyarrow                   12.0.1
PyJWT                     2.8.0
python-dateutil           2.8.2
pytz                      2023.3
PyYAML                    6.0.1
referencing               0.30.2
regex                     2023.6.3
requests                  2.31.0
requests-oauthlib         1.3.1
responses                 0.18.0
rfc3339-validator         0.1.4
rfc3987                   1.3.8
rpds-py                   0.9.2
s3transfer                0.6.1
sentencepiece             0.1.99
setuptools                68.0.0
simplejson                3.19.1
six                       1.16.0
smmap                     5.0.0
swagger-spec-validator    3.0.3
sympy                     1.12
tokenizers                0.13.3
torch                     2.0.1
tqdm                      4.65.0
transformers              4.25.0
triton                    2.0.0
typing_extensions         4.7.1
tzdata                    2023.3
uri-template              1.3.0
urllib3                   1.26.16
webcolors                 1.13
websocket-client          1.6.1
wheel                     0.38.4
xxhash                    3.3.0
yarl                      1.9.2

The operating system you're using:

Linux t0048 5.14.0-162.18.1.el9_1.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Mar 1 22:02:24 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

The output of python --version:

Python 3.11.4

Hello @apohllo 👋

I was not able to find the example you mentioned in the Transformers repo.
Were you referring to the examples/pytorch/question-answering/run_seq2seq_qa.py example?

Hello @apohllo ,

This issue has already been reported: #1401

We are working on fixing this. I will update the progress on the original issue above. Requesting you to turn on notifications for the above issue to get notified whenever an update is posted.

Closing this issue now.

Hey @apohllo ,

We just released neptune v1.6.0, which fixes this issue. 🚀

Please let me know if this works for you!