ckadirt commited on
Commit
4d7feec
·
verified ·
1 Parent(s): 33a2d97

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +6 -0
  2. rtme/lib/python3.10/site-packages/babel/locale-data/so.dat +3 -0
  3. rtme/lib/python3.10/site-packages/babel/locale-data/to.dat +3 -0
  4. rtme/lib/python3.10/site-packages/babel/locale-data/vi.dat +3 -0
  5. rtme/lib/python3.10/site-packages/babel/locale-data/yue.dat +3 -0
  6. rtme/lib/python3.10/site-packages/babel/locale-data/zh.dat +3 -0
  7. rtme/lib/python3.10/site-packages/huggingface_hub/__pycache__/lfs.cpython-310.pyc +0 -0
  8. rtme/lib/python3.10/site-packages/huggingface_hub/__pycache__/repocard.cpython-310.pyc +0 -0
  9. rtme/lib/python3.10/site-packages/huggingface_hub/__pycache__/repocard_data.cpython-310.pyc +0 -0
  10. rtme/lib/python3.10/site-packages/huggingface_hub/commands/__init__.py +27 -0
  11. rtme/lib/python3.10/site-packages/huggingface_hub/commands/_cli_utils.py +69 -0
  12. rtme/lib/python3.10/site-packages/huggingface_hub/commands/delete_cache.py +474 -0
  13. rtme/lib/python3.10/site-packages/huggingface_hub/commands/download.py +200 -0
  14. rtme/lib/python3.10/site-packages/huggingface_hub/commands/env.py +36 -0
  15. rtme/lib/python3.10/site-packages/huggingface_hub/commands/lfs.py +200 -0
  16. rtme/lib/python3.10/site-packages/huggingface_hub/inference/__init__.py +0 -0
  17. rtme/lib/python3.10/site-packages/huggingface_hub/inference/__pycache__/__init__.cpython-310.pyc +0 -0
  18. rtme/lib/python3.10/site-packages/huggingface_hub/inference/__pycache__/_common.cpython-310.pyc +0 -0
  19. rtme/lib/python3.10/site-packages/huggingface_hub/inference/_client.py +0 -0
  20. rtme/lib/python3.10/site-packages/huggingface_hub/inference/_common.py +422 -0
  21. rtme/lib/python3.10/site-packages/huggingface_hub/inference/_generated/__init__.py +0 -0
  22. rtme/lib/python3.10/site-packages/huggingface_hub/inference/_generated/__pycache__/__init__.cpython-310.pyc +0 -0
  23. rtme/lib/python3.10/site-packages/huggingface_hub/inference/_generated/__pycache__/_async_client.cpython-310.pyc +3 -0
  24. rtme/lib/python3.10/site-packages/huggingface_hub/inference/_generated/_async_client.py +0 -0
  25. rtme/lib/python3.10/site-packages/huggingface_hub/inference/_generated/types/__pycache__/image_classification.cpython-310.pyc +0 -0
  26. rtme/lib/python3.10/site-packages/huggingface_hub/inference/_generated/types/__pycache__/image_segmentation.cpython-310.pyc +0 -0
  27. rtme/lib/python3.10/site-packages/huggingface_hub/inference/_generated/types/__pycache__/image_to_image.cpython-310.pyc +0 -0
  28. rtme/lib/python3.10/site-packages/huggingface_hub/inference/_generated/types/__pycache__/image_to_text.cpython-310.pyc +0 -0
  29. rtme/lib/python3.10/site-packages/huggingface_hub/inference/_generated/types/__pycache__/object_detection.cpython-310.pyc +0 -0
  30. rtme/lib/python3.10/site-packages/huggingface_hub/inference/_generated/types/__pycache__/sentence_similarity.cpython-310.pyc +0 -0
  31. rtme/lib/python3.10/site-packages/huggingface_hub/inference/_generated/types/__pycache__/summarization.cpython-310.pyc +0 -0
  32. rtme/lib/python3.10/site-packages/huggingface_hub/inference/_generated/types/__pycache__/table_question_answering.cpython-310.pyc +0 -0
  33. rtme/lib/python3.10/site-packages/huggingface_hub/inference/_generated/types/__pycache__/text2text_generation.cpython-310.pyc +0 -0
  34. rtme/lib/python3.10/site-packages/huggingface_hub/inference/_generated/types/__pycache__/text_classification.cpython-310.pyc +0 -0
  35. rtme/lib/python3.10/site-packages/huggingface_hub/inference/_generated/types/audio_to_audio.py +30 -0
  36. rtme/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/_subprocess.cpython-310.pyc +0 -0
  37. rtme/lib/python3.10/site-packages/mpmath-1.3.0.dist-info/METADATA +233 -0
  38. rtme/lib/python3.10/site-packages/mpmath-1.3.0.dist-info/RECORD +94 -0
  39. rtme/lib/python3.10/site-packages/mpmath-1.3.0.dist-info/WHEEL +5 -0
  40. rtme/lib/python3.10/site-packages/nvidia_ml_py-12.570.86.dist-info/INSTALLER +1 -0
  41. rtme/lib/python3.10/site-packages/nvidia_ml_py-12.570.86.dist-info/METADATA +261 -0
  42. rtme/lib/python3.10/site-packages/nvidia_ml_py-12.570.86.dist-info/RECORD +8 -0
  43. rtme/lib/python3.10/site-packages/nvidia_ml_py-12.570.86.dist-info/REQUESTED +0 -0
  44. rtme/lib/python3.10/site-packages/nvidia_ml_py-12.570.86.dist-info/WHEEL +5 -0
  45. rtme/lib/python3.10/site-packages/nvidia_ml_py-12.570.86.dist-info/top_level.txt +2 -0
  46. rtme/lib/python3.10/site-packages/pycparser-2.22.dist-info/INSTALLER +1 -0
  47. rtme/lib/python3.10/site-packages/send2trash/exceptions.py +26 -0
  48. rtme/lib/python3.10/site-packages/send2trash/mac/__init__.py +20 -0
  49. rtme/lib/python3.10/site-packages/send2trash/mac/legacy.py +53 -0
  50. rtme/lib/python3.10/site-packages/send2trash/mac/modern.py +26 -0
.gitattributes CHANGED
@@ -5327,3 +5327,9 @@ rtme/lib/python3.10/site-packages/babel/locale-data/zu.dat filter=lfs diff=lfs m
5327
  rtme/lib/python3.10/site-packages/babel/locale-data/yue_Hans.dat filter=lfs diff=lfs merge=lfs -text
5328
  rtme/lib/python3.10/site-packages/babel/locale-data/uz.dat filter=lfs diff=lfs merge=lfs -text
5329
  rtme/lib/python3.10/site-packages/babel/locale-data/tg.dat filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
5327
  rtme/lib/python3.10/site-packages/babel/locale-data/yue_Hans.dat filter=lfs diff=lfs merge=lfs -text
5328
  rtme/lib/python3.10/site-packages/babel/locale-data/uz.dat filter=lfs diff=lfs merge=lfs -text
5329
  rtme/lib/python3.10/site-packages/babel/locale-data/tg.dat filter=lfs diff=lfs merge=lfs -text
5330
+ rtme/lib/python3.10/site-packages/babel/locale-data/yue.dat filter=lfs diff=lfs merge=lfs -text
5331
+ rtme/lib/python3.10/site-packages/babel/locale-data/zh.dat filter=lfs diff=lfs merge=lfs -text
5332
+ rtme/lib/python3.10/site-packages/babel/locale-data/so.dat filter=lfs diff=lfs merge=lfs -text
5333
+ rtme/lib/python3.10/site-packages/huggingface_hub/inference/_generated/__pycache__/_async_client.cpython-310.pyc filter=lfs diff=lfs merge=lfs -text
5334
+ rtme/lib/python3.10/site-packages/babel/locale-data/vi.dat filter=lfs diff=lfs merge=lfs -text
5335
+ rtme/lib/python3.10/site-packages/babel/locale-data/to.dat filter=lfs diff=lfs merge=lfs -text
rtme/lib/python3.10/site-packages/babel/locale-data/so.dat ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b0016480c83ea9a6588474ff972a1a82067c50cfca5f5c5b4b89a207797928df
3
+ size 166227
rtme/lib/python3.10/site-packages/babel/locale-data/to.dat ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:081afa81182ed2aa3ffa42283a5b8fc2efd9747e3e48f3c91eda3f111703cc70
3
+ size 145255
rtme/lib/python3.10/site-packages/babel/locale-data/vi.dat ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:17de5af9fbcb3c8789a8e970c7882bf539d667456948fcb337027444f735a84f
3
+ size 134138
rtme/lib/python3.10/site-packages/babel/locale-data/yue.dat ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:96f4daa075d25591ea71be54091f0878389544213d211b2b0e486fd1b1b0cc28
3
+ size 143872
rtme/lib/python3.10/site-packages/babel/locale-data/zh.dat ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4a94a499d54de4f5fb08276ca3507e4b241928c0d3c997d9793da5fe48f61682
3
+ size 152100
rtme/lib/python3.10/site-packages/huggingface_hub/__pycache__/lfs.cpython-310.pyc ADDED
Binary file (13.8 kB). View file
 
rtme/lib/python3.10/site-packages/huggingface_hub/__pycache__/repocard.cpython-310.pyc ADDED
Binary file (29.6 kB). View file
 
rtme/lib/python3.10/site-packages/huggingface_hub/__pycache__/repocard_data.cpython-310.pyc ADDED
Binary file (28.7 kB). View file
 
