ommlds 0.0.0.dev507__py3-none-any.whl → 0.0.0.dev508__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ommlds/.omlish-manifests.json +24 -0
- ommlds/backends/huggingface/__init__.py +0 -0
- ommlds/backends/{huggingface.py → huggingface/cache.py} +1 -6
- ommlds/backends/huggingface/cli.py +208 -0
- ommlds/backends/ollama/_dataclasses.py +452 -0
- ommlds/backends/ollama/cli.py +36 -0
- ommlds/backends/ollama/protocol.py +28 -0
- {ommlds-0.0.0.dev507.dist-info → ommlds-0.0.0.dev508.dist-info}/METADATA +4 -4
- {ommlds-0.0.0.dev507.dist-info → ommlds-0.0.0.dev508.dist-info}/RECORD +13 -10
- {ommlds-0.0.0.dev507.dist-info → ommlds-0.0.0.dev508.dist-info}/WHEEL +0 -0
- {ommlds-0.0.0.dev507.dist-info → ommlds-0.0.0.dev508.dist-info}/entry_points.txt +0 -0
- {ommlds-0.0.0.dev507.dist-info → ommlds-0.0.0.dev508.dist-info}/licenses/LICENSE +0 -0
- {ommlds-0.0.0.dev507.dist-info → ommlds-0.0.0.dev508.dist-info}/top_level.txt +0 -0
ommlds/.omlish-manifests.json
CHANGED
|
@@ -1,4 +1,28 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"module": ".backends.huggingface.cli",
|
|
4
|
+
"attr": "_CLI_MODULE",
|
|
5
|
+
"file": "ommlds/backends/huggingface/cli.py",
|
|
6
|
+
"line": 203,
|
|
7
|
+
"value": {
|
|
8
|
+
"!omdev.cli.types.CliModule": {
|
|
9
|
+
"name": "hf",
|
|
10
|
+
"module": "ommlds.backends.huggingface.cli"
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"module": ".backends.ollama.cli",
|
|
16
|
+
"attr": "_CLI_MODULE",
|
|
17
|
+
"file": "ommlds/backends/ollama/cli.py",
|
|
18
|
+
"line": 31,
|
|
19
|
+
"value": {
|
|
20
|
+
"!omdev.cli.types.CliModule": {
|
|
21
|
+
"name": "ollama",
|
|
22
|
+
"module": "ommlds.backends.ollama.cli"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
},
|
|
2
26
|
{
|
|
3
27
|
"module": ".cli.__main__",
|
|
4
28
|
"attr": null,
|
|
File without changes
|
|
@@ -11,15 +11,10 @@ from omlish import check
|
|
|
11
11
|
from omlish import lang
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
with lang.auto_proxy_import(globals()):
|
|
15
15
|
import huggingface_hub as hf
|
|
16
16
|
import huggingface_hub.errors # noqa
|
|
17
17
|
import huggingface_hub.utils # noqa
|
|
18
|
-
else:
|
|
19
|
-
hf = lang.proxy_import('huggingface_hub', extras=[
|
|
20
|
-
'errors',
|
|
21
|
-
'utils',
|
|
22
|
-
])
|
|
23
18
|
|
|
24
19
|
|
|
25
20
|
##
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import datetime
|
|
2
|
+
import os
|
|
3
|
+
import sys
|
|
4
|
+
import typing as ta
|
|
5
|
+
|
|
6
|
+
from omdev.cli import CliModule
|
|
7
|
+
from omlish import lang
|
|
8
|
+
from omlish.argparse import all as ap
|
|
9
|
+
from omlish.formats import json
|
|
10
|
+
from omlish.logs import all as logs
|
|
11
|
+
from omlish.term.confirm import confirm_action
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
with lang.auto_proxy_import(globals()):
|
|
15
|
+
import huggingface_hub as hf
|
|
16
|
+
import huggingface_hub.errors # noqa
|
|
17
|
+
import huggingface_hub.utils # noqa
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
log = logs.get_module_logger(globals())
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
##
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def fmt_ts(f: float) -> ta.Any:
|
|
27
|
+
dt = datetime.datetime.fromtimestamp(f) # noqa
|
|
28
|
+
return dt.isoformat()
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class Cli(ap.Cli):
|
|
32
|
+
def _passthrough_args_cmd(
|
|
33
|
+
self,
|
|
34
|
+
exe: str,
|
|
35
|
+
pre_args: ta.Sequence[str] = (),
|
|
36
|
+
post_args: ta.Sequence[str] = (),
|
|
37
|
+
) -> ta.NoReturn:
|
|
38
|
+
os.execvp(
|
|
39
|
+
exe,
|
|
40
|
+
[
|
|
41
|
+
sys.executable,
|
|
42
|
+
*pre_args,
|
|
43
|
+
*self.unknown_args,
|
|
44
|
+
*self.args.args,
|
|
45
|
+
*post_args,
|
|
46
|
+
],
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
@ap.cmd(
|
|
50
|
+
ap.arg('args', nargs=ap.REMAINDER),
|
|
51
|
+
name='cli',
|
|
52
|
+
accepts_unknown=True,
|
|
53
|
+
)
|
|
54
|
+
def cli_cmd(self) -> None:
|
|
55
|
+
self._passthrough_args_cmd(sys.executable, ['-m', 'huggingface_hub.cli.hf'])
|
|
56
|
+
|
|
57
|
+
#
|
|
58
|
+
|
|
59
|
+
@ap.cmd(
|
|
60
|
+
ap.arg('--dir'),
|
|
61
|
+
)
|
|
62
|
+
def scan(self) -> None:
|
|
63
|
+
hf_cache_info = hf.utils.scan_cache_dir(self.args.dir)
|
|
64
|
+
|
|
65
|
+
repo_dcts = [
|
|
66
|
+
{
|
|
67
|
+
'repo_id': repo.repo_id,
|
|
68
|
+
'repo_type': repo.repo_type,
|
|
69
|
+
|
|
70
|
+
'repo_path': str(repo.repo_path),
|
|
71
|
+
|
|
72
|
+
'size_on_disk': repo.size_on_disk,
|
|
73
|
+
'size_on_disk_str': repo.size_on_disk_str,
|
|
74
|
+
|
|
75
|
+
'nb_files': repo.nb_files,
|
|
76
|
+
|
|
77
|
+
'revisions': [
|
|
78
|
+
{
|
|
79
|
+
'commit_hash': rev.commit_hash,
|
|
80
|
+
|
|
81
|
+
'snapshot_path': str(rev.snapshot_path),
|
|
82
|
+
|
|
83
|
+
'size_on_disk': rev.size_on_disk,
|
|
84
|
+
|
|
85
|
+
'files': [
|
|
86
|
+
{
|
|
87
|
+
'file_name': file.file_name,
|
|
88
|
+
'file_path': str(file.file_path),
|
|
89
|
+
'blob_path': str(file.blob_path),
|
|
90
|
+
|
|
91
|
+
'size_on_disk': file.size_on_disk,
|
|
92
|
+
'size_on_disk_str': file.size_on_disk_str,
|
|
93
|
+
|
|
94
|
+
'blob_last_modified': fmt_ts(file.blob_last_modified),
|
|
95
|
+
'blob_last_modified_str': file.blob_last_modified_str,
|
|
96
|
+
'blob_last_accessed': fmt_ts(file.blob_last_accessed),
|
|
97
|
+
'blob_last_accessed_str': file.blob_last_accessed_str,
|
|
98
|
+
}
|
|
99
|
+
for file in sorted(rev.files, key=lambda file: file.blob_last_accessed)
|
|
100
|
+
],
|
|
101
|
+
|
|
102
|
+
'refs': sorted(rev.refs),
|
|
103
|
+
|
|
104
|
+
'last_modified': fmt_ts(rev.last_modified),
|
|
105
|
+
'last_modified_str': rev.last_modified_str,
|
|
106
|
+
|
|
107
|
+
}
|
|
108
|
+
for rev in sorted(repo.revisions, key=lambda rev: rev.last_modified)
|
|
109
|
+
],
|
|
110
|
+
|
|
111
|
+
'last_modified': fmt_ts(repo.last_modified),
|
|
112
|
+
'last_modified_str': repo.last_modified_str,
|
|
113
|
+
'last_accessed': fmt_ts(repo.last_accessed),
|
|
114
|
+
'last_accessed_str': repo.last_accessed_str,
|
|
115
|
+
|
|
116
|
+
'refs': sorted(repo.refs),
|
|
117
|
+
}
|
|
118
|
+
for repo in sorted(hf_cache_info.repos, key=lambda repo: repo.last_accessed)
|
|
119
|
+
]
|
|
120
|
+
|
|
121
|
+
print(json.dumps_pretty(repo_dcts))
|
|
122
|
+
|
|
123
|
+
@ap.cmd(
|
|
124
|
+
ap.arg('--dir'),
|
|
125
|
+
)
|
|
126
|
+
def list(self) -> None:
|
|
127
|
+
hf_cache_info = hf.utils.scan_cache_dir(self.args.dir)
|
|
128
|
+
|
|
129
|
+
repos = [
|
|
130
|
+
repo
|
|
131
|
+
for repo in hf_cache_info.repos
|
|
132
|
+
if repo.repo_type == 'model'
|
|
133
|
+
and repo.nb_files
|
|
134
|
+
]
|
|
135
|
+
|
|
136
|
+
repo_dcts = [
|
|
137
|
+
{
|
|
138
|
+
'repo_id': repo.repo_id,
|
|
139
|
+
'repo_type': repo.repo_type,
|
|
140
|
+
|
|
141
|
+
'repo_path': str(repo.repo_path),
|
|
142
|
+
|
|
143
|
+
'size_on_disk': repo.size_on_disk,
|
|
144
|
+
'size_on_disk_str': repo.size_on_disk_str,
|
|
145
|
+
|
|
146
|
+
'nb_files': repo.nb_files,
|
|
147
|
+
|
|
148
|
+
'last_modified': fmt_ts(repo.last_modified),
|
|
149
|
+
'last_modified_str': repo.last_modified_str,
|
|
150
|
+
'last_accessed': fmt_ts(repo.last_accessed),
|
|
151
|
+
'last_accessed_str': repo.last_accessed_str,
|
|
152
|
+
}
|
|
153
|
+
for repo in sorted(repos, key=lambda repo: repo.last_accessed)
|
|
154
|
+
]
|
|
155
|
+
|
|
156
|
+
print(json.dumps_pretty(repo_dcts))
|
|
157
|
+
|
|
158
|
+
@ap.cmd(
|
|
159
|
+
ap.arg('key', action='append'),
|
|
160
|
+
ap.arg('--dir'),
|
|
161
|
+
ap.arg('--dry-run', action='store_true'),
|
|
162
|
+
ap.arg('--no-confirm', action='store_true'),
|
|
163
|
+
)
|
|
164
|
+
def rm(self) -> None:
|
|
165
|
+
if not self.args.key:
|
|
166
|
+
raise ValueError('key is required')
|
|
167
|
+
|
|
168
|
+
hf_cache_info = hf.utils.scan_cache_dir(self.args.dir)
|
|
169
|
+
|
|
170
|
+
repos_by_id = {repo.repo_id: repo for repo in hf_cache_info.repos}
|
|
171
|
+
repos_by_rev = {rev.commit_hash: repo for repo in hf_cache_info.repos for rev in repo.revisions}
|
|
172
|
+
|
|
173
|
+
rm_revs: dict[str, None] = {}
|
|
174
|
+
|
|
175
|
+
for key in self.args.key:
|
|
176
|
+
if key in repos_by_id:
|
|
177
|
+
rm_revs.update({rev.commit_hash: None for rev in repos_by_id[key].revisions})
|
|
178
|
+
elif key in repos_by_rev:
|
|
179
|
+
rm_revs.update({key: None})
|
|
180
|
+
else:
|
|
181
|
+
raise ValueError(f'key {key} not found')
|
|
182
|
+
|
|
183
|
+
for rm_rev in rm_revs:
|
|
184
|
+
rm_repo = repos_by_rev[rm_rev]
|
|
185
|
+
|
|
186
|
+
if not self.args.no_confirm:
|
|
187
|
+
if not confirm_action(f'Delete {rm_repo.repo_id}@{rm_rev}?'):
|
|
188
|
+
return
|
|
189
|
+
|
|
190
|
+
if not self.args.dry_run:
|
|
191
|
+
strategy = hf_cache_info.delete_revisions(rm_rev)
|
|
192
|
+
strategy.execute()
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
##
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
def _main() -> None:
|
|
199
|
+
logs.configure_standard_logging('INFO')
|
|
200
|
+
Cli()()
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
# @omlish-manifest
|
|
204
|
+
_CLI_MODULE = CliModule('hf', __name__)
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
if __name__ == '__main__':
|
|
208
|
+
_main()
|
|
@@ -2008,6 +2008,249 @@ def _process_dataclass__d4de027591ccf1da84a98a2734b94a36c6340c4b():
|
|
|
2008
2008
|
return _process_dataclass
|
|
2009
2009
|
|
|
2010
2010
|
|
|
2011
|
+
@_register(
|
|
2012
|
+
plan_repr=(
|
|
2013
|
+
"Plans(tup=(CopyPlan(fields=('name', 'model', 'remote_model', 'remote_host', 'modified_at', 'size', 'digest', '"
|
|
2014
|
+
"details')), EqPlan(fields=('name', 'model', 'remote_model', 'remote_host', 'modified_at', 'size', 'digest', 'd"
|
|
2015
|
+
"etails')), FrozenPlan(fields=('name', 'model', 'remote_model', 'remote_host', 'modified_at', 'size', 'digest',"
|
|
2016
|
+
" 'details'), allow_dynamic_dunder_attrs=False), HashPlan(action='add', fields=('name', 'model', 'remote_model'"
|
|
2017
|
+
", 'remote_host', 'modified_at', 'size', 'digest', 'details'), cache=False), InitPlan(fields=(InitPlan.Field(na"
|
|
2018
|
+
"me='name', annotation=OpRef(name='init.fields.0.annotation'), default=None, default_factory=None, init=True, o"
|
|
2019
|
+
"verride=False, field_type=FieldType.INSTANCE, coerce=None, validate=None, check_type=None), InitPlan.Field(nam"
|
|
2020
|
+
"e='model', annotation=OpRef(name='init.fields.1.annotation'), default=None, default_factory=None, init=True, o"
|
|
2021
|
+
"verride=False, field_type=FieldType.INSTANCE, coerce=None, validate=None, check_type=None), InitPlan.Field(nam"
|
|
2022
|
+
"e='remote_model', annotation=OpRef(name='init.fields.2.annotation'), default=OpRef(name='init.fields.2.default"
|
|
2023
|
+
"'), default_factory=None, init=True, override=False, field_type=FieldType.INSTANCE, coerce=None, validate=None"
|
|
2024
|
+
", check_type=None), InitPlan.Field(name='remote_host', annotation=OpRef(name='init.fields.3.annotation'), defa"
|
|
2025
|
+
"ult=OpRef(name='init.fields.3.default'), default_factory=None, init=True, override=False, field_type=FieldType"
|
|
2026
|
+
".INSTANCE, coerce=None, validate=None, check_type=None), InitPlan.Field(name='modified_at', annotation=OpRef(n"
|
|
2027
|
+
"ame='init.fields.4.annotation'), default=None, default_factory=None, init=True, override=False, field_type=Fie"
|
|
2028
|
+
"ldType.INSTANCE, coerce=None, validate=None, check_type=None), InitPlan.Field(name='size', annotation=OpRef(na"
|
|
2029
|
+
"me='init.fields.5.annotation'), default=None, default_factory=None, init=True, override=False, field_type=Fiel"
|
|
2030
|
+
"dType.INSTANCE, coerce=None, validate=None, check_type=None), InitPlan.Field(name='digest', annotation=OpRef(n"
|
|
2031
|
+
"ame='init.fields.6.annotation'), default=None, default_factory=None, init=True, override=False, field_type=Fie"
|
|
2032
|
+
"ldType.INSTANCE, coerce=None, validate=None, check_type=None), InitPlan.Field(name='details', annotation=OpRef"
|
|
2033
|
+
"(name='init.fields.7.annotation'), default=OpRef(name='init.fields.7.default'), default_factory=None, init=Tru"
|
|
2034
|
+
"e, override=False, field_type=FieldType.INSTANCE, coerce=None, validate=None, check_type=None)), self_param='s"
|
|
2035
|
+
"elf', std_params=(), kw_only_params=('name', 'model', 'remote_model', 'remote_host', 'modified_at', 'size', 'd"
|
|
2036
|
+
"igest', 'details'), frozen=True, slots=False, post_init_params=None, init_fns=(), validate_fns=()), ReprPlan(f"
|
|
2037
|
+
"ields=(ReprPlan.Field(name='name', kw_only=True, fn=None), ReprPlan.Field(name='model', kw_only=True, fn=None)"
|
|
2038
|
+
", ReprPlan.Field(name='remote_model', kw_only=True, fn=None), ReprPlan.Field(name='remote_host', kw_only=True,"
|
|
2039
|
+
" fn=None), ReprPlan.Field(name='modified_at', kw_only=True, fn=None), ReprPlan.Field(name='size', kw_only=True"
|
|
2040
|
+
", fn=None), ReprPlan.Field(name='digest', kw_only=True, fn=None), ReprPlan.Field(name='details', kw_only=True,"
|
|
2041
|
+
" fn=None)), id=False, terse=False, default_fn=OpRef(name='repr.default_fn'))))"
|
|
2042
|
+
),
|
|
2043
|
+
plan_repr_sha1='39f7bcef98c1ad6b9fc898613abfef167e9b916f',
|
|
2044
|
+
op_ref_idents=(
|
|
2045
|
+
'__dataclass__init__fields__0__annotation',
|
|
2046
|
+
'__dataclass__init__fields__1__annotation',
|
|
2047
|
+
'__dataclass__init__fields__2__annotation',
|
|
2048
|
+
'__dataclass__init__fields__2__default',
|
|
2049
|
+
'__dataclass__init__fields__3__annotation',
|
|
2050
|
+
'__dataclass__init__fields__3__default',
|
|
2051
|
+
'__dataclass__init__fields__4__annotation',
|
|
2052
|
+
'__dataclass__init__fields__5__annotation',
|
|
2053
|
+
'__dataclass__init__fields__6__annotation',
|
|
2054
|
+
'__dataclass__init__fields__7__annotation',
|
|
2055
|
+
'__dataclass__init__fields__7__default',
|
|
2056
|
+
'__dataclass__repr__default_fn',
|
|
2057
|
+
),
|
|
2058
|
+
cls_names=(
|
|
2059
|
+
('ommlds.backends.ollama.protocol', 'ListModelResponse'),
|
|
2060
|
+
),
|
|
2061
|
+
)
|
|
2062
|
+
def _process_dataclass__39f7bcef98c1ad6b9fc898613abfef167e9b916f():
|
|
2063
|
+
def _process_dataclass(
|
|
2064
|
+
*,
|
|
2065
|
+
__dataclass__cls,
|
|
2066
|
+
__dataclass__init__fields__0__annotation,
|
|
2067
|
+
__dataclass__init__fields__1__annotation,
|
|
2068
|
+
__dataclass__init__fields__2__annotation,
|
|
2069
|
+
__dataclass__init__fields__2__default,
|
|
2070
|
+
__dataclass__init__fields__3__annotation,
|
|
2071
|
+
__dataclass__init__fields__3__default,
|
|
2072
|
+
__dataclass__init__fields__4__annotation,
|
|
2073
|
+
__dataclass__init__fields__5__annotation,
|
|
2074
|
+
__dataclass__init__fields__6__annotation,
|
|
2075
|
+
__dataclass__init__fields__7__annotation,
|
|
2076
|
+
__dataclass__init__fields__7__default,
|
|
2077
|
+
__dataclass__repr__default_fn,
|
|
2078
|
+
__dataclass__FieldFnValidationError, # noqa
|
|
2079
|
+
__dataclass__FieldTypeValidationError, # noqa
|
|
2080
|
+
__dataclass__FnValidationError, # noqa
|
|
2081
|
+
__dataclass__FrozenInstanceError=dataclasses.FrozenInstanceError, # noqa
|
|
2082
|
+
__dataclass__FunctionType=types.FunctionType, # noqa
|
|
2083
|
+
__dataclass__HAS_DEFAULT_FACTORY=dataclasses._HAS_DEFAULT_FACTORY, # noqa
|
|
2084
|
+
__dataclass__MISSING=dataclasses.MISSING, # noqa
|
|
2085
|
+
__dataclass__None=None, # noqa
|
|
2086
|
+
__dataclass__TypeError=TypeError, # noqa
|
|
2087
|
+
__dataclass___recursive_repr=reprlib.recursive_repr, # noqa
|
|
2088
|
+
__dataclass__isinstance=isinstance, # noqa
|
|
2089
|
+
__dataclass__object_setattr=object.__setattr__, # noqa
|
|
2090
|
+
__dataclass__property=property, # noqa
|
|
2091
|
+
):
|
|
2092
|
+
def __copy__(self):
|
|
2093
|
+
if self.__class__ is not __dataclass__cls:
|
|
2094
|
+
raise TypeError(self)
|
|
2095
|
+
return __dataclass__cls( # noqa
|
|
2096
|
+
name=self.name,
|
|
2097
|
+
model=self.model,
|
|
2098
|
+
remote_model=self.remote_model,
|
|
2099
|
+
remote_host=self.remote_host,
|
|
2100
|
+
modified_at=self.modified_at,
|
|
2101
|
+
size=self.size,
|
|
2102
|
+
digest=self.digest,
|
|
2103
|
+
details=self.details,
|
|
2104
|
+
)
|
|
2105
|
+
|
|
2106
|
+
__copy__.__qualname__ = f"{__dataclass__cls.__qualname__}.__copy__"
|
|
2107
|
+
if '__copy__' in __dataclass__cls.__dict__:
|
|
2108
|
+
raise __dataclass__TypeError(f"Cannot overwrite attribute __copy__ in class {__dataclass__cls.__name__}")
|
|
2109
|
+
setattr(__dataclass__cls, '__copy__', __copy__)
|
|
2110
|
+
|
|
2111
|
+
def __eq__(self, other):
|
|
2112
|
+
if self is other:
|
|
2113
|
+
return True
|
|
2114
|
+
if self.__class__ is not other.__class__:
|
|
2115
|
+
return NotImplemented
|
|
2116
|
+
return (
|
|
2117
|
+
self.name == other.name and
|
|
2118
|
+
self.model == other.model and
|
|
2119
|
+
self.remote_model == other.remote_model and
|
|
2120
|
+
self.remote_host == other.remote_host and
|
|
2121
|
+
self.modified_at == other.modified_at and
|
|
2122
|
+
self.size == other.size and
|
|
2123
|
+
self.digest == other.digest and
|
|
2124
|
+
self.details == other.details
|
|
2125
|
+
)
|
|
2126
|
+
|
|
2127
|
+
__eq__.__qualname__ = f"{__dataclass__cls.__qualname__}.__eq__"
|
|
2128
|
+
if '__eq__' in __dataclass__cls.__dict__:
|
|
2129
|
+
raise __dataclass__TypeError(f"Cannot overwrite attribute __eq__ in class {__dataclass__cls.__name__}")
|
|
2130
|
+
setattr(__dataclass__cls, '__eq__', __eq__)
|
|
2131
|
+
|
|
2132
|
+
__dataclass___setattr_frozen_fields = {
|
|
2133
|
+
'name',
|
|
2134
|
+
'model',
|
|
2135
|
+
'remote_model',
|
|
2136
|
+
'remote_host',
|
|
2137
|
+
'modified_at',
|
|
2138
|
+
'size',
|
|
2139
|
+
'digest',
|
|
2140
|
+
'details',
|
|
2141
|
+
}
|
|
2142
|
+
|
|
2143
|
+
def __setattr__(self, name, value):
|
|
2144
|
+
if (
|
|
2145
|
+
type(self) is __dataclass__cls
|
|
2146
|
+
or name in __dataclass___setattr_frozen_fields
|
|
2147
|
+
):
|
|
2148
|
+
raise __dataclass__FrozenInstanceError(f"cannot assign to field {name!r}")
|
|
2149
|
+
super(__dataclass__cls, self).__setattr__(name, value)
|
|
2150
|
+
|
|
2151
|
+
__setattr__.__qualname__ = f"{__dataclass__cls.__qualname__}.__setattr__"
|
|
2152
|
+
if '__setattr__' in __dataclass__cls.__dict__:
|
|
2153
|
+
raise __dataclass__TypeError(f"Cannot overwrite attribute __setattr__ in class {__dataclass__cls.__name__}")
|
|
2154
|
+
setattr(__dataclass__cls, '__setattr__', __setattr__)
|
|
2155
|
+
|
|
2156
|
+
__dataclass___delattr_frozen_fields = {
|
|
2157
|
+
'name',
|
|
2158
|
+
'model',
|
|
2159
|
+
'remote_model',
|
|
2160
|
+
'remote_host',
|
|
2161
|
+
'modified_at',
|
|
2162
|
+
'size',
|
|
2163
|
+
'digest',
|
|
2164
|
+
'details',
|
|
2165
|
+
}
|
|
2166
|
+
|
|
2167
|
+
def __delattr__(self, name):
|
|
2168
|
+
if (
|
|
2169
|
+
type(self) is __dataclass__cls
|
|
2170
|
+
or name in __dataclass___delattr_frozen_fields
|
|
2171
|
+
):
|
|
2172
|
+
raise __dataclass__FrozenInstanceError(f"cannot delete field {name!r}")
|
|
2173
|
+
super(__dataclass__cls, self).__delattr__(name)
|
|
2174
|
+
|
|
2175
|
+
__delattr__.__qualname__ = f"{__dataclass__cls.__qualname__}.__delattr__"
|
|
2176
|
+
if '__delattr__' in __dataclass__cls.__dict__:
|
|
2177
|
+
raise __dataclass__TypeError(f"Cannot overwrite attribute __delattr__ in class {__dataclass__cls.__name__}")
|
|
2178
|
+
setattr(__dataclass__cls, '__delattr__', __delattr__)
|
|
2179
|
+
|
|
2180
|
+
def __hash__(self):
|
|
2181
|
+
return hash((
|
|
2182
|
+
self.name,
|
|
2183
|
+
self.model,
|
|
2184
|
+
self.remote_model,
|
|
2185
|
+
self.remote_host,
|
|
2186
|
+
self.modified_at,
|
|
2187
|
+
self.size,
|
|
2188
|
+
self.digest,
|
|
2189
|
+
self.details,
|
|
2190
|
+
))
|
|
2191
|
+
|
|
2192
|
+
__hash__.__qualname__ = f"{__dataclass__cls.__qualname__}.__hash__"
|
|
2193
|
+
setattr(__dataclass__cls, '__hash__', __hash__)
|
|
2194
|
+
|
|
2195
|
+
def __init__(
|
|
2196
|
+
self,
|
|
2197
|
+
*,
|
|
2198
|
+
name: __dataclass__init__fields__0__annotation,
|
|
2199
|
+
model: __dataclass__init__fields__1__annotation,
|
|
2200
|
+
remote_model: __dataclass__init__fields__2__annotation = __dataclass__init__fields__2__default,
|
|
2201
|
+
remote_host: __dataclass__init__fields__3__annotation = __dataclass__init__fields__3__default,
|
|
2202
|
+
modified_at: __dataclass__init__fields__4__annotation,
|
|
2203
|
+
size: __dataclass__init__fields__5__annotation,
|
|
2204
|
+
digest: __dataclass__init__fields__6__annotation,
|
|
2205
|
+
details: __dataclass__init__fields__7__annotation = __dataclass__init__fields__7__default,
|
|
2206
|
+
) -> __dataclass__None:
|
|
2207
|
+
__dataclass__object_setattr(self, 'name', name)
|
|
2208
|
+
__dataclass__object_setattr(self, 'model', model)
|
|
2209
|
+
__dataclass__object_setattr(self, 'remote_model', remote_model)
|
|
2210
|
+
__dataclass__object_setattr(self, 'remote_host', remote_host)
|
|
2211
|
+
__dataclass__object_setattr(self, 'modified_at', modified_at)
|
|
2212
|
+
__dataclass__object_setattr(self, 'size', size)
|
|
2213
|
+
__dataclass__object_setattr(self, 'digest', digest)
|
|
2214
|
+
__dataclass__object_setattr(self, 'details', details)
|
|
2215
|
+
|
|
2216
|
+
__init__.__qualname__ = f"{__dataclass__cls.__qualname__}.__init__"
|
|
2217
|
+
if '__init__' in __dataclass__cls.__dict__:
|
|
2218
|
+
raise __dataclass__TypeError(f"Cannot overwrite attribute __init__ in class {__dataclass__cls.__name__}")
|
|
2219
|
+
setattr(__dataclass__cls, '__init__', __init__)
|
|
2220
|
+
|
|
2221
|
+
@__dataclass___recursive_repr()
|
|
2222
|
+
def __repr__(self):
|
|
2223
|
+
parts = []
|
|
2224
|
+
if (s := __dataclass__repr__default_fn(self.name)) is not None:
|
|
2225
|
+
parts.append(f"name={s}")
|
|
2226
|
+
if (s := __dataclass__repr__default_fn(self.model)) is not None:
|
|
2227
|
+
parts.append(f"model={s}")
|
|
2228
|
+
if (s := __dataclass__repr__default_fn(self.remote_model)) is not None:
|
|
2229
|
+
parts.append(f"remote_model={s}")
|
|
2230
|
+
if (s := __dataclass__repr__default_fn(self.remote_host)) is not None:
|
|
2231
|
+
parts.append(f"remote_host={s}")
|
|
2232
|
+
if (s := __dataclass__repr__default_fn(self.modified_at)) is not None:
|
|
2233
|
+
parts.append(f"modified_at={s}")
|
|
2234
|
+
if (s := __dataclass__repr__default_fn(self.size)) is not None:
|
|
2235
|
+
parts.append(f"size={s}")
|
|
2236
|
+
if (s := __dataclass__repr__default_fn(self.digest)) is not None:
|
|
2237
|
+
parts.append(f"digest={s}")
|
|
2238
|
+
if (s := __dataclass__repr__default_fn(self.details)) is not None:
|
|
2239
|
+
parts.append(f"details={s}")
|
|
2240
|
+
return (
|
|
2241
|
+
f"{self.__class__.__qualname__}("
|
|
2242
|
+
f"{', '.join(parts)}"
|
|
2243
|
+
f")"
|
|
2244
|
+
)
|
|
2245
|
+
|
|
2246
|
+
__repr__.__qualname__ = f"{__dataclass__cls.__qualname__}.__repr__"
|
|
2247
|
+
if '__repr__' in __dataclass__cls.__dict__:
|
|
2248
|
+
raise __dataclass__TypeError(f"Cannot overwrite attribute __repr__ in class {__dataclass__cls.__name__}")
|
|
2249
|
+
setattr(__dataclass__cls, '__repr__', __repr__)
|
|
2250
|
+
|
|
2251
|
+
return _process_dataclass
|
|
2252
|
+
|
|
2253
|
+
|
|
2011
2254
|
@_register(
|
|
2012
2255
|
plan_repr=(
|
|
2013
2256
|
"Plans(tup=(CopyPlan(fields=('role', 'content', 'thinking', 'images', 'tool_name', 'tool_calls')), EqPlan(field"
|
|
@@ -2541,6 +2784,215 @@ def _process_dataclass__c679b8dd972a245826381e3200fe81df0cd736c1():
|
|
|
2541
2784
|
return _process_dataclass
|
|
2542
2785
|
|
|
2543
2786
|
|
|
2787
|
+
@_register(
|
|
2788
|
+
plan_repr=(
|
|
2789
|
+
"Plans(tup=(CopyPlan(fields=('parent_model', 'format', 'family', 'families', 'parameter_size', 'quantization_le"
|
|
2790
|
+
"vel')), EqPlan(fields=('parent_model', 'format', 'family', 'families', 'parameter_size', 'quantization_level')"
|
|
2791
|
+
"), FrozenPlan(fields=('parent_model', 'format', 'family', 'families', 'parameter_size', 'quantization_level'),"
|
|
2792
|
+
" allow_dynamic_dunder_attrs=False), HashPlan(action='add', fields=('parent_model', 'format', 'family', 'famili"
|
|
2793
|
+
"es', 'parameter_size', 'quantization_level'), cache=False), InitPlan(fields=(InitPlan.Field(name='parent_model"
|
|
2794
|
+
"', annotation=OpRef(name='init.fields.0.annotation'), default=None, default_factory=None, init=True, override="
|
|
2795
|
+
"False, field_type=FieldType.INSTANCE, coerce=None, validate=None, check_type=None), InitPlan.Field(name='forma"
|
|
2796
|
+
"t', annotation=OpRef(name='init.fields.1.annotation'), default=None, default_factory=None, init=True, override"
|
|
2797
|
+
"=False, field_type=FieldType.INSTANCE, coerce=None, validate=None, check_type=None), InitPlan.Field(name='fami"
|
|
2798
|
+
"ly', annotation=OpRef(name='init.fields.2.annotation'), default=None, default_factory=None, init=True, overrid"
|
|
2799
|
+
"e=False, field_type=FieldType.INSTANCE, coerce=None, validate=None, check_type=None), InitPlan.Field(name='fam"
|
|
2800
|
+
"ilies', annotation=OpRef(name='init.fields.3.annotation'), default=None, default_factory=None, init=True, over"
|
|
2801
|
+
"ride=False, field_type=FieldType.INSTANCE, coerce=None, validate=None, check_type=None), InitPlan.Field(name='"
|
|
2802
|
+
"parameter_size', annotation=OpRef(name='init.fields.4.annotation'), default=None, default_factory=None, init=T"
|
|
2803
|
+
"rue, override=False, field_type=FieldType.INSTANCE, coerce=None, validate=None, check_type=None), InitPlan.Fie"
|
|
2804
|
+
"ld(name='quantization_level', annotation=OpRef(name='init.fields.5.annotation'), default=None, default_factory"
|
|
2805
|
+
"=None, init=True, override=False, field_type=FieldType.INSTANCE, coerce=None, validate=None, check_type=None))"
|
|
2806
|
+
", self_param='self', std_params=(), kw_only_params=('parent_model', 'format', 'family', 'families', 'parameter"
|
|
2807
|
+
"_size', 'quantization_level'), frozen=True, slots=False, post_init_params=None, init_fns=(), validate_fns=()),"
|
|
2808
|
+
" ReprPlan(fields=(ReprPlan.Field(name='parent_model', kw_only=True, fn=None), ReprPlan.Field(name='format', kw"
|
|
2809
|
+
"_only=True, fn=None), ReprPlan.Field(name='family', kw_only=True, fn=None), ReprPlan.Field(name='families', kw"
|
|
2810
|
+
"_only=True, fn=None), ReprPlan.Field(name='parameter_size', kw_only=True, fn=None), ReprPlan.Field(name='quant"
|
|
2811
|
+
"ization_level', kw_only=True, fn=None)), id=False, terse=False, default_fn=OpRef(name='repr.default_fn'))))"
|
|
2812
|
+
),
|
|
2813
|
+
plan_repr_sha1='6d086e850feb59746e721b8edda1c8a1d7256381',
|
|
2814
|
+
op_ref_idents=(
|
|
2815
|
+
'__dataclass__init__fields__0__annotation',
|
|
2816
|
+
'__dataclass__init__fields__1__annotation',
|
|
2817
|
+
'__dataclass__init__fields__2__annotation',
|
|
2818
|
+
'__dataclass__init__fields__3__annotation',
|
|
2819
|
+
'__dataclass__init__fields__4__annotation',
|
|
2820
|
+
'__dataclass__init__fields__5__annotation',
|
|
2821
|
+
'__dataclass__repr__default_fn',
|
|
2822
|
+
),
|
|
2823
|
+
cls_names=(
|
|
2824
|
+
('ommlds.backends.ollama.protocol', 'ModelDetails'),
|
|
2825
|
+
),
|
|
2826
|
+
)
|
|
2827
|
+
def _process_dataclass__6d086e850feb59746e721b8edda1c8a1d7256381():
|
|
2828
|
+
def _process_dataclass(
|
|
2829
|
+
*,
|
|
2830
|
+
__dataclass__cls,
|
|
2831
|
+
__dataclass__init__fields__0__annotation,
|
|
2832
|
+
__dataclass__init__fields__1__annotation,
|
|
2833
|
+
__dataclass__init__fields__2__annotation,
|
|
2834
|
+
__dataclass__init__fields__3__annotation,
|
|
2835
|
+
__dataclass__init__fields__4__annotation,
|
|
2836
|
+
__dataclass__init__fields__5__annotation,
|
|
2837
|
+
__dataclass__repr__default_fn,
|
|
2838
|
+
__dataclass__FieldFnValidationError, # noqa
|
|
2839
|
+
__dataclass__FieldTypeValidationError, # noqa
|
|
2840
|
+
__dataclass__FnValidationError, # noqa
|
|
2841
|
+
__dataclass__FrozenInstanceError=dataclasses.FrozenInstanceError, # noqa
|
|
2842
|
+
__dataclass__FunctionType=types.FunctionType, # noqa
|
|
2843
|
+
__dataclass__HAS_DEFAULT_FACTORY=dataclasses._HAS_DEFAULT_FACTORY, # noqa
|
|
2844
|
+
__dataclass__MISSING=dataclasses.MISSING, # noqa
|
|
2845
|
+
__dataclass__None=None, # noqa
|
|
2846
|
+
__dataclass__TypeError=TypeError, # noqa
|
|
2847
|
+
__dataclass___recursive_repr=reprlib.recursive_repr, # noqa
|
|
2848
|
+
__dataclass__isinstance=isinstance, # noqa
|
|
2849
|
+
__dataclass__object_setattr=object.__setattr__, # noqa
|
|
2850
|
+
__dataclass__property=property, # noqa
|
|
2851
|
+
):
|
|
2852
|
+
def __copy__(self):
|
|
2853
|
+
if self.__class__ is not __dataclass__cls:
|
|
2854
|
+
raise TypeError(self)
|
|
2855
|
+
return __dataclass__cls( # noqa
|
|
2856
|
+
parent_model=self.parent_model,
|
|
2857
|
+
format=self.format,
|
|
2858
|
+
family=self.family,
|
|
2859
|
+
families=self.families,
|
|
2860
|
+
parameter_size=self.parameter_size,
|
|
2861
|
+
quantization_level=self.quantization_level,
|
|
2862
|
+
)
|
|
2863
|
+
|
|
2864
|
+
__copy__.__qualname__ = f"{__dataclass__cls.__qualname__}.__copy__"
|
|
2865
|
+
if '__copy__' in __dataclass__cls.__dict__:
|
|
2866
|
+
raise __dataclass__TypeError(f"Cannot overwrite attribute __copy__ in class {__dataclass__cls.__name__}")
|
|
2867
|
+
setattr(__dataclass__cls, '__copy__', __copy__)
|
|
2868
|
+
|
|
2869
|
+
def __eq__(self, other):
|
|
2870
|
+
if self is other:
|
|
2871
|
+
return True
|
|
2872
|
+
if self.__class__ is not other.__class__:
|
|
2873
|
+
return NotImplemented
|
|
2874
|
+
return (
|
|
2875
|
+
self.parent_model == other.parent_model and
|
|
2876
|
+
self.format == other.format and
|
|
2877
|
+
self.family == other.family and
|
|
2878
|
+
self.families == other.families and
|
|
2879
|
+
self.parameter_size == other.parameter_size and
|
|
2880
|
+
self.quantization_level == other.quantization_level
|
|
2881
|
+
)
|
|
2882
|
+
|
|
2883
|
+
__eq__.__qualname__ = f"{__dataclass__cls.__qualname__}.__eq__"
|
|
2884
|
+
if '__eq__' in __dataclass__cls.__dict__:
|
|
2885
|
+
raise __dataclass__TypeError(f"Cannot overwrite attribute __eq__ in class {__dataclass__cls.__name__}")
|
|
2886
|
+
setattr(__dataclass__cls, '__eq__', __eq__)
|
|
2887
|
+
|
|
2888
|
+
__dataclass___setattr_frozen_fields = {
|
|
2889
|
+
'parent_model',
|
|
2890
|
+
'format',
|
|
2891
|
+
'family',
|
|
2892
|
+
'families',
|
|
2893
|
+
'parameter_size',
|
|
2894
|
+
'quantization_level',
|
|
2895
|
+
}
|
|
2896
|
+
|
|
2897
|
+
def __setattr__(self, name, value):
|
|
2898
|
+
if (
|
|
2899
|
+
type(self) is __dataclass__cls
|
|
2900
|
+
or name in __dataclass___setattr_frozen_fields
|
|
2901
|
+
):
|
|
2902
|
+
raise __dataclass__FrozenInstanceError(f"cannot assign to field {name!r}")
|
|
2903
|
+
super(__dataclass__cls, self).__setattr__(name, value)
|
|
2904
|
+
|
|
2905
|
+
__setattr__.__qualname__ = f"{__dataclass__cls.__qualname__}.__setattr__"
|
|
2906
|
+
if '__setattr__' in __dataclass__cls.__dict__:
|
|
2907
|
+
raise __dataclass__TypeError(f"Cannot overwrite attribute __setattr__ in class {__dataclass__cls.__name__}")
|
|
2908
|
+
setattr(__dataclass__cls, '__setattr__', __setattr__)
|
|
2909
|
+
|
|
2910
|
+
__dataclass___delattr_frozen_fields = {
|
|
2911
|
+
'parent_model',
|
|
2912
|
+
'format',
|
|
2913
|
+
'family',
|
|
2914
|
+
'families',
|
|
2915
|
+
'parameter_size',
|
|
2916
|
+
'quantization_level',
|
|
2917
|
+
}
|
|
2918
|
+
|
|
2919
|
+
def __delattr__(self, name):
|
|
2920
|
+
if (
|
|
2921
|
+
type(self) is __dataclass__cls
|
|
2922
|
+
or name in __dataclass___delattr_frozen_fields
|
|
2923
|
+
):
|
|
2924
|
+
raise __dataclass__FrozenInstanceError(f"cannot delete field {name!r}")
|
|
2925
|
+
super(__dataclass__cls, self).__delattr__(name)
|
|
2926
|
+
|
|
2927
|
+
__delattr__.__qualname__ = f"{__dataclass__cls.__qualname__}.__delattr__"
|
|
2928
|
+
if '__delattr__' in __dataclass__cls.__dict__:
|
|
2929
|
+
raise __dataclass__TypeError(f"Cannot overwrite attribute __delattr__ in class {__dataclass__cls.__name__}")
|
|
2930
|
+
setattr(__dataclass__cls, '__delattr__', __delattr__)
|
|
2931
|
+
|
|
2932
|
+
def __hash__(self):
|
|
2933
|
+
return hash((
|
|
2934
|
+
self.parent_model,
|
|
2935
|
+
self.format,
|
|
2936
|
+
self.family,
|
|
2937
|
+
self.families,
|
|
2938
|
+
self.parameter_size,
|
|
2939
|
+
self.quantization_level,
|
|
2940
|
+
))
|
|
2941
|
+
|
|
2942
|
+
__hash__.__qualname__ = f"{__dataclass__cls.__qualname__}.__hash__"
|
|
2943
|
+
setattr(__dataclass__cls, '__hash__', __hash__)
|
|
2944
|
+
|
|
2945
|
+
def __init__(
|
|
2946
|
+
self,
|
|
2947
|
+
*,
|
|
2948
|
+
parent_model: __dataclass__init__fields__0__annotation,
|
|
2949
|
+
format: __dataclass__init__fields__1__annotation,
|
|
2950
|
+
family: __dataclass__init__fields__2__annotation,
|
|
2951
|
+
families: __dataclass__init__fields__3__annotation,
|
|
2952
|
+
parameter_size: __dataclass__init__fields__4__annotation,
|
|
2953
|
+
quantization_level: __dataclass__init__fields__5__annotation,
|
|
2954
|
+
) -> __dataclass__None:
|
|
2955
|
+
__dataclass__object_setattr(self, 'parent_model', parent_model)
|
|
2956
|
+
__dataclass__object_setattr(self, 'format', format)
|
|
2957
|
+
__dataclass__object_setattr(self, 'family', family)
|
|
2958
|
+
__dataclass__object_setattr(self, 'families', families)
|
|
2959
|
+
__dataclass__object_setattr(self, 'parameter_size', parameter_size)
|
|
2960
|
+
__dataclass__object_setattr(self, 'quantization_level', quantization_level)
|
|
2961
|
+
|
|
2962
|
+
__init__.__qualname__ = f"{__dataclass__cls.__qualname__}.__init__"
|
|
2963
|
+
if '__init__' in __dataclass__cls.__dict__:
|
|
2964
|
+
raise __dataclass__TypeError(f"Cannot overwrite attribute __init__ in class {__dataclass__cls.__name__}")
|
|
2965
|
+
setattr(__dataclass__cls, '__init__', __init__)
|
|
2966
|
+
|
|
2967
|
+
@__dataclass___recursive_repr()
|
|
2968
|
+
def __repr__(self):
|
|
2969
|
+
parts = []
|
|
2970
|
+
if (s := __dataclass__repr__default_fn(self.parent_model)) is not None:
|
|
2971
|
+
parts.append(f"parent_model={s}")
|
|
2972
|
+
if (s := __dataclass__repr__default_fn(self.format)) is not None:
|
|
2973
|
+
parts.append(f"format={s}")
|
|
2974
|
+
if (s := __dataclass__repr__default_fn(self.family)) is not None:
|
|
2975
|
+
parts.append(f"family={s}")
|
|
2976
|
+
if (s := __dataclass__repr__default_fn(self.families)) is not None:
|
|
2977
|
+
parts.append(f"families={s}")
|
|
2978
|
+
if (s := __dataclass__repr__default_fn(self.parameter_size)) is not None:
|
|
2979
|
+
parts.append(f"parameter_size={s}")
|
|
2980
|
+
if (s := __dataclass__repr__default_fn(self.quantization_level)) is not None:
|
|
2981
|
+
parts.append(f"quantization_level={s}")
|
|
2982
|
+
return (
|
|
2983
|
+
f"{self.__class__.__qualname__}("
|
|
2984
|
+
f"{', '.join(parts)}"
|
|
2985
|
+
f")"
|
|
2986
|
+
)
|
|
2987
|
+
|
|
2988
|
+
__repr__.__qualname__ = f"{__dataclass__cls.__qualname__}.__repr__"
|
|
2989
|
+
if '__repr__' in __dataclass__cls.__dict__:
|
|
2990
|
+
raise __dataclass__TypeError(f"Cannot overwrite attribute __repr__ in class {__dataclass__cls.__name__}")
|
|
2991
|
+
setattr(__dataclass__cls, '__repr__', __repr__)
|
|
2992
|
+
|
|
2993
|
+
return _process_dataclass
|
|
2994
|
+
|
|
2995
|
+
|
|
2544
2996
|
@_register(
|
|
2545
2997
|
plan_repr=(
|
|
2546
2998
|
"Plans(tup=(CopyPlan(fields=('numa', 'num_ctx', 'num_batch', 'num_gpu', 'main_gpu', 'low_vram', 'f16_kv', 'logi"
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
from omdev.cli import CliModule
|
|
2
|
+
from omlish import check
|
|
3
|
+
from omlish.argparse import all as ap
|
|
4
|
+
from omlish.formats import json
|
|
5
|
+
from omlish.http import all as http
|
|
6
|
+
from omlish.logs import all as logs
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
log = logs.get_module_logger(globals())
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
##
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class Cli(ap.Cli):
|
|
16
|
+
@ap.cmd()
|
|
17
|
+
def list(self) -> None:
|
|
18
|
+
resp = http.request('http://localhost:11434/api/tags', check=True)
|
|
19
|
+
data = json.loads(check.not_none(resp.data).decode('utf-8'))
|
|
20
|
+
print(json.dumps_pretty(data))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
##
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def _main() -> None:
|
|
27
|
+
logs.configure_standard_logging('INFO')
|
|
28
|
+
Cli()()
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
# @omlish-manifest
|
|
32
|
+
_CLI_MODULE = CliModule('ollama', __name__)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
if __name__ == '__main__':
|
|
36
|
+
_main()
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"""
|
|
2
2
|
https://docs.ollama.com/api
|
|
3
3
|
"""
|
|
4
|
+
import datetime
|
|
4
5
|
import typing as ta
|
|
5
6
|
|
|
6
7
|
from omlish import dataclasses as dc
|
|
@@ -171,3 +172,30 @@ class ChatRequest(BaseGenerateRequest):
|
|
|
171
172
|
@dc.extra_class_params(default_repr_fn=lang.opt_repr)
|
|
172
173
|
class ChatResponse(BaseGenerateResponse):
|
|
173
174
|
message: Message
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
##
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
@dc.dataclass(frozen=True, kw_only=True)
|
|
181
|
+
@dc.extra_class_params(default_repr_fn=lang.opt_repr)
|
|
182
|
+
class ModelDetails:
|
|
183
|
+
parent_model: str
|
|
184
|
+
format: str
|
|
185
|
+
family: str
|
|
186
|
+
families: ta.Sequence[str]
|
|
187
|
+
parameter_size: str
|
|
188
|
+
quantization_level: str
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
@dc.dataclass(frozen=True, kw_only=True)
|
|
192
|
+
@dc.extra_class_params(default_repr_fn=lang.opt_repr)
|
|
193
|
+
class ListModelResponse:
|
|
194
|
+
name: str
|
|
195
|
+
model: str
|
|
196
|
+
remote_model: str | None = None
|
|
197
|
+
remote_host: str | None = None
|
|
198
|
+
modified_at: datetime.datetime
|
|
199
|
+
size: int
|
|
200
|
+
digest: str
|
|
201
|
+
details: ModelDetails | None = None
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ommlds
|
|
3
|
-
Version: 0.0.0.
|
|
3
|
+
Version: 0.0.0.dev508
|
|
4
4
|
Summary: ommlds
|
|
5
5
|
Author: wrmsr
|
|
6
6
|
License-Expression: BSD-3-Clause
|
|
@@ -14,9 +14,9 @@ Classifier: Programming Language :: Python :: 3.13
|
|
|
14
14
|
Requires-Python: >=3.13
|
|
15
15
|
Description-Content-Type: text/markdown
|
|
16
16
|
License-File: LICENSE
|
|
17
|
-
Requires-Dist: omlish==0.0.0.
|
|
17
|
+
Requires-Dist: omlish==0.0.0.dev508
|
|
18
18
|
Provides-Extra: all
|
|
19
|
-
Requires-Dist: omdev==0.0.0.
|
|
19
|
+
Requires-Dist: omdev==0.0.0.dev508; extra == "all"
|
|
20
20
|
Requires-Dist: llama-cpp-python~=0.3; extra == "all"
|
|
21
21
|
Requires-Dist: mlx~=0.30; sys_platform == "darwin" and extra == "all"
|
|
22
22
|
Requires-Dist: mlx-lm~=0.29; sys_platform == "darwin" and extra == "all"
|
|
@@ -38,7 +38,7 @@ Requires-Dist: mwparserfromhell~=0.7; extra == "all"
|
|
|
38
38
|
Requires-Dist: wikitextparser~=0.56; extra == "all"
|
|
39
39
|
Requires-Dist: lxml>=5.3; python_version < "3.13" and extra == "all"
|
|
40
40
|
Provides-Extra: omdev
|
|
41
|
-
Requires-Dist: omdev==0.0.0.
|
|
41
|
+
Requires-Dist: omdev==0.0.0.dev508; extra == "omdev"
|
|
42
42
|
Provides-Extra: backends
|
|
43
43
|
Requires-Dist: llama-cpp-python~=0.3; extra == "backends"
|
|
44
44
|
Requires-Dist: mlx~=0.30; sys_platform == "darwin" and extra == "backends"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
ommlds/.omlish-manifests.json,sha256=
|
|
1
|
+
ommlds/.omlish-manifests.json,sha256=PihtJmB7EFRQ5MHZTzfq6GOST1683niUqHZJDFc0vmw,28921
|
|
2
2
|
ommlds/README.md,sha256=xhbl2n19GznXrIzAGdlX8PAYJYsOo_Zu63I7G1UFRZE,398
|
|
3
3
|
ommlds/__about__.py,sha256=5uwlSH3-Tf8nr0wsDL7kYqAQ_lI21WAYbTlAlGLtwyI,1901
|
|
4
4
|
ommlds/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -8,7 +8,6 @@ ommlds/_hacks/names.py,sha256=01XSF-Rd0nLGb7oA0Jg1R9MtkOk0jfUhIO5CPyA-s6M,4690
|
|
|
8
8
|
ommlds/_hacks/params.py,sha256=FihwXN6RAvQR1HqEemTRL_ivEr8WOlirH1sZ-lM3vgM,1725
|
|
9
9
|
ommlds/_hacks/patches.py,sha256=Dsz4GcgRXd1zi18jiDO2C_8IF12VTsysjthiOQz-h80,1871
|
|
10
10
|
ommlds/backends/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
11
|
-
ommlds/backends/huggingface.py,sha256=JfEyfKOxU3-SY_ojtXBJFNeD-NIuKjvMe3GL3e93wNA,1175
|
|
12
11
|
ommlds/backends/anthropic/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
13
12
|
ommlds/backends/anthropic/protocol/__init__.py,sha256=g05gJKHqrySqtvMBAaZUueRxYafBTGOLw7FfEDiXi34,248
|
|
14
13
|
ommlds/backends/anthropic/protocol/_dataclasses.py,sha256=LJGB0yaRbdwRgNlMR0nDQrYRk4uv9R7mtRZDcjR91nw,80681
|
|
@@ -32,6 +31,9 @@ ommlds/backends/groq/_dataclasses.py,sha256=8XK7IEEJNGqSFib_s3dFf2bMH1TJ1RT-NvGB
|
|
|
32
31
|
ommlds/backends/groq/_marshal.py,sha256=3o4CVK9VbP_UnEbXZ4fQJuZK3Sy9xnkXTTempSDSvgE,602
|
|
33
32
|
ommlds/backends/groq/clients.py,sha256=n1zvVPvk5lJ42JMSSU3EFGYUJ9Az-YAOU6DTGNsJ8_M,152
|
|
34
33
|
ommlds/backends/groq/protocol.py,sha256=IdsDwxQEcYJ0slLuZOqJiRHXvZ1pYShEBpIrevb40SU,7764
|
|
34
|
+
ommlds/backends/huggingface/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
35
|
+
ommlds/backends/huggingface/cache.py,sha256=Ff5vWNQCgABURSS0XxAbhdoHt5a5c6MgP0qDs6mlErc,1091
|
|
36
|
+
ommlds/backends/huggingface/cli.py,sha256=GdnXIYAiZdJcd15c1LgxIaNc14UifqQ44WBwRYMa0p0,6091
|
|
35
37
|
ommlds/backends/llamacpp/__init__.py,sha256=zXFpLXE4a2vEl0jcPDyKlPHHfZ3Z8Dz0twhEIyZ8-vg,59
|
|
36
38
|
ommlds/backends/llamacpp/buildwheel.py,sha256=q9ghCLVbm8Jm6syrZlBP-x1qNDd0wSl15B2OXBtDBQ8,3813
|
|
37
39
|
ommlds/backends/llamacpp/logging.py,sha256=qLTDd3JdnB-wEQ51fBJra-oTid5kO-ezHHFP7FBPcio,933
|
|
@@ -53,8 +55,9 @@ ommlds/backends/mlx/tokenization/detokenization/bpe.py,sha256=cIw6-r-cyXTfZdyfGR
|
|
|
53
55
|
ommlds/backends/mlx/tokenization/detokenization/naive.py,sha256=6L-SvphzP1z16cmVB4QC9VraF7khE8ZcvKqIwwFqN6U,1779
|
|
54
56
|
ommlds/backends/mlx/tokenization/detokenization/spm.py,sha256=IYSnEm-C0z_o5TKLJE_Rj6P0nNd-prT6psVPKsERWAE,1751
|
|
55
57
|
ommlds/backends/ollama/__init__.py,sha256=-RtLrdEGN2da1KCf7YNs32jN-kJhT_kNVrcOv4x_J-w,101
|
|
56
|
-
ommlds/backends/ollama/_dataclasses.py,sha256=
|
|
57
|
-
ommlds/backends/ollama/
|
|
58
|
+
ommlds/backends/ollama/_dataclasses.py,sha256=SxyfdM4Bv8iXlSQ2RoiMXFNM9MyjTAOFIPPr_JIMTsk,211794
|
|
59
|
+
ommlds/backends/ollama/cli.py,sha256=zqZx74aNLTc-PVB6zJIxs45Je9TsbttIq8h4uaSybzA,682
|
|
60
|
+
ommlds/backends/ollama/protocol.py,sha256=nw0RBApBYYnncXmwOA7mULo4dwI_ObpUaybYVU3F3Pk,5123
|
|
58
61
|
ommlds/backends/openai/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
59
62
|
ommlds/backends/openai/protocol/__init__.py,sha256=S-p81JfMaS0nwdII9jyhcmj0c5fJJD5sHwphnY45WdI,1862
|
|
60
63
|
ommlds/backends/openai/protocol/_common.py,sha256=ydO083WKkqyYz1Y5aeRISChcDHg1Dv2cZx62KNPsQnk,254
|
|
@@ -516,9 +519,9 @@ ommlds/wiki/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU
|
|
|
516
519
|
ommlds/wiki/utils/io.py,sha256=UKgDJGtmpnWvIqVd2mJc2QNPOqlToEY1GEveNp6_pMo,7088
|
|
517
520
|
ommlds/wiki/utils/progress.py,sha256=EhvKcMFYtsarCQhIahlO6f0SboyAKP3UwUyrnVnP-Vk,3222
|
|
518
521
|
ommlds/wiki/utils/xml.py,sha256=sNJNkZ9rT8B-kJMO6bRz8J1USy4fyPx0m2PwTX7vxYY,3846
|
|
519
|
-
ommlds-0.0.0.
|
|
520
|
-
ommlds-0.0.0.
|
|
521
|
-
ommlds-0.0.0.
|
|
522
|
-
ommlds-0.0.0.
|
|
523
|
-
ommlds-0.0.0.
|
|
524
|
-
ommlds-0.0.0.
|
|
522
|
+
ommlds-0.0.0.dev508.dist-info/licenses/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
|
|
523
|
+
ommlds-0.0.0.dev508.dist-info/METADATA,sha256=M4dhZq42dxr1rI3U3dl8D0I874PVq37zjwjJUzeSdPE,3495
|
|
524
|
+
ommlds-0.0.0.dev508.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
525
|
+
ommlds-0.0.0.dev508.dist-info/entry_points.txt,sha256=Z5YWtX7ClfiCKdW-dd_CSVvM0h4yQpJPi-2G3q6gNFo,35
|
|
526
|
+
ommlds-0.0.0.dev508.dist-info/top_level.txt,sha256=Rbnk5d5wi58vnAXx13WFZqdQ4VX8hBCS2hEL3WeXOhY,7
|
|
527
|
+
ommlds-0.0.0.dev508.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|