prefer-inference-core 0.0.0-g0be6ef9
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.
- package/LICENSE +21 -0
- package/README.md +166 -0
- package/dist/catalog.d.ts +27 -0
- package/dist/catalog.d.ts.map +1 -0
- package/dist/catalog.js +547 -0
- package/dist/catalog.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +412 -0
- package/dist/cli.js.map +1 -0
- package/dist/huggingface.d.ts +18 -0
- package/dist/huggingface.d.ts.map +1 -0
- package/dist/huggingface.js +296 -0
- package/dist/huggingface.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/planning.d.ts +11 -0
- package/dist/planning.d.ts.map +1 -0
- package/dist/planning.js +610 -0
- package/dist/planning.js.map +1 -0
- package/dist/prefer.mjs +9493 -0
- package/dist/prefer.mjs.map +7 -0
- package/dist/releases.d.ts +33 -0
- package/dist/releases.d.ts.map +1 -0
- package/dist/releases.js +288 -0
- package/dist/releases.js.map +1 -0
- package/dist/resources.d.ts +10 -0
- package/dist/resources.d.ts.map +1 -0
- package/dist/resources.js +250 -0
- package/dist/resources.js.map +1 -0
- package/dist/types.d.ts +409 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/utils.d.ts +20 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +112 -0
- package/dist/utils.js.map +1 -0
- package/package.json +58 -0
- package/schemas/prefer-model-catalog-extension.schema.json +25 -0
- package/schemas/prefer-model-catalog.schema.json +54 -0
- package/schemas/prefer-model-plan.schema.json +115 -0
- package/schemas/prefer-resource-profile.schema.json +70 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://github.com/cvalusek/PreFer/blob/develop/catalog/model-catalog-extension.schema.json",
|
|
4
|
+
"title": "PreFer runtime Hugging Face catalog extension",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": ["schema_version", "generated_at", "repositories", "models"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"schema_version": {"const": "prefer.model-catalog-extension.v1"},
|
|
10
|
+
"generated_at": {"type": "string", "format": "date-time"},
|
|
11
|
+
"repositories": {"type": "object", "additionalProperties": {"type": "object"}},
|
|
12
|
+
"models": {
|
|
13
|
+
"type": "object",
|
|
14
|
+
"additionalProperties": {
|
|
15
|
+
"type": "object",
|
|
16
|
+
"additionalProperties": false,
|
|
17
|
+
"required": ["repository", "resolved_revision"],
|
|
18
|
+
"properties": {
|
|
19
|
+
"repository": {"type": "string", "pattern": "^[^/]+/[^/]+$"},
|
|
20
|
+
"resolved_revision": {"type": "string", "pattern": "^[0-9a-f]{40}$"}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://github.com/cvalusek/PreFer/blob/develop/catalog/model-catalog.schema.json",
|
|
4
|
+
"title": "PreFer materialized model catalog",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": ["schema_version", "generated_at", "source_fingerprint", "catalog_fingerprint", "defaults", "models", "repositories"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"schema_version": {"const": "prefer.model-catalog.v1"},
|
|
10
|
+
"generated_at": {"type": "string", "format": "date-time"},
|
|
11
|
+
"source_fingerprint": {"type": "string", "pattern": "^[0-9a-f]{64}$"},
|
|
12
|
+
"catalog_fingerprint": {"type": "string", "pattern": "^[0-9a-f]{64}$"},
|
|
13
|
+
"defaults": {"type": "object"},
|
|
14
|
+
"models": {"type": "object", "additionalProperties": {"type": "object"}},
|
|
15
|
+
"repositories": {"type": "object", "additionalProperties": {"$ref": "#/$defs/repository"}}
|
|
16
|
+
},
|
|
17
|
+
"$defs": {
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "object",
|
|
20
|
+
"additionalProperties": false,
|
|
21
|
+
"required": ["repository", "requested_revision", "resolved_revision", "base_models", "gated", "private", "tags", "files_complete", "files", "retrieved_at"],
|
|
22
|
+
"properties": {
|
|
23
|
+
"repository": {"type": "string", "pattern": "^[^/]+/[^/]+$"},
|
|
24
|
+
"requested_revision": {"type": "string", "minLength": 1},
|
|
25
|
+
"resolved_revision": {"type": "string", "pattern": "^[0-9a-f]{40}$"},
|
|
26
|
+
"base_models": {"type": "array", "uniqueItems": true, "items": {"type": "string"}},
|
|
27
|
+
"pipeline_tag": {"type": "string"},
|
|
28
|
+
"library_name": {"type": "string"},
|
|
29
|
+
"license": {"type": "string"},
|
|
30
|
+
"gated": {"oneOf": [{"type": "boolean"}, {"type": "string"}]},
|
|
31
|
+
"private": {"type": "boolean"},
|
|
32
|
+
"tags": {"type": "array", "uniqueItems": true, "items": {"type": "string"}},
|
|
33
|
+
"files_complete": {"type": "boolean"},
|
|
34
|
+
"include_patterns": {"type": "array", "uniqueItems": true, "items": {"type": "string", "minLength": 1}},
|
|
35
|
+
"files": {
|
|
36
|
+
"type": "array",
|
|
37
|
+
"items": {
|
|
38
|
+
"type": "object",
|
|
39
|
+
"additionalProperties": false,
|
|
40
|
+
"required": ["path", "size"],
|
|
41
|
+
"properties": {
|
|
42
|
+
"path": {"type": "string", "minLength": 1},
|
|
43
|
+
"size": {"type": "integer", "minimum": 0},
|
|
44
|
+
"blob_oid": {"type": "string"},
|
|
45
|
+
"lfs_sha256": {"type": "string", "pattern": "^[0-9a-f]{64}$"},
|
|
46
|
+
"xet_hash": {"type": "string"}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"retrieved_at": {"type": "string", "format": "date-time"}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://github.com/cvalusek/PreFer/blob/develop/catalog/model-plan.schema.json",
|
|
4
|
+
"title": "PreFer resource-aware model plan",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": ["schema_version", "engine", "resources", "selected", "skipped", "capabilities", "staged_artifact_bytes", "complete"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"schema_version": {"const": "prefer.model-plan.v1"},
|
|
10
|
+
"engine": {"type": "string", "minLength": 1},
|
|
11
|
+
"resources": {"$ref": "prefer-resource-profile.schema.json"},
|
|
12
|
+
"selected": {
|
|
13
|
+
"type": "array",
|
|
14
|
+
"items": {
|
|
15
|
+
"type": "object",
|
|
16
|
+
"additionalProperties": false,
|
|
17
|
+
"required": ["model_id", "preferred_quant", "selected", "fit", "quant_changed", "reason"],
|
|
18
|
+
"properties": {
|
|
19
|
+
"model_id": {"type": "string", "minLength": 1},
|
|
20
|
+
"preferred_quant": {"type": "string", "minLength": 1},
|
|
21
|
+
"requested_quant": {"type": "string", "minLength": 1},
|
|
22
|
+
"selected": {"type": "object"},
|
|
23
|
+
"fit": {"$ref": "#/$defs/fit"},
|
|
24
|
+
"quant_changed": {"type": "boolean"},
|
|
25
|
+
"reason": {"type": "string", "minLength": 1},
|
|
26
|
+
"workload_request": {"$ref": "#/$defs/workloadRequest"},
|
|
27
|
+
"workload": {"$ref": "#/$defs/workloadResult"}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"skipped": {
|
|
32
|
+
"type": "array",
|
|
33
|
+
"items": {
|
|
34
|
+
"type": "object",
|
|
35
|
+
"additionalProperties": false,
|
|
36
|
+
"required": ["model_id", "required", "reason", "details"],
|
|
37
|
+
"properties": {
|
|
38
|
+
"model_id": {"type": "string", "minLength": 1},
|
|
39
|
+
"required": {"type": "boolean"},
|
|
40
|
+
"reason": {"enum": ["no-compatible-variant", "missing-capability", "insufficient-memory", "storage-budget", "model-limit"]},
|
|
41
|
+
"details": {"type": "array", "items": {"type": "string"}}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"capabilities": {"type": "array", "uniqueItems": true, "items": {"type": "string"}},
|
|
46
|
+
"staged_artifact_bytes": {"type": "integer", "minimum": 0},
|
|
47
|
+
"complete": {"type": "boolean"},
|
|
48
|
+
"hints": {"$ref": "#/$defs/hints"}
|
|
49
|
+
},
|
|
50
|
+
"$defs": {
|
|
51
|
+
"hints": {
|
|
52
|
+
"type": "object",
|
|
53
|
+
"additionalProperties": false,
|
|
54
|
+
"properties": {
|
|
55
|
+
"required_capabilities": {"$ref": "#/$defs/stringList"},
|
|
56
|
+
"preferred_capabilities": {"$ref": "#/$defs/stringList"},
|
|
57
|
+
"preferred_roles": {"$ref": "#/$defs/stringList"},
|
|
58
|
+
"speed_importance": {"type": "number", "minimum": 0, "maximum": 1},
|
|
59
|
+
"quality_importance": {"type": "number", "minimum": 0, "maximum": 1},
|
|
60
|
+
"quant_bias": {"enum": ["quality", "balanced", "capacity"]}
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"stringList": {
|
|
64
|
+
"type": "array",
|
|
65
|
+
"uniqueItems": true,
|
|
66
|
+
"items": {"type": "string", "minLength": 1}
|
|
67
|
+
},
|
|
68
|
+
"workloadRequest": {
|
|
69
|
+
"type": "object",
|
|
70
|
+
"additionalProperties": false,
|
|
71
|
+
"required": ["desired_context_tokens", "desired_concurrency", "bytes_per_token"],
|
|
72
|
+
"properties": {
|
|
73
|
+
"desired_context_tokens": {"type": "integer", "minimum": 1},
|
|
74
|
+
"desired_concurrency": {"type": "integer", "minimum": 1},
|
|
75
|
+
"minimum_context_tokens": {"type": "integer", "minimum": 1},
|
|
76
|
+
"minimum_concurrency": {"type": "integer", "minimum": 1},
|
|
77
|
+
"priority": {"enum": ["context", "concurrency"]},
|
|
78
|
+
"bytes_per_token": {"type": "number", "exclusiveMinimum": 0},
|
|
79
|
+
"fixed_device_bytes": {"type": "integer", "minimum": 0},
|
|
80
|
+
"source": {"enum": ["measured", "architecture", "operator", "estimate"]}
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
"workloadResult": {
|
|
84
|
+
"type": "object",
|
|
85
|
+
"additionalProperties": false,
|
|
86
|
+
"required": ["fits", "context_tokens", "concurrency", "aggregate_token_capacity", "changed", "reason"],
|
|
87
|
+
"properties": {
|
|
88
|
+
"fits": {"type": "boolean"},
|
|
89
|
+
"context_tokens": {"type": "integer", "minimum": 0},
|
|
90
|
+
"concurrency": {"type": "integer", "minimum": 0},
|
|
91
|
+
"aggregate_token_capacity": {"type": "integer", "minimum": 0},
|
|
92
|
+
"changed": {"type": "boolean"},
|
|
93
|
+
"reason": {"type": "string", "minLength": 1}
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
"fit": {
|
|
97
|
+
"type": "object",
|
|
98
|
+
"additionalProperties": false,
|
|
99
|
+
"required": ["status", "confidence", "weight_bytes", "runtime_overhead_bytes", "workload_bytes", "required_device_bytes", "reasons"],
|
|
100
|
+
"properties": {
|
|
101
|
+
"status": {"enum": ["fits", "tight", "host-offload", "does-not-fit", "unknown"]},
|
|
102
|
+
"confidence": {"enum": ["measured", "architecture", "artifact-only", "unknown"]},
|
|
103
|
+
"capacity_bytes": {"type": "integer", "minimum": 0},
|
|
104
|
+
"usable_capacity_bytes": {"type": "integer", "minimum": 0},
|
|
105
|
+
"weight_bytes": {"type": "integer", "minimum": 0},
|
|
106
|
+
"runtime_overhead_bytes": {"type": "integer", "minimum": 0},
|
|
107
|
+
"workload_bytes": {"type": "integer", "minimum": 0},
|
|
108
|
+
"required_device_bytes": {"type": "integer", "minimum": 0},
|
|
109
|
+
"remaining_device_bytes": {"type": "integer"},
|
|
110
|
+
"host_offload_bytes": {"type": "integer", "minimum": 0},
|
|
111
|
+
"reasons": {"type": "array", "items": {"type": "string"}}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://github.com/cvalusek/PreFer/blob/develop/catalog/resource-profile.schema.json",
|
|
4
|
+
"title": "PreFer normalized runtime resources",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": ["schema_version", "source", "memory_topology", "accelerators", "capabilities"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"schema_version": {"const": "prefer.resources.v1"},
|
|
10
|
+
"source": {"enum": ["deployment", "runtime", "merged"]},
|
|
11
|
+
"provider": {"type": "string", "minLength": 1},
|
|
12
|
+
"provider_sku": {"type": "string", "minLength": 1},
|
|
13
|
+
"memory_topology": {"enum": ["discrete", "unified", "host", "unknown"]},
|
|
14
|
+
"accelerators": {"type": "array", "items": {"$ref": "#/$defs/accelerator"}},
|
|
15
|
+
"unified_memory": {"$ref": "#/$defs/memory"},
|
|
16
|
+
"host_memory": {"$ref": "#/$defs/memory"},
|
|
17
|
+
"cpu": {
|
|
18
|
+
"type": "object",
|
|
19
|
+
"additionalProperties": false,
|
|
20
|
+
"properties": {
|
|
21
|
+
"architecture": {"type": "string"},
|
|
22
|
+
"logical_cores": {"type": "integer", "minimum": 1},
|
|
23
|
+
"model": {"type": "string"},
|
|
24
|
+
"capabilities": {"$ref": "#/$defs/stringList"}
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"storage": {
|
|
28
|
+
"type": "object",
|
|
29
|
+
"additionalProperties": false,
|
|
30
|
+
"properties": {
|
|
31
|
+
"total_bytes": {"type": "integer", "minimum": 0},
|
|
32
|
+
"available_bytes": {"type": "integer", "minimum": 0},
|
|
33
|
+
"kind": {"enum": ["local", "network", "unknown"]}
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"capabilities": {"$ref": "#/$defs/stringList"}
|
|
37
|
+
},
|
|
38
|
+
"$defs": {
|
|
39
|
+
"memory": {
|
|
40
|
+
"type": "object",
|
|
41
|
+
"additionalProperties": false,
|
|
42
|
+
"properties": {
|
|
43
|
+
"total_bytes": {"type": "integer", "minimum": 0},
|
|
44
|
+
"available_bytes": {"type": "integer", "minimum": 0}
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"accelerator": {
|
|
48
|
+
"type": "object",
|
|
49
|
+
"additionalProperties": false,
|
|
50
|
+
"required": ["capabilities"],
|
|
51
|
+
"properties": {
|
|
52
|
+
"id": {"type": "string"},
|
|
53
|
+
"slug": {"type": "string"},
|
|
54
|
+
"canonical_id": {"type": "string"},
|
|
55
|
+
"provider_id": {"type": "string"},
|
|
56
|
+
"name": {"type": "string"},
|
|
57
|
+
"architecture": {"type": "string"},
|
|
58
|
+
"compute_capability": {"type": "string"},
|
|
59
|
+
"total_bytes": {"type": "integer", "minimum": 0},
|
|
60
|
+
"available_bytes": {"type": "integer", "minimum": 0},
|
|
61
|
+
"capabilities": {"$ref": "#/$defs/stringList"}
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"stringList": {
|
|
65
|
+
"type": "array",
|
|
66
|
+
"uniqueItems": true,
|
|
67
|
+
"items": {"type": "string", "minLength": 1}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|