rtme/lib/python3.10/site-packages/huggingface_hub/commands/__init__.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2020 The HuggingFace Team. All rights reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ from abc import ABC, abstractmethod
16
+ from argparse import _SubParsersAction
17
+
18
+
19
+ class BaseHuggingfaceCLICommand(ABC):
20
+ @staticmethod
21
+ @abstractmethod
22
+ def register_subcommand(parser: _SubParsersAction):
23
+ raise NotImplementedError()
24
+
25
+ @abstractmethod
26
+ def run(self):
27
+ raise NotImplementedError()
rtme/lib/python3.10/site-packages/huggingface_hub/commands/_cli_utils.py ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2022 The HuggingFace Team. All rights reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ """Contains a utility for good-looking prints."""
15
+
16
+ import os
17
+ from typing import List, Union
18
+
19
+
20
+ class ANSI:
21
+ """
22
+ Helper for en.wikipedia.org/wiki/ANSI_escape_code
23
+ """
24
+
25
+ _bold = "\u001b[1m"
26
+ _gray = "\u001b[90m"
27
+ _red = "\u001b[31m"
28
+ _reset = "\u001b[0m"
29
+ _yellow = "\u001b[33m"
30
+
31
+ @classmethod
32
+ def bold(cls, s: str) -> str:
33
+ return cls._format(s, cls._bold)
34
+
35
+ @classmethod
36
+ def gray(cls, s: str) -> str:
37
+ return cls._format(s, cls._gray)
38
+
39
+ @classmethod
40
+ def red(cls, s: str) -> str:
41
+ return cls._format(s, cls._bold + cls._red)
42
+
43
+ @classmethod
44
+ def yellow(cls, s: str) -> str:
45
+ return cls._format(s, cls._yellow)
46
+
47
+ @classmethod
48
+ def _format(cls, s: str, code: str) -> str:
49
+ if os.environ.get("NO_COLOR"):
50
+ # See https://no-color.org/
51
+ return s
52
+ return f"{code}{s}{cls._reset}"
53
+
54
+
55
+ def tabulate(rows: List[List[Union[str, int]]], headers: List[str]) -> str:
56
+ """
57
+ Inspired by:
58
+
59
+ - stackoverflow.com/a/8356620/593036
60
+ - stackoverflow.com/questions/9535954/printing-lists-as-tabular-data
61
+ """
62
+ col_widths = [max(len(str(x)) for x in col) for col in zip(*rows, headers)]
63
+ row_format = ("{{:{}}} " * len(headers)).format(*col_widths)
64
+ lines = []
65
+ lines.append(row_format.format(*headers))
66
+ lines.append(row_format.format(*["-" * w for w in col_widths]))
67
+ for row in rows:
68
+ lines.append(row_format.format(*row))
69
+ return "\n".join(lines)
rtme/lib/python3.10/site-packages/huggingface_hub/commands/delete_cache.py ADDED
@@ -0,0 +1,474 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+ # Copyright 2022-present, the HuggingFace Inc. team.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ """Contains command to delete some revisions from the HF cache directory.
16
+
17
+ Usage:
18
+ huggingface-cli delete-cache
19
+ huggingface-cli delete-cache --disable-tui
20
+ huggingface-cli delete-cache --dir ~/.cache/huggingface/hub
21
+ huggingface-cli delete-cache --sort=size
22
+
23
+ NOTE:
24
+ This command is based on `InquirerPy` to build the multiselect menu in the terminal.
25
+ This dependency has to be installed with `pip install huggingface_hub[cli]`. Since
26
+ we want to avoid as much as possible cross-platform issues, I chose a library that
27
+ is built on top of `python-prompt-toolkit` which seems to be a reference in terminal
28
+ GUI (actively maintained on both Unix and Windows, 7.9k stars).
29
+
30
+ For the moment, the TUI feature is in beta.
31
+
32
+ See:
33
+ - https://github.com/kazhala/InquirerPy
34
+ - https://inquirerpy.readthedocs.io/en/latest/
35
+ - https://github.com/prompt-toolkit/python-prompt-toolkit
36
+
37
+ Other solutions could have been:
38
+ - `simple_term_menu`: would be good as well for our use case but some issues suggest
39
+ that Windows is less supported.
40
+ See: https://github.com/IngoMeyer441/simple-term-menu
41
+ - `PyInquirer`: very similar to `InquirerPy` but older and not maintained anymore.
42
+ In particular, no support of Python3.10.
43
+ See: https://github.com/CITGuru/PyInquirer
44
+ - `pick` (or `pickpack`): easy to use and flexible but built on top of Python's
45
+ standard library `curses` that is specific to Unix (not implemented on Windows).
46
+ See https://github.com/wong2/pick and https://github.com/anafvana/pickpack.
47
+ - `inquirer`: lot of traction (700 stars) but explicitly states "experimental
48
+ support of Windows". Not built on top of `python-prompt-toolkit`.
49
+ See https://github.com/magmax/python-inquirer
50
+
51
+ TODO: add support for `huggingface-cli delete-cache aaaaaa bbbbbb cccccc (...)` ?
52
+ TODO: add "--keep-last" arg to delete revisions that are not on `main` ref
53
+ TODO: add "--filter" arg to filter repositories by name ?
54
+ TODO: add "--limit" arg to limit to X repos ?
55
+ TODO: add "-y" arg for immediate deletion ?
56
+ See discussions in https://github.com/huggingface/huggingface_hub/issues/1025.
57
+ """
58
+
59
+ import os
60
+ from argparse import Namespace, _SubParsersAction
61
+ from functools import wraps
62
+ from tempfile import mkstemp
63
+ from typing import Any, Callable, Iterable, List, Literal, Optional, Union
64
+
65
+ from ..utils import CachedRepoInfo, CachedRevisionInfo, HFCacheInfo, scan_cache_dir
66
+ from . import BaseHuggingfaceCLICommand
67
+ from ._cli_utils import ANSI
68
+
69
+
70
+ try:
71
+ from InquirerPy import inquirer
72
+ from InquirerPy.base.control import Choice
73
+ from InquirerPy.separator import Separator
74
+
75
+ _inquirer_py_available = True
76
+ except ImportError:
77
+ _inquirer_py_available = False
78
+
79
+ SortingOption_T = Literal["alphabetical", "lastUpdated", "lastUsed", "size"]
80
+
81
+
82
+ def require_inquirer_py(fn: Callable) -> Callable:
83
+ """Decorator to flag methods that require `InquirerPy`."""
84
+
85
+ # TODO: refactor this + imports in a unified pattern across codebase
86
+ @wraps(fn)
87
+ def _inner(*args, **kwargs):
88
+ if not _inquirer_py_available:
89
+ raise ImportError(
90
+ "The `delete-cache` command requires extra dependencies to work with"
91
+ " the TUI.\nPlease run `pip install huggingface_hub[cli]` to install"
92
+ " them.\nOtherwise, disable TUI using the `--disable-tui` flag."
93
+ )
94
+
95
+ return fn(*args, **kwargs)
96
+
97
+ return _inner
98
+
99
+
100
+ # Possibility for the user to cancel deletion
101
+ _CANCEL_DELETION_STR = "CANCEL_DELETION"
102
+
103
+
104
+ class DeleteCacheCommand(BaseHuggingfaceCLICommand):
105
+ @staticmethod
106
+ def register_subcommand(parser: _SubParsersAction):
107
+ delete_cache_parser = parser.add_parser("delete-cache", help="Delete revisions from the cache directory.")
108
+
109
+ delete_cache_parser.add_argument(
110
+ "--dir",
111
+ type=str,
112
+ default=None,
113
+ help="cache directory (optional). Default to the default HuggingFace cache.",
114
+ )
115
+
116
+ delete_cache_parser.add_argument(
117
+ "--disable-tui",
118
+ action="store_true",
119
+ help=(
120
+ "Disable Terminal User Interface (TUI) mode. Useful if your"
121
+ " platform/terminal doesn't support the multiselect menu."
122
+ ),
123
+ )
124
+
125
+ delete_cache_parser.add_argument(
126
+ "--sort",
127
+ nargs="?",
128
+ choices=["alphabetical", "lastUpdated", "lastUsed", "size"],
129
+ help=(
130
+ "Sort repositories by the specified criteria. Options: "
131
+ "'alphabetical' (A-Z), "
132
+ "'lastUpdated' (newest first), "
133
+ "'lastUsed' (most recent first), "
134
+ "'size' (largest first)."
135
+ ),
136
+ )
137
+
138
+ delete_cache_parser.set_defaults(func=DeleteCacheCommand)
139
+
140
+ def __init__(self, args: Namespace) -> None:
141
+ self.cache_dir: Optional[str] = args.dir
142
+ self.disable_tui: bool = args.disable_tui
143
+ self.sort_by: Optional[SortingOption_T] = args.sort
144
+
145
+ def run(self):
146
+ """Run `delete-cache` command with or without TUI."""
147
+ # Scan cache directory
148
+ hf_cache_info = scan_cache_dir(self.cache_dir)
149
+
150
+ # Manual review from the user
151
+ if self.disable_tui:
152
+ selected_hashes = _manual_review_no_tui(hf_cache_info, preselected=[], sort_by=self.sort_by)
153
+ else:
154
+ selected_hashes = _manual_review_tui(hf_cache_info, preselected=[], sort_by=self.sort_by)
155
+
156
+ # If deletion is not cancelled
157
+ if len(selected_hashes) > 0 and _CANCEL_DELETION_STR not in selected_hashes:
158
+ confirm_message = _get_expectations_str(hf_cache_info, selected_hashes) + " Confirm deletion ?"
159
+
160
+ # Confirm deletion
161
+ if self.disable_tui:
162
+ confirmed = _ask_for_confirmation_no_tui(confirm_message)
163
+ else:
164
+ confirmed = _ask_for_confirmation_tui(confirm_message)
165
+
166
+ # Deletion is confirmed
167
+ if confirmed:
168
+ strategy = hf_cache_info.delete_revisions(*selected_hashes)
169
+ print("Start deletion.")
170
+ strategy.execute()
171
+ print(
172
+ f"Done. Deleted {len(strategy.repos)} repo(s) and"
173
+ f" {len(strategy.snapshots)} revision(s) for a total of"
174
+ f" {strategy.expected_freed_size_str}."
175
+ )
176
+ return
177
+
178
+ # Deletion is cancelled
179
+ print("Deletion is cancelled. Do nothing.")
180
+
181
+
182
+ def _get_repo_sorting_key(repo: CachedRepoInfo, sort_by: Optional[SortingOption_T] = None):
183
+ if sort_by == "alphabetical":
184
+ return (repo.repo_type, repo.repo_id.lower()) # by type then name
185
+ elif sort_by == "lastUpdated":
186
+ return -max(rev.last_modified for rev in repo.revisions) # newest first
187
+ elif sort_by == "lastUsed":
188
+ return -repo.last_accessed # most recently used first
189
+ elif sort_by == "size":
190
+ return -repo.size_on_disk # largest first
191
+ else:
192
+ return (repo.repo_type, repo.repo_id) # default stable order
193
+
194
+
195
+ @require_inquirer_py
196
+ def _manual_review_tui(
197
+ hf_cache_info: HFCacheInfo,
198
+ preselected: List[str],
199
+ sort_by: Optional[SortingOption_T] = None,
200
+ ) -> List[str]:
201
+ """Ask the user for a manual review of the revisions to delete.
202
+
203
+ Displays a multi-select menu in the terminal (TUI).
204
+ """
205
+ # Define multiselect list
206
+ choices = _get_tui_choices_from_scan(
207
+ repos=hf_cache_info.repos,
208
+ preselected=preselected,
209
+ sort_by=sort_by,
210
+ )
211
+ checkbox = inquirer.checkbox(
212
+ message="Select revisions to delete:",
213
+ choices=choices, # List of revisions with some pre-selection
214
+ cycle=False, # No loop between top and bottom
215
+ height=100, # Large list if possible
216
+ # We use the instruction to display to the user the expected effect of the
217
+ # deletion.
218
+ instruction=_get_expectations_str(
219
+ hf_cache_info,
220
+ selected_hashes=[c.value for c in choices if isinstance(c, Choice) and c.enabled],
221
+ ),
222
+ # We use the long instruction to should keybindings instructions to the user
223
+ long_instruction="Press <space> to select, <enter> to validate and <ctrl+c> to quit without modification.",
224
+ # Message that is displayed once the user validates its selection.
225
+ transformer=lambda result: f"{len(result)} revision(s) selected.",
226
+ )
227
+
228
+ # Add a callback to update the information line when a revision is
229
+ # selected/unselected
230
+ def _update_expectations(_) -> None:
231
+ # Hacky way to dynamically set an instruction message to the checkbox when
232
+ # a revision hash is selected/unselected.
233
+ checkbox._instruction = _get_expectations_str(
234
+ hf_cache_info,
235
+ selected_hashes=[choice["value"] for choice in checkbox.content_control.choices if choice["enabled"]],
236
+ )
237
+
238
+ checkbox.kb_func_lookup["toggle"].append({"func": _update_expectations})
239
+
240
+ # Finally display the form to the user.
241
+ try:
242
+ return checkbox.execute()
243
+ except KeyboardInterrupt:
244
+ return [] # Quit without deletion
245
+
246
+
247
+ @require_inquirer_py
248
+ def _ask_for_confirmation_tui(message: str, default: bool = True) -> bool:
249
+ """Ask for confirmation using Inquirer."""
250
+ return inquirer.confirm(message, default=default).execute()
251
+
252
+
253
+ def _get_tui_choices_from_scan(
254
+ repos: Iterable[CachedRepoInfo],
255
+ preselected: List[str],
256
+ sort_by: Optional[SortingOption_T] = None,
257
+ ) -> List:
258
+ """Build a list of choices from the scanned repos.
259
+
260
+ Args:
261
+ repos (*Iterable[`CachedRepoInfo`]*):
262
+ List of scanned repos on which we want to delete revisions.
263
+ preselected (*List[`str`]*):
264
+ List of revision hashes that will be preselected.
265
+ sort_by (*Optional[SortingOption_T]*):
266
+ Sorting direction. Choices: "alphabetical", "lastUpdated", "lastUsed", "size".
267
+
268
+ Return:
269
+ The list of choices to pass to `inquirer.checkbox`.
270
+ """
271
+ choices: List[Union[Choice, Separator]] = []
272
+
273
+ # First choice is to cancel the deletion
274
+ choices.append(
275
+ Choice(
276
+ _CANCEL_DELETION_STR,
277
+ name="None of the following (if selected, nothing will be deleted).",
278
+ enabled=False,
279
+ )
280
+ )
281
+
282
+ # Sort repos based on specified criteria
283
+ sorted_repos = sorted(repos, key=lambda repo: _get_repo_sorting_key(repo, sort_by))
284
+
285
+ for repo in sorted_repos:
286
+ # Repo as separator
287
+ choices.append(
288
+ Separator(
289
+ f"\n{repo.repo_type.capitalize()} {repo.repo_id} ({repo.size_on_disk_str},"
290
+ f" used {repo.last_accessed_str})"
291
+ )
292
+ )
293
+ for revision in sorted(repo.revisions, key=_revision_sorting_order):
294
+ # Revision as choice
295
+ choices.append(
296
+ Choice(
297
+ revision.commit_hash,
298
+ name=(
299
+ f"{revision.commit_hash[:8]}:"
300
+ f" {', '.join(sorted(revision.refs)) or '(detached)'} #"
301
+ f" modified {revision.last_modified_str}"
302
+ ),
303
+ enabled=revision.commit_hash in preselected,
304
+ )
305
+ )
306
+
307
+ # Return choices
308
+ return choices
309
+
310
+
311
+ def _manual_review_no_tui(
312
+ hf_cache_info: HFCacheInfo,
313
+ preselected: List[str],
314
+ sort_by: Optional[SortingOption_T] = None,
315
+ ) -> List[str]:
316
+ """Ask the user for a manual review of the revisions to delete.
317
+
318
+ Used when TUI is disabled. Manual review happens in a separate tmp file that the
319
+ user can manually edit.
320
+ """
321
+ # 1. Generate temporary file with delete commands.
322
+ fd, tmp_path = mkstemp(suffix=".txt") # suffix to make it easier to find by editors
323
+ os.close(fd)
324
+
325
+ lines = []
326
+
327
+ sorted_repos = sorted(hf_cache_info.repos, key=lambda repo: _get_repo_sorting_key(repo, sort_by))
328
+
329
+ for repo in sorted_repos:
330
+ lines.append(
331
+ f"\n# {repo.repo_type.capitalize()} {repo.repo_id} ({repo.size_on_disk_str},"
332
+ f" used {repo.last_accessed_str})"
333
+ )
334
+ for revision in sorted(repo.revisions, key=_revision_sorting_order):
335
+ lines.append(
336
+ # Deselect by prepending a '#'
337
+ f"{'' if revision.commit_hash in preselected else '#'} "
338
+ f" {revision.commit_hash} # Refs:"
339
+ # Print `refs` as comment on same line
340
+ f" {', '.join(sorted(revision.refs)) or '(detached)'} # modified"
341
+ # Print `last_modified` as comment on same line
342
+ f" {revision.last_modified_str}"
343
+ )
344
+
345
+ with open(tmp_path, "w") as f:
346
+ f.write(_MANUAL_REVIEW_NO_TUI_INSTRUCTIONS)
347
+ f.write("\n".join(lines))
348
+
349
+ # 2. Prompt instructions to user.
350
+ instructions = f"""
351
+ TUI is disabled. In order to select which revisions you want to delete, please edit
352
+ the following file using the text editor of your choice. Instructions for manual
353
+ editing are located at the beginning of the file. Edit the file, save it and confirm
354
+ to continue.
355
+ File to edit: {ANSI.bold(tmp_path)}
356
+ """
357
+ print("\n".join(line.strip() for line in instructions.strip().split("\n")))
358
+
359
+ # 3. Wait for user confirmation.
360
+ while True:
361
+ selected_hashes = _read_manual_review_tmp_file(tmp_path)
362
+ if _ask_for_confirmation_no_tui(
363
+ _get_expectations_str(hf_cache_info, selected_hashes) + " Continue ?",
364
+ default=False,
365
+ ):
366
+ break
367
+
368
+ # 4. Return selected_hashes sorted to maintain stable order
369
+ os.remove(tmp_path)
370
+ return sorted(selected_hashes) # Sort to maintain stable order
371
+
372
+
373
+ def _ask_for_confirmation_no_tui(message: str, default: bool = True) -> bool:
374
+ """Ask for confirmation using pure-python."""
375
+ YES = ("y", "yes", "1")
376
+ NO = ("n", "no", "0")
377
+ DEFAULT = ""
378
+ ALL = YES + NO + (DEFAULT,)
379
+ full_message = message + (" (Y/n) " if default else " (y/N) ")
380
+ while True:
381
+ answer = input(full_message).lower()
382
+ if answer == DEFAULT:
383
+ return default
384
+ if answer in YES:
385
+ return True
386
+ if answer in NO:
387
+ return False
388
+ print(f"Invalid input. Must be one of {ALL}")
389
+
390
+
391
+ def _get_expectations_str(hf_cache_info: HFCacheInfo, selected_hashes: List[str]) -> str:
392
+ """Format a string to display to the user how much space would be saved.
393
+
394
+ Example:
395
+ ```
396
+ >>> _get_expectations_str(hf_cache_info, selected_hashes)
397
+ '7 revisions selected counting for 4.3G.'
398
+ ```
399
+ """
400
+ if _CANCEL_DELETION_STR in selected_hashes:
401
+ return "Nothing will be deleted."
402
+ strategy = hf_cache_info.delete_revisions(*selected_hashes)
403
+ return f"{len(selected_hashes)} revisions selected counting for {strategy.expected_freed_size_str}."
404
+
405
+
406
+ def _read_manual_review_tmp_file(tmp_path: str) -> List[str]:
407
+ """Read the manually reviewed instruction file and return a list of revision hash.
408
+
409
+ Example:
410
+ ```txt
411
+ # This is the tmp file content
412
+ ###
413
+
414
+ # Commented out line
415
+ 123456789 # revision hash
416
+
417
+ # Something else
418
+ # a_newer_hash # 2 days ago
419
+ an_older_hash # 3 days ago
420
+ ```
421
+
422
+ ```py
423
+ >>> _read_manual_review_tmp_file(tmp_path)
424
+ ['123456789', 'an_older_hash']
425
+ ```
426
+ """
427
+ with open(tmp_path) as f:
428
+ content = f.read()
429
+
430
+ # Split lines
431
+ lines = [line.strip() for line in content.split("\n")]
432
+
433
+ # Filter commented lines
434
+ selected_lines = [line for line in lines if not line.startswith("#")]
435
+
436
+ # Select only before comment
437
+ selected_hashes = [line.split("#")[0].strip() for line in selected_lines]
438
+
439
+ # Return revision hashes
440
+ return [hash for hash in selected_hashes if len(hash) > 0]
441
+
442
+
443
+ _MANUAL_REVIEW_NO_TUI_INSTRUCTIONS = f"""
444
+ # INSTRUCTIONS
445
+ # ------------
446
+ # This is a temporary file created by running `huggingface-cli delete-cache` with the
447
+ # `--disable-tui` option. It contains a set of revisions that can be deleted from your
448
+ # local cache directory.
449
+ #
450
+ # Please manually review the revisions you want to delete:
451
+ # - Revision hashes can be commented out with '#'.
452
+ # - Only non-commented revisions in this file will be deleted.
453
+ # - Revision hashes that are removed from this file are ignored as well.
454
+ # - If `{_CANCEL_DELETION_STR}` line is uncommented, the all cache deletion is cancelled and
455
+ # no changes will be applied.
456
+ #
457
+ # Once you've manually reviewed this file, please confirm deletion in the terminal. This
458
+ # file will be automatically removed once done.
459
+ # ------------
460
+
461
+ # KILL SWITCH
462
+ # ------------
463
+ # Un-comment following line to completely cancel the deletion process
464
+ # {_CANCEL_DELETION_STR}
465
+ # ------------
466
+
467
+ # REVISIONS
468
+ # ------------
469
+ """.strip()
470
+
471
+
472
+ def _revision_sorting_order(revision: CachedRevisionInfo) -> Any:
473
+ # Sort by last modified (oldest first)
474
+ return revision.last_modified
rtme/lib/python3.10/site-packages/huggingface_hub/commands/download.py ADDED
@@ -0,0 +1,200 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+ # Copyright 2023-present, the HuggingFace Inc. team.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ """Contains command to download files from the Hub with the CLI.
16
+
17
+ Usage:
18
+ huggingface-cli download --help
19
+
20
+ # Download file
21
+ huggingface-cli download gpt2 config.json
22
+
23
+ # Download entire repo
24
+ huggingface-cli download fffiloni/zeroscope --repo-type=space --revision=refs/pr/78
25
+
26
+ # Download repo with filters
27
+ huggingface-cli download gpt2 --include="*.safetensors"
28
+
29
+ # Download with token
30
+ huggingface-cli download Wauplin/private-model --token=hf_***
31
+
32
+ # Download quietly (no progress bar, no warnings, only the returned path)
33
+ huggingface-cli download gpt2 config.json --quiet
34
+
35
+ # Download to local dir
36
+ huggingface-cli download gpt2 --local-dir=./models/gpt2
37
+ """
38
+
39
+ import warnings
40
+ from argparse import Namespace, _SubParsersAction
41
+ from typing import List, Optional
42
+
43
+ from huggingface_hub import logging
44
+ from huggingface_hub._snapshot_download import snapshot_download
45
+ from huggingface_hub.commands import BaseHuggingfaceCLICommand
46
+ from huggingface_hub.file_download import hf_hub_download
47
+ from huggingface_hub.utils import disable_progress_bars, enable_progress_bars
48
+
49
+
50
+ logger = logging.get_logger(__name__)
51
+
52
+
53
+ class DownloadCommand(BaseHuggingfaceCLICommand):
54
+ @staticmethod
55
+ def register_subcommand(parser: _SubParsersAction):
56
+ download_parser = parser.add_parser("download", help="Download files from the Hub")
57
+ download_parser.add_argument(
58
+ "repo_id", type=str, help="ID of the repo to download from (e.g. `username/repo-name`)."
59
+ )
60
+ download_parser.add_argument(
61
+ "filenames", type=str, nargs="*", help="Files to download (e.g. `config.json`, `data/metadata.jsonl`)."
62
+ )
63
+ download_parser.add_argument(
64
+ "--repo-type",
65
+ choices=["model", "dataset", "space"],
66
+ default="model",
67
+ help="Type of repo to download from (defaults to 'model').",
68
+ )
69
+ download_parser.add_argument(
70
+ "--revision",
71
+ type=str,
72
+ help="An optional Git revision id which can be a branch name, a tag, or a commit hash.",
73
+ )
74
+ download_parser.add_argument(
75
+ "--include", nargs="*", type=str, help="Glob patterns to match files to download."
76
+ )
77
+ download_parser.add_argument(
78
+ "--exclude", nargs="*", type=str, help="Glob patterns to exclude from files to download."
79
+ )
80
+ download_parser.add_argument(
81
+ "--cache-dir", type=str, help="Path to the directory where to save the downloaded files."
82
+ )
83
+ download_parser.add_argument(
84
+ "--local-dir",
85
+ type=str,
86
+ help=(
87
+ "If set, the downloaded file will be placed under this directory. Check out"
88
+ " https://huggingface.co/docs/huggingface_hub/guides/download#download-files-to-local-folder for more"
89
+ " details."
90
+ ),
91
+ )
92
+ download_parser.add_argument(
93
+ "--local-dir-use-symlinks",
94
+ choices=["auto", "True", "False"],
95
+ help=("Deprecated and ignored. Downloading to a local directory does not use symlinks anymore."),
96
+ )
97
+ download_parser.add_argument(
98
+ "--force-download",
99
+ action="store_true",
100
+ help="If True, the files will be downloaded even if they are already cached.",
101
+ )
102
+ download_parser.add_argument(
103
+ "--resume-download",
104
+ action="store_true",
105
+ help="Deprecated and ignored. Downloading a file to local dir always attempts to resume previously interrupted downloads (unless hf-transfer is enabled).",
106
+ )
107
+ download_parser.add_argument(
108
+ "--token", type=str, help="A User Access Token generated from https://huggingface.co/settings/tokens"
109
+ )
110
+ download_parser.add_argument(
111
+ "--quiet",
112
+ action="store_true",
113
+ help="If True, progress bars are disabled and only the path to the download files is printed.",
114
+ )
115
+ download_parser.add_argument(
116
+ "--max-workers",
117
+ type=int,
118
+ default=8,
119
+ help="Maximum number of workers to use for downloading files. Default is 8.",
120
+ )
121
+ download_parser.set_defaults(func=DownloadCommand)
122
+
123
+ def __init__(self, args: Namespace) -> None:
124
+ self.token = args.token
125
+ self.repo_id: str = args.repo_id
126
+ self.filenames: List[str] = args.filenames
127
+ self.repo_type: str = args.repo_type
128
+ self.revision: Optional[str] = args.revision
129
+ self.include: Optional[List[str]] = args.include
130
+ self.exclude: Optional[List[str]] = args.exclude
131
+ self.cache_dir: Optional[str] = args.cache_dir
132
+ self.local_dir: Optional[str] = args.local_dir
133
+ self.force_download: bool = args.force_download
134
+ self.resume_download: Optional[bool] = args.resume_download or None
135
+ self.quiet: bool = args.quiet
136
+ self.max_workers: int = args.max_workers
137
+
138
+ if args.local_dir_use_symlinks is not None:
139
+ warnings.warn(
140
+ "Ignoring --local-dir-use-symlinks. Downloading to a local directory does not use symlinks anymore.",
141
+ FutureWarning,
142
+ )
143
+
144
+ def run(self) -> None:
145
+ if self.quiet:
146
+ disable_progress_bars()
147
+ with warnings.catch_warnings():
148
+ warnings.simplefilter("ignore")
149
+ print(self._download()) # Print path to downloaded files
150
+ enable_progress_bars()
151
+ else:
152
+ logging.set_verbosity_info()
153
+ print(self._download()) # Print path to downloaded files
154
+ logging.set_verbosity_warning()
155
+
156
+ def _download(self) -> str:
157
+ # Warn user if patterns are ignored
158
+ if len(self.filenames) > 0:
159
+ if self.include is not None and len(self.include) > 0:
160
+ warnings.warn("Ignoring `--include` since filenames have being explicitly set.")
161
+ if self.exclude is not None and len(self.exclude) > 0:
162
+ warnings.warn("Ignoring `--exclude` since filenames have being explicitly set.")
163
+
164
+ # Single file to download: use `hf_hub_download`
165
+ if len(self.filenames) == 1:
166
+ return hf_hub_download(
167
+ repo_id=self.repo_id,
168
+ repo_type=self.repo_type,
169
+ revision=self.revision,
170
+ filename=self.filenames[0],
171
+ cache_dir=self.cache_dir,
172
+ resume_download=self.resume_download,
173
+ force_download=self.force_download,
174
+ token=self.token,
175
+ local_dir=self.local_dir,
176
+ library_name="huggingface-cli",
177
+ )
178
+
179
+ # Otherwise: use `snapshot_download` to ensure all files comes from same revision
180
+ elif len(self.filenames) == 0:
181
+ allow_patterns = self.include
182
+ ignore_patterns = self.exclude
183
+ else:
184
+ allow_patterns = self.filenames
185
+ ignore_patterns = None
186
+
187
+ return snapshot_download(
188
+ repo_id=self.repo_id,
189
+ repo_type=self.repo_type,
190
+ revision=self.revision,
191
+ allow_patterns=allow_patterns,
192
+ ignore_patterns=ignore_patterns,
193
+ resume_download=self.resume_download,
194
+ force_download=self.force_download,
195
+ cache_dir=self.cache_dir,
196
+ token=self.token,
197
+ local_dir=self.local_dir,
198
+ library_name="huggingface-cli",
199
+ max_workers=self.max_workers,
200
+ )
rtme/lib/python3.10/site-packages/huggingface_hub/commands/env.py ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2022 The HuggingFace Team. All rights reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ """Contains command to print information about the environment.
15
+
16
+ Usage:
17
+ huggingface-cli env
18
+ """
19
+
20
+ from argparse import _SubParsersAction
21
+
22
+ from ..utils import dump_environment_info
23
+ from . import BaseHuggingfaceCLICommand
24
+
25
+
26
+ class EnvironmentCommand(BaseHuggingfaceCLICommand):
27
+ def __init__(self, args):
28
+ self.args = args
29
+
30
+ @staticmethod
31
+ def register_subcommand(parser: _SubParsersAction):
32
+ env_parser = parser.add_parser("env", help="Print information about the environment.")
33
+ env_parser.set_defaults(func=EnvironmentCommand)
34
+
35
+ def run(self) -> None:
36
+ dump_environment_info()
rtme/lib/python3.10/site-packages/huggingface_hub/commands/lfs.py ADDED
@@ -0,0 +1,200 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Implementation of a custom transfer agent for the transfer type "multipart" for
3
+ git-lfs.
4
+
5
+ Inspired by:
6
+ github.com/cbartz/git-lfs-swift-transfer-agent/blob/master/git_lfs_swift_transfer.py
7
+
8
+ Spec is: github.com/git-lfs/git-lfs/blob/master/docs/custom-transfers.md
9
+
10
+
11
+ To launch debugger while developing:
12
+
13
+ ``` [lfs "customtransfer.multipart"]
14
+ path = /path/to/huggingface_hub/.env/bin/python args = -m debugpy --listen 5678
15
+ --wait-for-client
16
+ /path/to/huggingface_hub/src/huggingface_hub/commands/huggingface_cli.py
17
+ lfs-multipart-upload ```"""
18
+
19
+ import json
20
+ import os
21
+ import subprocess
22
+ import sys
23
+ from argparse import _SubParsersAction
24
+ from typing import Dict, List, Optional
25
+
26
+ from huggingface_hub.commands import BaseHuggingfaceCLICommand
27
+ from huggingface_hub.lfs import LFS_MULTIPART_UPLOAD_COMMAND
28
+
29
+ from ..utils import get_session, hf_raise_for_status, logging
30
+ from ..utils._lfs import SliceFileObj
31
+
32
+
33
+ logger = logging.get_logger(__name__)
34
+
35
+
36
+ class LfsCommands(BaseHuggingfaceCLICommand):
37
+ """
38
+ Implementation of a custom transfer agent for the transfer type "multipart"
39
+ for git-lfs. This lets users upload large files >5GB 🔥. Spec for LFS custom
40
+ transfer agent is:
41
+ https://github.com/git-lfs/git-lfs/blob/master/docs/custom-transfers.md
42
+
43
+ This introduces two commands to the CLI:
44
+
45
+ 1. $ huggingface-cli lfs-enable-largefiles
46
+
47
+ This should be executed once for each model repo that contains a model file
48
+ >5GB. It's documented in the error message you get if you just try to git
49
+ push a 5GB file without having enabled it before.
50
+
51
+ 2. $ huggingface-cli lfs-multipart-upload
52
+
53
+ This command is called by lfs directly and is not meant to be called by the
54
+ user.
55
+ """
56
+
57
+ @staticmethod
58
+ def register_subcommand(parser: _SubParsersAction):
59
+ enable_parser = parser.add_parser(
60
+ "lfs-enable-largefiles", help="Configure your repository to enable upload of files > 5GB."
61
+ )
62
+ enable_parser.add_argument("path", type=str, help="Local path to repository you want to configure.")
63
+ enable_parser.set_defaults(func=lambda args: LfsEnableCommand(args))
64
+
65
+ # Command will get called by git-lfs, do not call it directly.
66
+ upload_parser = parser.add_parser(LFS_MULTIPART_UPLOAD_COMMAND, add_help=False)
67
+ upload_parser.set_defaults(func=lambda args: LfsUploadCommand(args))
68
+
69
+
70
+ class LfsEnableCommand:
71
+ def __init__(self, args):
72
+ self.args = args
73
+
74
+ def run(self):
75
+ local_path = os.path.abspath(self.args.path)
76
+ if not os.path.isdir(local_path):
77
+ print("This does not look like a valid git repo.")
78
+ exit(1)
79
+ subprocess.run(
80
+ "git config lfs.customtransfer.multipart.path huggingface-cli".split(),
81
+ check=True,
82
+ cwd=local_path,
83
+ )
84
+ subprocess.run(
85
+ f"git config lfs.customtransfer.multipart.args {LFS_MULTIPART_UPLOAD_COMMAND}".split(),
86
+ check=True,
87
+ cwd=local_path,
88
+ )
89
+ print("Local repo set up for largefiles")
90
+
91
+
92
+ def write_msg(msg: Dict):
93
+ """Write out the message in Line delimited JSON."""
94
+ msg_str = json.dumps(msg) + "\n"
95
+ sys.stdout.write(msg_str)
96
+ sys.stdout.flush()
97
+
98
+
99
+ def read_msg() -> Optional[Dict]:
100
+ """Read Line delimited JSON from stdin."""
101
+ msg = json.loads(sys.stdin.readline().strip())
102
+
103
+ if "terminate" in (msg.get("type"), msg.get("event")):
104
+ # terminate message received
105
+ return None
106
+
107
+ if msg.get("event") not in ("download", "upload"):
108
+ logger.critical("Received unexpected message")
109
+ sys.exit(1)
110
+
111
+ return msg
112
+
113
+
114
+ class LfsUploadCommand:
115
+ def __init__(self, args) -> None:
116
+ self.args = args
117
+
118
+ def run(self) -> None:
119
+ # Immediately after invoking a custom transfer process, git-lfs
120
+ # sends initiation data to the process over stdin.
121
+ # This tells the process useful information about the configuration.
122
+ init_msg = json.loads(sys.stdin.readline().strip())
123
+ if not (init_msg.get("event") == "init" and init_msg.get("operation") == "upload"):
124
+ write_msg({"error": {"code": 32, "message": "Wrong lfs init operation"}})
125
+ sys.exit(1)
126
+
127
+ # The transfer process should use the information it needs from the
128
+ # initiation structure, and also perform any one-off setup tasks it
129
+ # needs to do. It should then respond on stdout with a simple empty
130
+ # confirmation structure, as follows:
131
+ write_msg({})
132
+
133
+ # After the initiation exchange, git-lfs will send any number of
134
+ # transfer requests to the stdin of the transfer process, in a serial sequence.
135
+ while True:
136
+ msg = read_msg()
137
+ if msg is None:
138
+ # When all transfers have been processed, git-lfs will send
139
+ # a terminate event to the stdin of the transfer process.
140
+ # On receiving this message the transfer process should
141
+ # clean up and terminate. No response is expected.
142
+ sys.exit(0)
143
+
144
+ oid = msg["oid"]
145
+ filepath = msg["path"]
146
+ completion_url = msg["action"]["href"]
147
+ header = msg["action"]["header"]
148
+ chunk_size = int(header.pop("chunk_size"))
149
+ presigned_urls: List[str] = list(header.values())
150
+
151
+ # Send a "started" progress event to allow other workers to start.
152
+ # Otherwise they're delayed until first "progress" event is reported,
153
+ # i.e. after the first 5GB by default (!)
154
+ write_msg(
155
+ {
156
+ "event": "progress",
157
+ "oid": oid,
158
+ "bytesSoFar": 1,
159
+ "bytesSinceLast": 0,
160
+ }
161
+ )
162
+
163
+ parts = []
164
+ with open(filepath, "rb") as file:
165
+ for i, presigned_url in enumerate(presigned_urls):
166
+ with SliceFileObj(
167
+ file,
168
+ seek_from=i * chunk_size,
169
+ read_limit=chunk_size,
170
+ ) as data:
171
+ r = get_session().put(presigned_url, data=data)
172
+ hf_raise_for_status(r)
173
+ parts.append(
174
+ {
175
+ "etag": r.headers.get("etag"),
176
+ "partNumber": i + 1,
177
+ }
178
+ )
179
+ # In order to support progress reporting while data is uploading / downloading,
180
+ # the transfer process should post messages to stdout
181
+ write_msg(
182
+ {
183
+ "event": "progress",
184
+ "oid": oid,
185
+ "bytesSoFar": (i + 1) * chunk_size,
186
+ "bytesSinceLast": chunk_size,
187
+ }
188
+ )
189
+ # Not precise but that's ok.
190
+
191
+ r = get_session().post(
192
+ completion_url,
193
+ json={
194
+ "oid": oid,
195
+ "parts": parts,
196
+ },
197
+ )
198
+ hf_raise_for_status(r)
199
+
200
+ write_msg({"event": "complete", "oid": oid})
rtme/lib/python3.10/site-packages/huggingface_hub/inference/__init__.py ADDED
File without changes
rtme/lib/python3.10/site-packages/huggingface_hub/inference/__pycache__/__init__.cpython-310.pyc ADDED
Binary file (175 Bytes). View file
 
