Repository navigation
Feat/model hub - #5783
Feat/model hub#5783danielhanchen wants to merge 19 commits into
Conversation
Tests for resolve_cached_repo_id_case and get_model_config case resolution belong in their own PR to keep this change focused on the runtime fix.
- Check exact-case path before memo to ensure a newly-appeared exact match always wins over a previously memoized variant - Validate memoized entries still exist on disk before returning them to prevent stale results when cache dirs are deleted/recreated
- Use .is_dir() instead of .exists() for exact-case cache check (cache entries are always directories) - Remove redundant fallback in _detect_audio_from_tokenizer since get_cache_path already handles case resolution and returns None when the model is not cached
- New download-jobs feature replaces models/download-manager - New inventory feature for unified model/dataset discovery - New chat/model-runtime feature: per-model load config, hydration, rollback - Models catalog split into lists/rows; new hub option menu, on-device folders dialog, per-model config notice - Training rework: cache-reference, dataset-slices, freeform validation, model-config-fetch, resource-availability, conflict detection, draft + config persistence - Chat template validation shared between backend and frontend - New shared lib modules: model-identity, model-identifiers, model-capabilities, local-path, network, token-fingerprint, unsloth-support, debounced-persist-storage - Remove superseded modules: download-manager-store, use-filter-starved-pause, use-hub-inventory, transport-preference
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
There was a problem hiding this comment.
Code Review
This pull request introduces comprehensive offline loading and training capabilities for models and datasets, including local cache resolution, GGUF variant matching, and support for Ollama models. It adds a new load_settings module to manage transformers load settings and updates various inference and training backends to support local-only files. The review feedback highlights two issues: a potential ImportError in worker.py due to _cached_transformers_snapshot_path being imported from the wrong module (model_config instead of hf_cache_scan), and a potential TypeError in llama_cpp.py if gguf_filename is None when attempting a path join.
| from typing import Optional, Dict, Any | ||
| from utils.paths import ( |
There was a problem hiding this comment.
The function _cached_transformers_snapshot_path is used in from_identifier and imported by other modules from utils.models.model_config, but it is not imported here. This will cause a NameError at runtime. Please import it from utils.hf_cache_scan.
| from typing import Optional, Dict, Any | |
| from utils.paths import ( | |
| from typing import Optional, Dict, Any | |
| from utils.hf_cache_scan import _cached_transformers_snapshot_path | |
| from utils.paths import ( |
| try: | ||
| from utils.models.model_config import _iter_hf_cache_snapshots | ||
|
|
||
| for snap in _iter_hf_cache_snapshots(hf_repo): | ||
| main_path = snap / gguf_filename | ||
| if not main_path.is_file(): | ||
| continue | ||
| if not all((snap / shard).is_file() for shard in gguf_extra_shards): | ||
| continue | ||
| local_path = str(main_path.resolve()) | ||
| logger.info("Resolved GGUF from local HF cache: %s", local_path) | ||
| return local_path | ||
| except Exception as e: | ||
| logger.debug(f"Local HF cache lookup for GGUF file failed: {e}") |
There was a problem hiding this comment.
If hf_variant is None or falsy, gguf_filename remains None. This will cause snap / gguf_filename to raise a TypeError at runtime. Although wrapped in a broad try...except block, it is cleaner and safer to guard against None before attempting the path join.
| try: | |
| from utils.models.model_config import _iter_hf_cache_snapshots | |
| for snap in _iter_hf_cache_snapshots(hf_repo): | |
| main_path = snap / gguf_filename | |
| if not main_path.is_file(): | |
| continue | |
| if not all((snap / shard).is_file() for shard in gguf_extra_shards): | |
| continue | |
| local_path = str(main_path.resolve()) | |
| logger.info("Resolved GGUF from local HF cache: %s", local_path) | |
| return local_path | |
| except Exception as e: | |
| logger.debug(f"Local HF cache lookup for GGUF file failed: {e}") | |
| if gguf_filename: | |
| try: | |
| from utils.models.model_config import _iter_hf_cache_snapshots | |
| for snap in _iter_hf_cache_snapshots(hf_repo): | |
| main_path = snap / gguf_filename | |
| if not main_path.is_file(): | |
| continue | |
| if not all((snap / shard).is_file() for shard in gguf_extra_shards): | |
| continue | |
| local_path = str(main_path.resolve()) | |
| logger.info("Resolved GGUF from local HF cache: %s", local_path) | |
| return local_path | |
| except Exception as e: | |
| logger.debug(f"Local HF cache lookup for GGUF file failed: {e}") |
Resolved 7 conflict files. Preserved the model-hub branch's per-model-config, download-manager, and feature/inventory split. Adopted upstream's chat-history backend + chat-settings-storage abstraction. - backend/routes/inference.py: kept runtime_model_identifier helper - model-selector.tsx: kept reworked picker (PickerTabToggle, onPick) - chat-adapter.ts: merged storage refactor + getHfToken + features/inventory + pushImagePart attachments - chat-api.ts: kept re-export shim, grafted in 16 chat-history fns - chat-page.tsx: kept per-model-config plumbing + adopted external-provider builtin tools (web fetch, image gen, prompt-cache TTL) - chat-settings-sheet.tsx: dropped duplicate Model section (lives in ModelConfigPage), adopted preset-state-from-store - chat-runtime-store.ts: adopted async chat-settings-storage hydration, preserved activeModelLoadSource + ChatModelLoadInfo Follow-up build fixes: - Tailwind v4 syntax in index.css (! suffix, no spaces in arbitrary values) - 5 missing setter type signatures on ChatRuntimeStore - Re-imported Select family for prompt-cache TTL UI - Removed duplicate barrel exports in features/chat/index.ts
7861181 to
406b17c
Compare
- tests/test_cached_gguf_routes.py: remove obsolete _stub_classify fixture - tests/test_training_worker_flash_attn.py: pin FLA model-type discovery via shared helper - core/training/resume.py: make artifacts_present and get_resume_checkpoint_path exception-safe against ValueError from resolve_output_dir
No description provided.