rtme/lib/python3.10/site-packages/huggingface_hub/inference/__pycache__/_common.cpython-310.pyc ADDED
Binary file (11.2 kB). View file
 
rtme/lib/python3.10/site-packages/huggingface_hub/inference/_client.py ADDED
The diff for this file is too large to render. See raw diff
 
rtme/lib/python3.10/site-packages/huggingface_hub/inference/_common.py ADDED
@@ -0,0 +1,422 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+ # Copyright 2023-present, the HuggingFace Inc. team.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ """Contains utilities used by both the sync and async inference clients."""
16
+
17
+ import base64
18
+ import io
19
+ import json
20
+ import logging
21
+ from contextlib import contextmanager
22
+ from dataclasses import dataclass
23
+ from pathlib import Path
24
+ from typing import (
25
+ TYPE_CHECKING,
26
+ Any,
27
+ AsyncIterable,
28
+ BinaryIO,
29
+ ContextManager,
30
+ Dict,
31
+ Generator,
32
+ Iterable,
33
+ List,
34
+ Literal,
35
+ NoReturn,
36
+ Optional,
37
+ Union,
38
+ overload,
39
+ )
40
+
41
+ from requests import HTTPError
42
+
43
+ from huggingface_hub.errors import (
44
+ GenerationError,
45
+ IncompleteGenerationError,
46
+ OverloadedError,
47
+ TextGenerationError,
48
+ UnknownError,
49
+ ValidationError,
50
+ )
51
+
52
+ from ..utils import get_session, is_aiohttp_available, is_numpy_available, is_pillow_available
53
+ from ._generated.types import ChatCompletionStreamOutput, TextGenerationStreamOutput
54
+
55
+
56
+ if TYPE_CHECKING:
57
+ from aiohttp import ClientResponse, ClientSession
58
+ from PIL.Image import Image
59
+
60
+ # TYPES
61
+ UrlT = str
62
+ PathT = Union[str, Path]
63
+ BinaryT = Union[bytes, BinaryIO]
64
+ ContentT = Union[BinaryT, PathT, UrlT]
65
+
66
+ # Use to set a Accept: image/png header
67
+ TASKS_EXPECTING_IMAGES = {"text-to-image", "image-to-image"}
68
+
69
+ logger = logging.getLogger(__name__)
70
+
71
+
72
+ @dataclass
73
+ class RequestParameters:
74
+ url: str
75
+ task: str
76
+ model: Optional[str]
77
+ json: Optional[Union[str, Dict, List]]
78
+ data: Optional[ContentT]
79
+ headers: Dict[str, Any]
80
+
81
+
82
+ # Add dataclass for ModelStatus. We use this dataclass in get_model_status function.
83
+ @dataclass
84
+ class ModelStatus:
85
+ """
86
+ This Dataclass represents the model status in the HF Inference API.
87
+
88
+ Args:
89
+ loaded (`bool`):
90
+ If the model is currently loaded into HF's Inference API. Models
91
+ are loaded on-demand, leading to the user's first request taking longer.
92
+ If a model is loaded, you can be assured that it is in a healthy state.
93
+ state (`str`):
94
+ The current state of the model. This can be 'Loaded', 'Loadable', 'TooBig'.
95
+ If a model's state is 'Loadable', it's not too big and has a supported
96
+ backend. Loadable models are automatically loaded when the user first
97
+ requests inference on the endpoint. This means it is transparent for the
98
+ user to load a model, except that the first call takes longer to complete.
99
+ compute_type (`Dict`):
100
+ Information about the compute resource the model is using or will use, such as 'gpu' type and number of
101
+ replicas.
102
+ framework (`str`):
103
+ The name of the framework that the model was built with, such as 'transformers'
104
+ or 'text-generation-inference'.
105
+ """
106
+
107
+ loaded: bool
108
+ state: str
109
+ compute_type: Dict
110
+ framework: str
111
+
112
+
113
+ ## IMPORT UTILS
114
+
115
+
116
+ def _import_aiohttp():
117
+ # Make sure `aiohttp` is installed on the machine.
118
+ if not is_aiohttp_available():
119
+ raise ImportError("Please install aiohttp to use `AsyncInferenceClient` (`pip install aiohttp`).")
120
+ import aiohttp
121
+
122
+ return aiohttp
123
+
124
+
125
+ def _import_numpy():
126
+ """Make sure `numpy` is installed on the machine."""
127
+ if not is_numpy_available():
128
+ raise ImportError("Please install numpy to use deal with embeddings (`pip install numpy`).")
129
+ import numpy
130
+
131
+ return numpy
132
+
133
+
134
+ def _import_pil_image():
135
+ """Make sure `PIL` is installed on the machine."""
136
+ if not is_pillow_available():
137
+ raise ImportError(
138
+ "Please install Pillow to use deal with images (`pip install Pillow`). If you don't want the image to be"
139
+ " post-processed, use `client.post(...)` and get the raw response from the server."
140
+ )
141
+ from PIL import Image
142
+
143
+ return Image
144
+
145
+
146
+ ## ENCODING / DECODING UTILS
147
+
148
+
149
+ @overload
150
+ def _open_as_binary(
151
+ content: ContentT,
152
+ ) -> ContextManager[BinaryT]: ... # means "if input is not None, output is not None"
153
+
154
+
155
+ @overload
156
+ def _open_as_binary(
157
+ content: Literal[None],
158
+ ) -> ContextManager[Literal[None]]: ... # means "if input is None, output is None"
159
+
160
+
161
+ @contextmanager # type: ignore
162
+ def _open_as_binary(content: Optional[ContentT]) -> Generator[Optional[BinaryT], None, None]:
163
+ """Open `content` as a binary file, either from a URL, a local path, or raw bytes.
164
+
165
+ Do nothing if `content` is None,
166
+
167
+ TODO: handle a PIL.Image as input
168
+ TODO: handle base64 as input
169
+ """
170
+ # If content is a string => must be either a URL or a path
171
+ if isinstance(content, str):
172
+ if content.startswith("https://") or content.startswith("http://"):
173
+ logger.debug(f"Downloading content from {content}")
174
+ yield get_session().get(content).content # TODO: retrieve as stream and pipe to post request ?
175
+ return
176
+ content = Path(content)
177
+ if not content.exists():
178
+ raise FileNotFoundError(
179
+ f"File not found at {content}. If `data` is a string, it must either be a URL or a path to a local"
180
+ " file. To pass raw content, please encode it as bytes first."
181
+ )
182
+
183
+ # If content is a Path => open it
184
+ if isinstance(content, Path):
185
+ logger.debug(f"Opening content from {content}")
186
+ with content.open("rb") as f:
187
+ yield f
188
+ else:
189
+ # Otherwise: already a file-like object or None
190
+ yield content
191
+
192
+
193
+ def _b64_encode(content: ContentT) -> str:
194
+ """Encode a raw file (image, audio) into base64. Can be bytes, an opened file, a path or a URL."""
195
+ with _open_as_binary(content) as data:
196
+ data_as_bytes = data if isinstance(data, bytes) else data.read()
197
+ return base64.b64encode(data_as_bytes).decode()
198
+
199
+
200
+ def _b64_to_image(encoded_image: str) -> "Image":
201
+ """Parse a base64-encoded string into a PIL Image."""
202
+ Image = _import_pil_image()
203
+ return Image.open(io.BytesIO(base64.b64decode(encoded_image)))
204
+
205
+
206
+ def _bytes_to_list(content: bytes) -> List:
207
+ """Parse bytes from a Response object into a Python list.
208
+
209
+ Expects the response body to be JSON-encoded data.
210
+
211
+ NOTE: This is exactly the same implementation as `_bytes_to_dict` and will not complain if the returned data is a
212
+ dictionary. The only advantage of having both is to help the user (and mypy) understand what kind of data to expect.
213
+ """
214
+ return json.loads(content.decode())
215
+
216
+
217
+ def _bytes_to_dict(content: bytes) -> Dict:
218
+ """Parse bytes from a Response object into a Python dictionary.
219
+
220
+ Expects the response body to be JSON-encoded data.
221
+
222
+ NOTE: This is exactly the same implementation as `_bytes_to_list` and will not complain if the returned data is a
223
+ list. The only advantage of having both is to help the user (and mypy) understand what kind of data to expect.
224
+ """
225
+ return json.loads(content.decode())
226
+
227
+
228
+ def _bytes_to_image(content: bytes) -> "Image":
229
+ """Parse bytes from a Response object into a PIL Image.
230
+
231
+ Expects the response body to be raw bytes. To deal with b64 encoded images, use `_b64_to_image` instead.
232
+ """
233
+ Image = _import_pil_image()
234
+ return Image.open(io.BytesIO(content))
235
+
236
+
237
+ def _as_dict(response: Union[bytes, Dict]) -> Dict:
238
+ return json.loads(response) if isinstance(response, bytes) else response
239
+
240
+
241
+ ## PAYLOAD UTILS
242
+
243
+
244
+ ## STREAMING UTILS
245
+
246
+
247
+ def _stream_text_generation_response(
248
+ bytes_output_as_lines: Iterable[bytes], details: bool
249
+ ) -> Union[Iterable[str], Iterable[TextGenerationStreamOutput]]:
250
+ """Used in `InferenceClient.text_generation`."""
251
+ # Parse ServerSentEvents
252
+ for byte_payload in bytes_output_as_lines:
253
+ try:
254
+ output = _format_text_generation_stream_output(byte_payload, details)
255
+ except StopIteration:
256
+ break
257
+ if output is not None:
258
+ yield output
259
+
260
+
261
+ async def _async_stream_text_generation_response(
262
+ bytes_output_as_lines: AsyncIterable[bytes], details: bool
263
+ ) -> Union[AsyncIterable[str], AsyncIterable[TextGenerationStreamOutput]]:
264
+ """Used in `AsyncInferenceClient.text_generation`."""
265
+ # Parse ServerSentEvents
266
+ async for byte_payload in bytes_output_as_lines:
267
+ try:
268
+ output = _format_text_generation_stream_output(byte_payload, details)
269
+ except StopIteration:
270
+ break
271
+ if output is not None:
272
+ yield output
273
+
274
+
275
+ def _format_text_generation_stream_output(
276
+ byte_payload: bytes, details: bool
277
+ ) -> Optional[Union[str, TextGenerationStreamOutput]]:
278
+ if not byte_payload.startswith(b"data:"):
279
+ return None # empty line
280
+
281
+ if byte_payload.strip() == b"data: [DONE]":
282
+ raise StopIteration("[DONE] signal received.")
283
+
284
+ # Decode payload
285
+ payload = byte_payload.decode("utf-8")
286
+ json_payload = json.loads(payload.lstrip("data:").rstrip("/n"))
287
+
288
+ # Either an error as being returned
289
+ if json_payload.get("error") is not None:
290
+ raise _parse_text_generation_error(json_payload["error"], json_payload.get("error_type"))
291
+
292
+ # Or parse token payload
293
+ output = TextGenerationStreamOutput.parse_obj_as_instance(json_payload)
294
+ return output.token.text if not details else output
295
+
296
+
297
+ def _stream_chat_completion_response(
298
+ bytes_lines: Iterable[bytes],
299
+ ) -> Iterable[ChatCompletionStreamOutput]:
300
+ """Used in `InferenceClient.chat_completion` if model is served with TGI."""
301
+ for item in bytes_lines:
302
+ try:
303
+ output = _format_chat_completion_stream_output(item)
304
+ except StopIteration:
305
+ break
306
+ if output is not None:
307
+ yield output
308
+
309
+
310
+ async def _async_stream_chat_completion_response(
311
+ bytes_lines: AsyncIterable[bytes],
312
+ ) -> AsyncIterable[ChatCompletionStreamOutput]:
313
+ """Used in `AsyncInferenceClient.chat_completion`."""
314
+ async for item in bytes_lines:
315
+ try:
316
+ output = _format_chat_completion_stream_output(item)
317
+ except StopIteration:
318
+ break
319
+ if output is not None:
320
+ yield output
321
+
322
+
323
+ def _format_chat_completion_stream_output(
324
+ byte_payload: bytes,
325
+ ) -> Optional[ChatCompletionStreamOutput]:
326
+ if not byte_payload.startswith(b"data:"):
327
+ return None # empty line
328
+
329
+ if byte_payload.strip() == b"data: [DONE]":
330
+ raise StopIteration("[DONE] signal received.")
331
+
332
+ # Decode payload
333
+ payload = byte_payload.decode("utf-8")
334
+ json_payload = json.loads(payload.lstrip("data:").rstrip("/n"))
335
+
336
+ # Either an error as being returned
337
+ if json_payload.get("error") is not None:
338
+ raise _parse_text_generation_error(json_payload["error"], json_payload.get("error_type"))
339
+
340
+ # Or parse token payload
341
+ return ChatCompletionStreamOutput.parse_obj_as_instance(json_payload)
342
+
343
+
344
+ async def _async_yield_from(client: "ClientSession", response: "ClientResponse") -> AsyncIterable[bytes]:
345
+ async for byte_payload in response.content:
346
+ yield byte_payload.strip()
347
+ await client.close()
348
+
349
+
350
+ # "TGI servers" are servers running with the `text-generation-inference` backend.
351
+ # This backend is the go-to solution to run large language models at scale. However,
352
+ # for some smaller models (e.g. "gpt2") the default `transformers` + `api-inference`
353
+ # solution is still in use.
354
+ #
355
+ # Both approaches have very similar APIs, but not exactly the same. What we do first in
356
+ # the `text_generation` method is to assume the model is served via TGI. If we realize
357
+ # it's not the case (i.e. we receive an HTTP 400 Bad Request), we fallback to the
358
+ # default API with a warning message. When that's the case, We remember the unsupported
359
+ # attributes for this model in the `_UNSUPPORTED_TEXT_GENERATION_KWARGS` global variable.
360
+ #
361
+ # In addition, TGI servers have a built-in API route for chat-completion, which is not
362
+ # available on the default API. We use this route to provide a more consistent behavior
363
+ # when available.
364
+ #
365
+ # For more details, see https://github.com/huggingface/text-generation-inference and
366
+ # https://huggingface.co/docs/api-inference/detailed_parameters#text-generation-task.
367
+
368
+ _UNSUPPORTED_TEXT_GENERATION_KWARGS: Dict[Optional[str], List[str]] = {}
369
+
370
+
371
+ def _set_unsupported_text_generation_kwargs(model: Optional[str], unsupported_kwargs: List[str]) -> None:
372
+ _UNSUPPORTED_TEXT_GENERATION_KWARGS.setdefault(model, []).extend(unsupported_kwargs)
373
+
374
+
375
+ def _get_unsupported_text_generation_kwargs(model: Optional[str]) -> List[str]:
376
+ return _UNSUPPORTED_TEXT_GENERATION_KWARGS.get(model, [])
377
+
378
+
379
+ # TEXT GENERATION ERRORS
380
+ # ----------------------
381
+ # Text-generation errors are parsed separately to handle as much as possible the errors returned by the text generation
382
+ # inference project (https://github.com/huggingface/text-generation-inference).
383
+ # ----------------------
384
+
385
+
386
+ def raise_text_generation_error(http_error: HTTPError) -> NoReturn:
387
+ """
388
+ Try to parse text-generation-inference error message and raise HTTPError in any case.
389
+
390
+ Args:
391
+ error (`HTTPError`):
392
+ The HTTPError that have been raised.
393
+ """
394
+ # Try to parse a Text Generation Inference error
395
+
396
+ try:
397
+ # Hacky way to retrieve payload in case of aiohttp error
398
+ payload = getattr(http_error, "response_error_payload", None) or http_error.response.json()
399
+ error = payload.get("error")
400
+ error_type = payload.get("error_type")
401
+ except Exception: # no payload
402
+ raise http_error
403
+
404
+ # If error_type => more information than `hf_raise_for_status`
405
+ if error_type is not None:
406
+ exception = _parse_text_generation_error(error, error_type)
407
+ raise exception from http_error
408
+
409
+ # Otherwise, fallback to default error
410
+ raise http_error
411
+
412
+
413
+ def _parse_text_generation_error(error: Optional[str], error_type: Optional[str]) -> TextGenerationError:
414
+ if error_type == "generation":
415
+ return GenerationError(error) # type: ignore
416
+ if error_type == "incomplete_generation":
417
+ return IncompleteGenerationError(error) # type: ignore
418
+ if error_type == "overloaded":
419
+ return OverloadedError(error) # type: ignore
420
+ if error_type == "validation":
421
+ return ValidationError(error) # type: ignore
422
+ return UnknownError(error) # type: ignore
rtme/lib/python3.10/site-packages/huggingface_hub/inference/_generated/__init__.py ADDED
File without changes
rtme/lib/python3.10/site-packages/huggingface_hub/inference/_generated/__pycache__/__init__.cpython-310.pyc ADDED
Binary file (186 Bytes). View file
 
rtme/lib/python3.10/site-packages/huggingface_hub/inference/_generated/__pycache__/_async_client.cpython-310.pyc ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6bdc4c6d229745e5894945d888f6355928b693ff92c1bd7c833319d3857c0c28
3
+ size 142719
rtme/lib/python3.10/site-packages/huggingface_hub/inference/_generated/_async_client.py ADDED
The diff for this file is too large to render. See raw diff
 
rtme/lib/python3.10/site-packages/huggingface_hub/inference/_generated/types/__pycache__/image_classification.cpython-310.pyc ADDED
Binary file (1.37 kB). View file
 
rtme/lib/python3.10/site-packages/huggingface_hub/inference/_generated/types/__pycache__/image_segmentation.cpython-310.pyc ADDED
Binary file (1.52 kB). View file
 
rtme/lib/python3.10/site-packages/huggingface_hub/inference/_generated/types/__pycache__/image_to_image.cpython-310.pyc ADDED
Binary file (1.61 kB). View file
 
rtme/lib/python3.10/site-packages/huggingface_hub/inference/_generated/types/__pycache__/image_to_text.cpython-310.pyc ADDED
Binary file (2.27 kB). View file
 
rtme/lib/python3.10/site-packages/huggingface_hub/inference/_generated/types/__pycache__/object_detection.cpython-310.pyc ADDED
Binary file (1.6 kB). View file
 
rtme/lib/python3.10/site-packages/huggingface_hub/inference/_generated/types/__pycache__/sentence_similarity.cpython-310.pyc ADDED
Binary file (946 Bytes). View file
 
rtme/lib/python3.10/site-packages/huggingface_hub/inference/_generated/types/__pycache__/summarization.cpython-310.pyc ADDED
Binary file (1.44 kB). View file
 
rtme/lib/python3.10/site-packages/huggingface_hub/inference/_generated/types/__pycache__/table_question_answering.cpython-310.pyc ADDED
Binary file (1.82 kB). View file
 
rtme/lib/python3.10/site-packages/huggingface_hub/inference/_generated/types/__pycache__/text2text_generation.cpython-310.pyc ADDED
Binary file (1.57 kB). View file
 
rtme/lib/python3.10/site-packages/huggingface_hub/inference/_generated/types/__pycache__/text_classification.cpython-310.pyc ADDED
Binary file (1.36 kB). View file
 
rtme/lib/python3.10/site-packages/huggingface_hub/inference/_generated/types/audio_to_audio.py ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Inference code generated from the JSON schema spec in @huggingface/tasks.
2
+ #
3
+ # See:
4
+ # - script: https://github.com/huggingface/huggingface.js/blob/main/packages/tasks/scripts/inference-codegen.ts
5
+ # - specs: https://github.com/huggingface/huggingface.js/tree/main/packages/tasks/src/tasks.
6
+ from typing import Any
7
+
8
+ from .base import BaseInferenceType, dataclass_with_extra
9
+
10
+
11
+ @dataclass_with_extra
12
+ class AudioToAudioInput(BaseInferenceType):
13
+ """Inputs for Audio to Audio inference"""
14
+
15
+ inputs: Any
16
+ """The input audio data"""
17
+
18
+
19
+ @dataclass_with_extra
20
+ class AudioToAudioOutputElement(BaseInferenceType):
21
+ """Outputs of inference for the Audio To Audio task
22
+ A generated audio file with its label.
23
+ """
24
+
25
+ blob: Any
26
+ """The generated audio file."""
27
+ content_type: str
28
+ """The content type of audio file."""
29
+ label: str
30
+ """The label of the audio file."""
rtme/lib/python3.10/site-packages/huggingface_hub/utils/__pycache__/_subprocess.cpython-310.pyc ADDED
Binary file (3.93 kB). View file
 
rtme/lib/python3.10/site-packages/mpmath-1.3.0.dist-info/METADATA ADDED
@@ -0,0 +1,233 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Metadata-Version: 2.1
2
+ Name: mpmath
3
+ Version: 1.3.0
4
+ Summary: Python library for arbitrary-precision floating-point arithmetic
5
+ Home-page: http://mpmath.org/
6
+ Author: Fredrik Johansson
7
+ Author-email: fredrik.johansson@gmail.com
8
+ License: BSD
9
+ Project-URL: Source, https://github.com/fredrik-johansson/mpmath
10
+ Project-URL: Tracker, https://github.com/fredrik-johansson/mpmath/issues
11
+ Project-URL: Documentation, http://mpmath.org/doc/current/
12
+ Classifier: License :: OSI Approved :: BSD License
13
+ Classifier: Topic :: Scientific/Engineering :: Mathematics
14
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
15
+ Classifier: Programming Language :: Python
16
+ Classifier: Programming Language :: Python :: 2
17
+ Classifier: Programming Language :: Python :: 2.7
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.5
20
+ Classifier: Programming Language :: Python :: 3.6
21
+ Classifier: Programming Language :: Python :: 3.7
22
+ Classifier: Programming Language :: Python :: 3.8
23
+ Classifier: Programming Language :: Python :: 3.9
24
+ Classifier: Programming Language :: Python :: Implementation :: CPython
25
+ Classifier: Programming Language :: Python :: Implementation :: PyPy
26
+ License-File: LICENSE
27
+ Provides-Extra: develop
28
+ Requires-Dist: pytest (>=4.6) ; extra == 'develop'
29
+ Requires-Dist: pycodestyle ; extra == 'develop'
30
+ Requires-Dist: pytest-cov ; extra == 'develop'
31
+ Requires-Dist: codecov ; extra == 'develop'
32
+ Requires-Dist: wheel ; extra == 'develop'
33
+ Provides-Extra: docs
34
+ Requires-Dist: sphinx ; extra == 'docs'
35
+ Provides-Extra: gmpy
36
+ Requires-Dist: gmpy2 (>=2.1.0a4) ; (platform_python_implementation != "PyPy") and extra == 'gmpy'
37
+ Provides-Extra: tests
38
+ Requires-Dist: pytest (>=4.6) ; extra == 'tests'
39
+
40
+ mpmath
41
+ ======
42
+
43
+ |pypi version| |Build status| |Code coverage status| |Zenodo Badge|
44
+
45
+ .. |pypi version| image:: https://img.shields.io/pypi/v/mpmath.svg
46
+ :target: https://pypi.python.org/pypi/mpmath
47
+ .. |Build status| image:: https://github.com/fredrik-johansson/mpmath/workflows/test/badge.svg
48
+ :target: https://github.com/fredrik-johansson/mpmath/actions?workflow=test
49
+ .. |Code coverage status| image:: https://codecov.io/gh/fredrik-johansson/mpmath/branch/master/graph/badge.svg
50
+ :target: https://codecov.io/gh/fredrik-johansson/mpmath
51
+ .. |Zenodo Badge| image:: https://zenodo.org/badge/2934512.svg
52
+ :target: https://zenodo.org/badge/latestdoi/2934512
53
+
54
+ A Python library for arbitrary-precision floating-point arithmetic.
55
+
56
+ Website: http://mpmath.org/
57
+ Main author: Fredrik Johansson <fredrik.johansson@gmail.com>
58
+
59
+ Mpmath is free software released under the New BSD License (see the
60
+ LICENSE file for details)
61
+
62
+ 0. History and credits
63
+ ----------------------
64
+
65
+ The following people (among others) have contributed major patches
66
+ or new features to mpmath:
67
+
68
+ * Pearu Peterson <pearu.peterson@gmail.com>
69
+ * Mario Pernici <mario.pernici@mi.infn.it>
70
+ * Ondrej Certik <ondrej@certik.cz>
71
+ * Vinzent Steinberg <vinzent.steinberg@gmail.cm>
72
+ * Nimish Telang <ntelang@gmail.com>
73
+ * Mike Taschuk <mtaschuk@ece.ualberta.ca>
74
+ * Case Van Horsen <casevh@gmail.com>
75
+ * Jorn Baayen <jorn.baayen@gmail.com>
76
+ * Chris Smith <smichr@gmail.com>
77
+ * Juan Arias de Reyna <arias@us.es>
78
+ * Ioannis Tziakos <itziakos@gmail.com>
79
+ * Aaron Meurer <asmeurer@gmail.com>
80
+ * Stefan Krastanov <krastanov.stefan@gmail.com>
81
+ * Ken Allen <ken.allen@sbcglobal.net>
82
+ * Timo Hartmann <thartmann15@gmail.com>
83
+ * Sergey B Kirpichev <skirpichev@gmail.com>
84
+ * Kris Kuhlman <kristopher.kuhlman@gmail.com>
85
+ * Paul Masson <paulmasson@analyticphysics.com>
86
+ * Michael Kagalenko <michael.kagalenko@gmail.com>
87
+ * Jonathan Warner <warnerjon12@gmail.com>
88
+ * Max Gaukler <max.gaukler@fau.de>
89
+ * Guillermo Navas-Palencia <g.navas.palencia@gmail.com>
90
+ * Nike Dattani <nike@hpqc.org>
91
+
92
+ Numerous other people have contributed by reporting bugs,
93
+ requesting new features, or suggesting improvements to the
94
+ documentation.
95
+
96
+ For a detailed changelog, including individual contributions,
97
+ see the CHANGES file.
98
+
99
+ Fredrik's work on mpmath during summer 2008 was sponsored by Google
100
+ as part of the Google Summer of Code program.
101
+
102
+ Fredrik's work on mpmath during summer 2009 was sponsored by the
103
+ American Institute of Mathematics under the support of the National Science
104
+ Foundation Grant No. 0757627 (FRG: L-functions and Modular Forms).
105
+
106
+ Any opinions, findings, and conclusions or recommendations expressed in this
107
+ material are those of the author(s) and do not necessarily reflect the
108
+ views of the sponsors.
109
+
110
+ Credit also goes to:
111
+
112
+ * The authors of the GMP library and the Python wrapper
113
+ gmpy, enabling mpmath to become much faster at
114
+ high precision
115
+ * The authors of MPFR, pari/gp, MPFUN, and other arbitrary-
116
+ precision libraries, whose documentation has been helpful
117
+ for implementing many of the algorithms in mpmath
118
+ * Wikipedia contributors; Abramowitz & Stegun; Gradshteyn & Ryzhik;
119
+ Wolfram Research for MathWorld and the Wolfram Functions site.
120
+ These are the main references used for special functions
121
+ implementations.
122
+ * George Brandl for developing the Sphinx documentation tool
123
+ used to build mpmath's documentation
124
+
125
+ Release history:
126
+
127
+ * Version 1.3.0 released on March 7, 2023
128
+ * Version 1.2.0 released on February 1, 2021
129
+ * Version 1.1.0 released on December 11, 2018
130
+ * Version 1.0.0 released on September 27, 2017
131
+ * Version 0.19 released on June 10, 2014
132
+ * Version 0.18 released on December 31, 2013
133
+ * Version 0.17 released on February 1, 2011
134
+ * Version 0.16 released on September 24, 2010
135
+ * Version 0.15 released on June 6, 2010
136
+ * Version 0.14 released on February 5, 2010
137
+ * Version 0.13 released on August 13, 2009
138
+ * Version 0.12 released on June 9, 2009
139
+ * Version 0.11 released on January 26, 2009
140
+ * Version 0.10 released on October 15, 2008
141
+ * Version 0.9 released on August 23, 2008
142
+ * Version 0.8 released on April 20, 2008
143
+ * Version 0.7 released on March 12, 2008
144
+ * Version 0.6 released on January 13, 2008
145
+ * Version 0.5 released on November 24, 2007
146
+ * Version 0.4 released on November 3, 2007
147
+ * Version 0.3 released on October 5, 2007
148
+ * Version 0.2 released on October 2, 2007
149
+ * Version 0.1 released on September 27, 2007
150
+
151
+ 1. Download & installation
152
+ --------------------------
153
+
154
+ Mpmath requires Python 2.7 or 3.5 (or later versions). It has been tested
155
+ with CPython 2.7, 3.5 through 3.7 and for PyPy.
156
+
157
+ The latest release of mpmath can be downloaded from the mpmath
158
+ website and from https://github.com/fredrik-johansson/mpmath/releases
159
+
160
+ It should also be available in the Python Package Index at
161
+ https://pypi.python.org/pypi/mpmath
162
+
163
+ To install latest release of Mpmath with pip, simply run
164
+
165
+ ``pip install mpmath``
166
+
167
+ Or unpack the mpmath archive and run
168
+
169
+ ``python setup.py install``
170
+
171
+ Mpmath can also be installed using
172
+
173
+ ``python -m easy_install mpmath``
174
+
175
+ The latest development code is available from
176
+ https://github.com/fredrik-johansson/mpmath
177
+
178
+ See the main documentation for more detailed instructions.
179
+
180
+ 2. Running tests
181
+ ----------------
182
+
183
+ The unit tests in mpmath/tests/ can be run via the script
184
+ runtests.py, but it is recommended to run them with py.test
185
+ (https://pytest.org/), especially
186
+ to generate more useful reports in case there are failures.
187
+
188
+ You may also want to check out the demo scripts in the demo
189
+ directory.
190
+
191
+ The master branch is automatically tested by Travis CI.
192
+
193
+ 3. Documentation
194
+ ----------------
195
+
196
+ Documentation in reStructuredText format is available in the
197
+ doc directory included with the source package. These files
198
+ are human-readable, but can be compiled to prettier HTML using
199
+ the build.py script (requires Sphinx, http://sphinx.pocoo.org/).
200
+
201
+ See setup.txt in the documentation for more information.
202
+
203
+ The most recent documentation is also available in HTML format:
204
+
205
+ http://mpmath.org/doc/current/
206
+
207
+ 4. Known problems
208
+ -----------------
209
+
210
+ Mpmath is a work in progress. Major issues include:
211
+
212
+ * Some functions may return incorrect values when given extremely
213
+ large arguments or arguments very close to singularities.
214
+
215
+ * Directed rounding works for arithmetic operations. It is implemented
216
+ heuristically for other operations, and their results may be off by one
217
+ or two units in the last place (even if otherwise accurate).
218
+
219
+ * Some IEEE 754 features are not available. Inifinities and NaN are
220
+ partially supported; denormal rounding is currently not available
221
+ at all.
222
+
223
+ * The interface for switching precision and rounding is not finalized.
224
+ The current method is not threadsafe.
225
+
226
+ 5. Help and bug reports
227
+ -----------------------
228
+
229
+ General questions and comments can be sent to the mpmath mailinglist,
230
+ mpmath@googlegroups.com
231
+
232
+ You can also report bugs and send patches to the mpmath issue tracker,
233
+ https://github.com/fredrik-johansson/mpmath/issues
rtme/lib/python3.10/site-packages/mpmath-1.3.0.dist-info/RECORD ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ mpmath-1.3.0.dist-info/INSTALLER,sha256=5hhM4Q4mYTT9z6QB6PGpUAW81PGNFrYrdXMj4oM_6ak,2
2
+ mpmath-1.3.0.dist-info/LICENSE,sha256=wmyugdpFCOXiSZhXd6M4IfGDIj67dNf4z7-Q_n7vL7c,1537
3
+ mpmath-1.3.0.dist-info/METADATA,sha256=RLZupES5wNGa6UgV01a_BHrmtoDBkmi1wmVofNaoFAY,8630
4
+ mpmath-1.3.0.dist-info/RECORD,,
5
+ mpmath-1.3.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
+ mpmath-1.3.0.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
7
+ mpmath-1.3.0.dist-info/top_level.txt,sha256=BUVWrh8EVlkOhM1n3X9S8msTaVcC-3s6Sjt60avHYus,7
8
+ mpmath/__init__.py,sha256=skFYTSwfwDBLChAV6pI3SdewgAQR3UBtyrfIK_Jdn-g,8765
9
+ mpmath/calculus/__init__.py,sha256=UAgCIJ1YmaeyTqpNzjBlCZGeIzLtUZMEEpl99VWNjus,162
10
+ mpmath/calculus/approximation.py,sha256=vyzu3YI6r63Oq1KFHrQz02mGXAcH23emqNYhJuUaFZ4,8817
11
+ mpmath/calculus/calculus.py,sha256=A0gSp0hxSyEDfugJViY3CeWalF-vK701YftzrjSQzQ4,112
12
+ mpmath/calculus/differentiation.py,sha256=2L6CBj8xtX9iip98NPbKsLtwtRjxi571wYmTMHFeL90,20226
13
+ mpmath/calculus/extrapolation.py,sha256=xM0rvk2DFEF4iR1Jhl-Y3aS93iW9VVJX7y9IGpmzC-A,73306
14
+ mpmath/calculus/inverselaplace.py,sha256=5-pn8N_t0PtgBTXixsXZ4xxrihK2J5gYsVfTKfDx4gA,36056
15
+ mpmath/calculus/odes.py,sha256=gaHiw7IJjsONNTAa6izFPZpmcg9uyTp8MULnGdzTIGo,9908
16
+ mpmath/calculus/optimization.py,sha256=bKnShXElBOmVOIOlFeksDsYCp9fYSmYwKmXDt0z26MM,32856
17
+ mpmath/calculus/polynomials.py,sha256=D16BhU_SHbVi06IxNwABHR-H77IylndNsN3muPTuFYs,7877
18
+ mpmath/calculus/quadrature.py,sha256=n-avtS8E43foV-5tr5lofgOBaiMUYE8AJjQcWI9QcKk,42432
19
+ mpmath/ctx_base.py,sha256=rfjmfMyA55x8R_cWFINUwWVTElfZmyx5erKDdauSEVw,15985
20
+ mpmath/ctx_fp.py,sha256=ctUjx_NoU0iFWk05cXDYCL2ZtLZOlWs1n6Zao3pbG2g,6572
21
+ mpmath/ctx_iv.py,sha256=tqdMr-GDfkZk1EhoGeCAajy7pQv-RWtrVqhYjfI8r4g,17211
22
+ mpmath/ctx_mp.py,sha256=d3r4t7xHNqSFtmqsA9Btq1Npy3WTM-pcM2_jeCyECxY,49452
23
+ mpmath/ctx_mp_python.py,sha256=3olYWo4lk1SnQ0A_IaZ181qqG8u5pxGat_v-L4Qtn3Y,37815
24
+ mpmath/function_docs.py,sha256=g4PP8n6ILXmHcLyA50sxK6Tmp_Z4_pRN-wDErU8D1i4,283512
25
+ mpmath/functions/__init__.py,sha256=YXVdhqv-6LKm6cr5xxtTNTtuD9zDPKGQl8GmS0xz2xo,330
26
+ mpmath/functions/bessel.py,sha256=dUPLu8frlK-vmf3-irX_7uvwyw4xccv6EIizmIZ88kM,37938
27
+ mpmath/functions/elliptic.py,sha256=qz0yVMb4lWEeOTDL_DWz5u5awmGIPKAsuZFJXgwHJNU,42237
28
+ mpmath/functions/expintegrals.py,sha256=75X_MRdYc1F_X73bgNiOJqwRlS2hqAzcFLl3RM2tCDc,11644
29
+ mpmath/functions/factorials.py,sha256=8_6kCR7e4k1GwxiAOJu0NRadeF4jA28qx4hidhu4ILk,5273
30
+ mpmath/functions/functions.py,sha256=ub2JExvqzCWLkm5yAm72Fr6fdWmZZUknq9_3w9MEigI,18100
31
+ mpmath/functions/hypergeometric.py,sha256=Z0OMAMC4ylK42n_SnamyFVnUx6zHLyCLCoJDSZ1JrHY,51570
32
+ mpmath/functions/orthogonal.py,sha256=FabkxKfBoSseA5flWu1a3re-2BYaew9augqIsT8LaLw,16097
33
+ mpmath/functions/qfunctions.py,sha256=a3EHGKQt_jMd4x9I772Jz-TGFnGY-arWqPvZGz9QSe0,7633
34
+ mpmath/functions/rszeta.py,sha256=yuUVp4ilIyDmXyE3WTBxDDjwfEJNypJnbPS-xPH5How,46184
35
+ mpmath/functions/signals.py,sha256=ELotwQaW1CDpv-eeJzOZ5c23NhfaZcj9_Gkb3psvS0Q,703
36
+ mpmath/functions/theta.py,sha256=KggOocczoMG6_HMoal4oEP7iZ4SKOou9JFE-WzY2r3M,37320
37
+ mpmath/functions/zeta.py,sha256=ue7JY7GXA0oX8q08sQJl2CSRrZ7kOt8HsftpVjnTwrE,36410
38
+ mpmath/functions/zetazeros.py,sha256=uq6TVyZBcY2MLX7VSdVfn0TOkowBLM9fXtnySEwaNzw,30858
39
+ mpmath/identification.py,sha256=7aMdngRAaeL_MafDUNbmEIlGQSklHDZ8pmPFt-OLgkw,29253
40
+ mpmath/libmp/__init__.py,sha256=UCDjLZw4brbklaCmSixCcPdLdHkz8sF_-6F_wr0duAg,3790
41
+ mpmath/libmp/backend.py,sha256=26A8pUkaGov26vrrFNQVyWJ5LDtK8sl3UHrYLecaTjA,3360
42
+ mpmath/libmp/gammazeta.py,sha256=Xqdw6PMoswDaSca_sOs-IglRuk3fb8c9p43M_lbcrlc,71469
43
+ mpmath/libmp/libelefun.py,sha256=joBZP4FOdxPfieWso1LPtSr6dHydpG_LQiF_bYQYWMg,43861
44
+ mpmath/libmp/libhyper.py,sha256=J9fmdDF6u27EcssEWvBuVaAa3hFjPvPN1SgRgu1dEbc,36624
45
+ mpmath/libmp/libintmath.py,sha256=aIRT0rkUZ_sdGQf3TNCLd-pBMvtQWjssbvFLfK7U0jc,16688
46
+ mpmath/libmp/libmpc.py,sha256=KBndUjs5YVS32-Id3fflDfYgpdW1Prx6zfo8Ez5Qbrs,26875
47
+ mpmath/libmp/libmpf.py,sha256=vpP0kNVkScbCVoZogJ4Watl4I7Ce0d4dzHVjfVe57so,45021
48
+ mpmath/libmp/libmpi.py,sha256=u0I5Eiwkqa-4-dXETi5k7MuaxBeZbvCAPFtl93U9YF0,27622
49
+ mpmath/math2.py,sha256=O5Dglg81SsW0wfHDUJcXOD8-cCaLvbVIvyw0sVmRbpI,18561
50
+ mpmath/matrices/__init__.py,sha256=ETzGDciYbq9ftiKwaMbJ15EI-KNXHrzRb-ZHehhqFjs,94
51
+ mpmath/matrices/calculus.py,sha256=PNRq-p2nxgT-fzC54K2depi8ddhdx6Q86G8qpUiHeUY,18609
52
+ mpmath/matrices/eigen.py,sha256=GbDXI3CixzEdXxr1G86uUWkAngAvd-05MmSQ-Tsu_5k,24394
53
+ mpmath/matrices/eigen_symmetric.py,sha256=FPKPeQr1cGYw6Y6ea32a1YdEWQDLP6JlQHEA2WfNLYg,58534
54
+ mpmath/matrices/linalg.py,sha256=04C3ijzMFom7ob5fXBCDfyPPdo3BIboIeE8x2A6vqF0,26958
55
+ mpmath/matrices/matrices.py,sha256=o78Eq62EHQnxcsR0LBoWDEGREOoN4L2iDM1q3dQrw0o,32331
56
+ mpmath/rational.py,sha256=64d56fvZXngYZT7nOAHeFRUX77eJ1A0R3rpfWBU-mSo,5976
57
+ mpmath/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
58
+ mpmath/tests/extratest_gamma.py,sha256=xidhXUelILcxtiPGoTBHjqUOKIJzEaZ_v3nntGQyWZQ,7228
59
+ mpmath/tests/extratest_zeta.py,sha256=sg10j9RhjBpV2EdUqyYhGV2ERWvM--EvwwGIz6HTmlw,1003
60
+ mpmath/tests/runtests.py,sha256=7NUV82F3K_5AhU8mCLUFf5OibtT7uloFCwPyM3l71wM,5189
61
+ mpmath/tests/test_basic_ops.py,sha256=dsB8DRG-GrPzBaZ-bIauYabaeqXbfqBo9SIP9BqcTSs,15348
62
+ mpmath/tests/test_bitwise.py,sha256=-nLYhgQbhDza3SQM63BhktYntACagqMYx9ib3dPnTKM,7686
63
+ mpmath/tests/test_calculus.py,sha256=4oxtNfMpO4RLLoOzrv7r9-h8BcqfBsJIE6UpsHe7c4w,9187
64
+ mpmath/tests/test_compatibility.py,sha256=_t3ASZ3jhfAMnN1voWX7PDNIDzn-3PokkJGIdT1x7y0,2306
65
+ mpmath/tests/test_convert.py,sha256=JPcDcTJIWh5prIxjx5DM1aNWgqlUoF2KpHvAgK3uHi4,8834
66
+ mpmath/tests/test_diff.py,sha256=qjiF8NxQ8vueuZ5ZHGPQ-kjcj_I7Jh_fEdFtaA8DzEI,2466
67
+ mpmath/tests/test_division.py,sha256=6lUeZfmaBWvvszdqlWLMHgXPjVsxvW1WZpd4-jFWCpU,5340
68
+ mpmath/tests/test_eigen.py,sha256=2mnqVATGbsJkvSVHPpitfAk881twFfb3LsO3XikV9Hs,3905
69
+ mpmath/tests/test_eigen_symmetric.py,sha256=v0VimCicIU2owASDMBaP-t-30uq-pXcsglt95KBtNO4,8778
70
+ mpmath/tests/test_elliptic.py,sha256=Kjiwq9Bb6N_OOzzWewGQ1M_PMa7vRs42V0t90gloZxo,26225
71
+ mpmath/tests/test_fp.py,sha256=AJo0FTyH4BuUnUsv176LD956om308KGYndy-b54KGxM,89997
72
+ mpmath/tests/test_functions.py,sha256=b47VywdomoOX6KmMmz9-iv2IqVIydwKSuUw2pWlFHrY,30955
73
+ mpmath/tests/test_functions2.py,sha256=vlw2RWhL1oTcifnOMDx1a_YzN96UgNNIE5STeKRv1HY,96990
74
+ mpmath/tests/test_gammazeta.py,sha256=AB34O0DV7AlEf9Z4brnCadeQU5-uAwhWRw5FZas65DA,27917
75
+ mpmath/tests/test_hp.py,sha256=6hcENu6Te2klPEiTSeLBIRPlH7PADlJwFKbx8xpnOhg,10461
76
+ mpmath/tests/test_identify.py,sha256=lGUIPfrB2paTg0cFUo64GmMzF77F9gs9FQjX7gxGHV8,692
77
+ mpmath/tests/test_interval.py,sha256=TjYd7a9ca6iRJiLjw06isLeZTuGoGAPmgleDZ0cYfJ0,17527
78
+ mpmath/tests/test_levin.py,sha256=P8M11yV1dj_gdSNv5xuwCzFiF86QyRDtPMjURy6wJ28,5090
79
+ mpmath/tests/test_linalg.py,sha256=miKEnwB8iwWV13hi1bF1cg3hgB4rTKOR0fvDVfWmXds,10440
80
+ mpmath/tests/test_matrices.py,sha256=qyA4Ml2CvNvW034lzB01G6wVgNr7UrgZqh2wkMXtpzM,7944
81
+ mpmath/tests/test_mpmath.py,sha256=LVyJUeofiaxW-zLKWVBCz59L9UQsjlW0Ts9_oBiEv_4,196
82
+ mpmath/tests/test_ode.py,sha256=zAxexBH4fnmFNO4bvEHbug1NJWC5zqfFaVDlYijowkY,1822
83
+ mpmath/tests/test_pickle.py,sha256=Y8CKmDLFsJHUqG8CDaBw5ilrPP4YT1xijVduLpQ7XFE,401
84
+ mpmath/tests/test_power.py,sha256=sz_K02SmNxpa6Kb1uJLN_N4tXTJGdQ___vPRshEN7Gk,5227
85
+ mpmath/tests/test_quad.py,sha256=49Ltft0vZ_kdKLL5s-Kj-BzAVoF5LPVEUeNUzdOkghI,3893
86
+ mpmath/tests/test_rootfinding.py,sha256=umQegEaKHmYOEl5jEyoD-VLKDtXsTJJkepKEr4c0dC0,3132
87
+ mpmath/tests/test_special.py,sha256=YbMIoMIkJEvvKYIzS0CXthJFG0--j6un7-tcE6b7FPM,2848
88
+ mpmath/tests/test_str.py,sha256=0WsGD9hMPRi8zcuYMA9Cu2mOvQiCFskPwMsMf8lBDK4,544
89
+ mpmath/tests/test_summation.py,sha256=fdNlsvRVOsbWxbhlyDLDaEO2S8kTJrRMKIvB5-aNci0,2035
90
+ mpmath/tests/test_trig.py,sha256=zPtkIEnZaThxcWur4k7BX8-2Jmj-AhO191Svv7ANYUU,4799
91
+ mpmath/tests/test_visualization.py,sha256=1PqtkoUx-WsKYgTRiu5o9pBc85kwhf1lzU2eobDQCJM,944
92
+ mpmath/tests/torture.py,sha256=LD95oES7JY2KroELK-m-jhvtbvZaKChnt0Cq7kFMNCw,7868
93
+ mpmath/usertools.py,sha256=a-TDw7XSRsPdBEffxOooDV4WDFfuXnO58P75dcAD87I,3029
94
+ mpmath/visualization.py,sha256=pnnbjcd9AhFVRBZavYX5gjx4ytK_kXoDDisYR6EpXhs,10627
rtme/lib/python3.10/site-packages/mpmath-1.3.0.dist-info/WHEEL ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ Wheel-Version: 1.0
2
+ Generator: bdist_wheel (0.38.4)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
rtme/lib/python3.10/site-packages/nvidia_ml_py-12.570.86.dist-info/INSTALLER ADDED
@@ -0,0 +1 @@
 
 
1
+ uv
rtme/lib/python3.10/site-packages/nvidia_ml_py-12.570.86.dist-info/METADATA ADDED
@@ -0,0 +1,261 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Metadata-Version: 2.2
2
+ Name: nvidia-ml-py
3
+ Version: 12.570.86
4
+ Summary: Python Bindings for the NVIDIA Management Library
5
+ Home-page: https://forums.developer.nvidia.com
6
+ Author: NVIDIA Corporation
7
+ Author-email: nvml-bindings@nvidia.com
8
+ License: BSD
9
+ Classifier: Development Status :: 5 - Production/Stable
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Intended Audience :: System Administrators
12
+ Classifier: License :: OSI Approved :: BSD License
13
+ Classifier: Operating System :: Microsoft :: Windows
14
+ Classifier: Operating System :: POSIX :: Linux
15
+ Classifier: Programming Language :: Python
16
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
17
+ Classifier: Topic :: System :: Hardware
18
+ Classifier: Topic :: System :: Systems Administration
19
+ Description-Content-Type: text/markdown
20
+ Dynamic: author
21
+ Dynamic: author-email
22
+ Dynamic: classifier
23
+ Dynamic: description
24
+ Dynamic: description-content-type
25
+ Dynamic: home-page
26
+ Dynamic: license
27
+ Dynamic: summary
28
+
29
+ pyNVML
30
+ ======
31
+
32
+ Python bindings to the NVIDIA Management Library
33
+ ------------------------------------------------
34
+
35
+ Provides a Python interface to GPU management and monitoring functions.
36
+
37
+ This is a wrapper around the NVML library.
38
+ For information about the NVML library, see the NVML developer page
39
+ http://developer.nvidia.com/nvidia-management-library-nvml
40
+
41
+ Download the latest package from:
42
+ http://pypi.python.org/pypi/nvidia-ml-py/
43
+
44
+ Note this file can be run with 'python -m doctest -v README.txt'
45
+ although the results are system dependent
46
+
47
+ The nvml header file contains function documentation that is relevant
48
+ to this wrapper. The header file is distributed with.
49
+ https://developer.nvidia.com/gpu-deployment-kit
50
+
51
+ The main difference is this library handles allocating structs and
52
+ passing pointers to the functions, before returning the desired value.
53
+ Non-success return codes are raised as exceptions as described in the
54
+ section below.
55
+
56
+ REQUIRES
57
+ --------
58
+ Python 2.5, or an earlier version with the ctypes module.
59
+
60
+ INSTALLATION
61
+ ------------
62
+
63
+ Pip Installation with python3:
64
+ - `python3 -m pip install nvidia-ml-py`
65
+
66
+ Manual Installation:
67
+ ```
68
+ $ tar -xzf nvidia-ml-py-$major-$minor-$patch.tar.gz`
69
+ $ cd nvidia-ml-py-$major-$minor-$patch
70
+ $ sudo python setup.py install
71
+ ```
72
+
73
+ USAGE
74
+ -----
75
+ ```
76
+ >>> from pynvml import *
77
+ >>> nvmlInit()
78
+ >>> print(f"Driver Version: {nvmlSystemGetDriverVersion()}")
79
+ Driver Version: 11.515.48
80
+ >>> deviceCount = nvmlDeviceGetCount()
81
+ >>> for i in range(deviceCount):
82
+ ... handle = nvmlDeviceGetHandleByIndex(i)
83
+ ... print(f"Device {i} : {nvmlDeviceGetName(handle)}")
84
+ ...
85
+ Device 0 : Tesla K40c
86
+
87
+ >>> nvmlShutdown()
88
+ ```
89
+
90
+ FUNCTIONS
91
+ ---------
92
+ Python methods wrap NVML functions, implemented in a C shared library.
93
+ Each function's use is the same with the following exceptions:
94
+
95
+ - Instead of returning error codes, failing error codes are raised as Python exceptions.
96
+
97
+ ```
98
+ >>> try:
99
+ ... nvmlDeviceGetCount()
100
+ ... except NVMLError as error:
101
+ ... print(error)
102
+ ...
103
+ Uninitialized
104
+ ```
105
+
106
+ - C function output parameters are returned from the corresponding Python function left to right.
107
+ ```
108
+ nvmlReturn_t nvmlDeviceGetEccMode(nvmlDevice_t device,
109
+ nvmlEnableState_t *current,
110
+ nvmlEnableState_t *pending);
111
+
112
+ >>> nvmlInit()
113
+ >>> handle = nvmlDeviceGetHandleByIndex(0)
114
+ >>> (current, pending) = nvmlDeviceGetEccMode(handle)
115
+ ```
116
+ - C structs are converted into Python classes.
117
+
118
+ ```
119
+ // C Function and typedef struct
120
+ nvmlReturn_t DECLDIR nvmlDeviceGetMemoryInfo(nvmlDevice_t device,
121
+ nvmlMemory_t *memory);
122
+ typedef struct nvmlMemory_st {
123
+ unsigned long long total;
124
+ unsigned long long free;
125
+ unsigned long long used;
126
+ } nvmlMemory_t;
127
+
128
+
129
+ # Python call to function and accessing members of ctype struct
130
+ >>> info = nvmlDeviceGetMemoryInfo(handle)
131
+ >>> print(f"Total memory: {info.total}")
132
+ Total memory: 5636292608
133
+ >>> print(f"Free memory:, {info.free}")
134
+ Free memory: 5578420224
135
+ >>> print(f"Used memory: {info.used}")
136
+ Used memory: 57872384
137
+ ```
138
+
139
+ - Python handles string buffer creation.
140
+
141
+ ```
142
+ // C Function that needs character array and length
143
+ nvmlReturn_t nvmlSystemGetDriverVersion(char* version,
144
+ unsigned int length);
145
+
146
+ # Python function handles memory
147
+ >>> version = nvmlSystemGetDriverVersion()
148
+ >>> print(version)
149
+ ... 11.520.75
150
+ >>> nvmlShutdown()
151
+ ```
152
+
153
+ For usage information see the NVML documentation.
154
+
155
+ VARIABLES
156
+ ---------
157
+ All meaningful NVML constants and enums are exposed in Python.
158
+
159
+ The NVML_VALUE_NOT_AVAILABLE constant is not used. Instead None is mapped to the field.
160
+
161
+ EXCEPTIONS
162
+ ----------
163
+ Since the C library uses return codes and python prefers exception handling, the
164
+ library converts all return codes to various exceptions. The exceptions are generated
165
+ automatically via a function at run time instead of being defined manually.
166
+
167
+ The list of exceptions can be found in NVMLError base class.
168
+
169
+ The example seen above in the FUNCTIONS section:
170
+
171
+ ```
172
+ >>> try:
173
+ ... nvmlDeviceGetCount()
174
+ ... except NVMLError as error:
175
+ ... print(error)
176
+ ...
177
+ Uninitialized
178
+ ```
179
+
180
+ Can be more accurately caught like this:
181
+
182
+ ```
183
+ >>> try:
184
+ ... nvmlDeviceGetCount()
185
+ ... except NVMLError_Uninitialized as error:
186
+ ... print(error)
187
+ ...
188
+ Uninitialized
189
+ ```
190
+
191
+ The conversion from name to exception is like this for all exceptions:
192
+ * `NVML_ERROR_UNINITIALIZED` => `NVMLError_Uninitialized`
193
+ * `NVML_ERROR_LIBRARY_NOT_FOUND` => `NVMLError_LibraryNotFound`
194
+ * `NVML_ERROR_ALREADY_INITIALIZED` => `NVMLError_AlreadyInitialized`
195
+
196
+ RELEASE NOTES
197
+ -------------
198
+ Version 2.285.0
199
+ - Added new functions for NVML 2.285. See NVML documentation for more information.
200
+ - Ported to support Python 3.0 and Python 2.0 syntax.
201
+ - Added nvidia_smi.py tool as a sample app.
202
+
203
+ Version 3.295.0
204
+ - Added new functions for NVML 3.295. See NVML documentation for more information.
205
+ - Updated nvidia_smi.py tool
206
+ - Includes additional error handling
207
+
208
+ Version 4.304.0
209
+ - Added new functions for NVML 4.304. See NVML documentation for more information.
210
+ - Updated nvidia_smi.py tool
211
+
212
+ Version 4.304.3
213
+ - Fixing nvmlUnitGetDeviceCount bug
214
+
215
+ Version 5.319.0
216
+ - Added new functions for NVML 5.319. See NVML documentation for more information.
217
+
218
+ Version 6.340.0
219
+ - Added new functions for NVML 6.340. See NVML documentation for more information.
220
+
221
+ Version 7.346.0
222
+ - Added new functions for NVML 7.346. See NVML documentation for more information.
223
+
224
+ Version 7.352.0
225
+ - Added new functions for NVML 7.352. See NVML documentation for more information.
226
+
227
+ Version 10.418
228
+ - Added new functions for NVML 10.418. See NVML documentation for more information.
229
+ - Fixed issues with using the bindings with Python 3.x
230
+ - Replaced sample app nvidia_smi.py with example.py
231
+
232
+ Version 11.515.48
233
+ - Python3 support added
234
+ - Updated API to add function new to NVML, bringing pynvml up to date with NVML
235
+ - Added auto-version to handle byte and string conversion automatically for both structs and functions
236
+ - Minor bug fixes
237
+ - Added README.txt correctly in long_description for pypi.org
238
+
239
+ Version 11.520
240
+ - Updated Long Description to be actual markdown
241
+ - Added new functions for NVML 11.520
242
+
243
+ Version 11.525
244
+ - Added new functions for NVML 11.525
245
+
246
+ COPYRIGHT
247
+ ---------
248
+ Copyright (c) 2011-2023, NVIDIA Corporation. All rights reserved.
249
+
250
+ LICENSE
251
+ -------
252
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
253
+
254
+ - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
255
+
256
+ - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
257
+
258
+ - Neither the name of the NVIDIA Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
259
+
260
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
261
+
rtme/lib/python3.10/site-packages/nvidia_ml_py-12.570.86.dist-info/RECORD ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ example.py,sha256=mDXwPVyEDuiKeMApEh53r_M36xuncmzMpFOGA3Q-_Kw,7968
2
+ nvidia_ml_py-12.570.86.dist-info/INSTALLER,sha256=5hhM4Q4mYTT9z6QB6PGpUAW81PGNFrYrdXMj4oM_6ak,2
3
+ nvidia_ml_py-12.570.86.dist-info/METADATA,sha256=vY-jfk5MJsbWGy2jmbgdwfPKG4G0FHbspv-av_h5bEE,8718
4
+ nvidia_ml_py-12.570.86.dist-info/RECORD,,
5
+ nvidia_ml_py-12.570.86.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
+ nvidia_ml_py-12.570.86.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
7
+ nvidia_ml_py-12.570.86.dist-info/top_level.txt,sha256=wLINSA1WKnhsGgKsb_nuj51ZCQrXaN5qhioTL56g98A,15
8
+ pynvml.py,sha256=PCW5qJPhGshkIhIUOOQyUXsxkCVaPeTi30R7LsJb4YE,234473
rtme/lib/python3.10/site-packages/nvidia_ml_py-12.570.86.dist-info/REQUESTED ADDED
File without changes
rtme/lib/python3.10/site-packages/nvidia_ml_py-12.570.86.dist-info/WHEEL ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (75.8.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
rtme/lib/python3.10/site-packages/nvidia_ml_py-12.570.86.dist-info/top_level.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ example
2
+ pynvml
rtme/lib/python3.10/site-packages/pycparser-2.22.dist-info/INSTALLER ADDED
@@ -0,0 +1 @@
 
 
1
+ uv
rtme/lib/python3.10/site-packages/send2trash/exceptions.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import errno
2
+ from send2trash.compat import PY3
3
+
4
+ if PY3:
5
+ _permission_error = PermissionError # noqa: F821
6
+ else:
7
+ _permission_error = OSError
8
+
9
+
10
+ class TrashPermissionError(_permission_error):
11
+ """A permission error specific to a trash directory.
12
+
13
+ Raising this error indicates that permissions prevent us efficiently
14
+ trashing a file, although we might still have permission to delete it.
15
+ This is *not* used when permissions prevent removing the file itself:
16
+ that will be raised as a regular PermissionError (OSError on Python 2).
17
+
18
+ Application code that catches this may try to simply delete the file,
19
+ or prompt the user to decide, or (on Freedesktop platforms), move it to
20
+ 'home trash' as a fallback. This last option probably involves copying the
21
+ data between partitions, devices, or network drives, so we don't do it as
22
+ a fallback.
23
+ """
24
+
25
+ def __init__(self, filename):
26
+ _permission_error.__init__(self, errno.EACCES, "Permission denied", filename)
rtme/lib/python3.10/site-packages/send2trash/mac/__init__.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2017 Virgil Dupras
2
+
3
+ # This software is licensed under the "BSD" License as described in the "LICENSE" file,
4
+ # which should be included with this package. The terms are also available at
5
+ # http://www.hardcoded.net/licenses/bsd_license
6
+
7
+ from platform import mac_ver
8
+ from sys import version_info
9
+
10
+ # NOTE: version of pyobjc only supports python >= 3.6 and 10.9+
11
+ macos_ver = tuple(int(part) for part in mac_ver()[0].split("."))
12
+ if version_info >= (3, 6) and macos_ver >= (10, 9):
13
+ try:
14
+ from send2trash.mac.modern import send2trash
15
+ except ImportError:
16
+ # Try to fall back to ctypes version, although likely problematic still
17
+ from send2trash.mac.legacy import send2trash
18
+ else:
19
+ # Just use the old version otherwise
20
+ from send2trash.mac.legacy import send2trash # noqa: F401
rtme/lib/python3.10/site-packages/send2trash/mac/legacy.py ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2017 Virgil Dupras
2
+
3
+ # This software is licensed under the "BSD" License as described in the "LICENSE" file,
4
+ # which should be included with this package. The terms are also available at
5
+ # http://www.hardcoded.net/licenses/bsd_license
6
+
7
+ from __future__ import unicode_literals
8
+
9
+ from ctypes import cdll, byref, Structure, c_char, c_char_p
10
+ from ctypes.util import find_library
11
+
12
+ from send2trash.compat import binary_type
13
+ from send2trash.util import preprocess_paths
14
+
15
+ Foundation = cdll.LoadLibrary(find_library("Foundation"))
16
+ CoreServices = cdll.LoadLibrary(find_library("CoreServices"))
17
+
18
+ GetMacOSStatusCommentString = Foundation.GetMacOSStatusCommentString
19
+ GetMacOSStatusCommentString.restype = c_char_p
20
+ FSPathMakeRefWithOptions = CoreServices.FSPathMakeRefWithOptions
21
+ FSMoveObjectToTrashSync = CoreServices.FSMoveObjectToTrashSync
22
+
23
+ kFSPathMakeRefDefaultOptions = 0
24
+ kFSPathMakeRefDoNotFollowLeafSymlink = 0x01
25
+
26
+ kFSFileOperationDefaultOptions = 0
27
+ kFSFileOperationOverwrite = 0x01
28
+ kFSFileOperationSkipSourcePermissionErrors = 0x02
29
+ kFSFileOperationDoNotMoveAcrossVolumes = 0x04
30
+ kFSFileOperationSkipPreflight = 0x08
31
+
32
+
33
+ class FSRef(Structure):
34
+ _fields_ = [("hidden", c_char * 80)]
35
+
36
+
37
+ def check_op_result(op_result):
38
+ if op_result:
39
+ msg = GetMacOSStatusCommentString(op_result).decode("utf-8")
40
+ raise OSError(msg)
41
+
42
+
43
+ def send2trash(paths):
44
+ paths = preprocess_paths(paths)
45
+ paths = [path.encode("utf-8") if not isinstance(path, binary_type) else path for path in paths]
46
+ for path in paths:
47
+ fp = FSRef()
48
+ opts = kFSPathMakeRefDoNotFollowLeafSymlink
49
+ op_result = FSPathMakeRefWithOptions(path, opts, byref(fp), None)
50
+ check_op_result(op_result)
51
+ opts = kFSFileOperationDefaultOptions
52
+ op_result = FSMoveObjectToTrashSync(byref(fp), None, opts)
53
+ check_op_result(op_result)
rtme/lib/python3.10/site-packages/send2trash/mac/modern.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2017 Virgil Dupras
2
+
3
+ # This software is licensed under the "BSD" License as described in the "LICENSE" file,
4
+ # which should be included with this package. The terms are also available at
5
+ # http://www.hardcoded.net/licenses/bsd_license
6
+
7
+ from Foundation import NSFileManager, NSURL
8
+ from send2trash.compat import text_type
9
+ from send2trash.util import preprocess_paths
10
+
11
+
12
+ def check_op_result(op_result):
13
+ # First value will be false on failure
14
+ if not op_result[0]:
15
+ # Error is in third value, localized failure reason matchs ctypes version
16
+ raise OSError(op_result[2].localizedFailureReason())
17
+
18
+
19
+ def send2trash(paths):
20
+ paths = preprocess_paths(paths)
21
+ paths = [path.decode("utf-8") if not isinstance(path, text_type) else path for path in paths]
22
+ for path in paths:
23
+ file_url = NSURL.fileURLWithPath_(path)
24
+ fm = NSFileManager.defaultManager()
25
+ op_result = fm.trashItemAtURL_resultingItemURL_error_(file_url, None, None)
26
+ check_op_result(op_result)