[staging CI] unslothai/unsloth#6858 - #343
danielhanchen wants to merge 18 commits into
Conversation
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
…d as active downloads for PR unslothai#6858
for more information, see https://pre-commit.ci
…cannot spawn after cleanup for PR unslothai#6858
…their cancel markers for PR unslothai#6858
…for released retry peers for PR unslothai#6858
There was a problem hiding this comment.
Code Review
This pull request introduces several significant improvements, including lazy loading of inference components, robust chat turn-end EOS token resolution to prevent infinite loops, a standalone Vulkan VRAM probe with dedicated integrated GPU headroom management, and support for distributed MLX training and inference on Apple Silicon. Additionally, it adds a malware security gate for RAG embedding models, automatic HTTP retries for failed Xet downloads, and thread activity tracking in the database. The review feedback highlights three key improvement opportunities: converting bindir to an absolute path in _vulkan_probe.py to prevent Windows DLL directory errors, wrapping the int(tid) conversion in chat_eos.py within a try-except block to avoid potential crashes, and using a with open(...) context manager in embeddings.py to prevent resource leaks.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| def main() -> int: | ||
| if len(sys.argv) < 2: | ||
| return 0 | ||
| bindir = sys.argv[1] |
There was a problem hiding this comment.
| try: | ||
| tid = id_tokenizer.convert_tokens_to_ids(marker) | ||
| except Exception: | ||
| tid = None | ||
| if tid is not None and tid != unk and int(tid) >= 0: | ||
| ids.add(int(tid)) |
There was a problem hiding this comment.
The int(tid) conversion and subsequent check should be wrapped inside the try...except block. If convert_tokens_to_ids returns an unexpected type (such as a list or a non-numeric string), int(tid) will raise a TypeError or ValueError outside the try block, crashing the entire function.
| try: | |
| tid = id_tokenizer.convert_tokens_to_ids(marker) | |
| except Exception: | |
| tid = None | |
| if tid is not None and tid != unk and int(tid) >= 0: | |
| ids.add(int(tid)) | |
| try: | |
| tid = id_tokenizer.convert_tokens_to_ids(marker) | |
| if tid is not None and tid != unk and int(tid) >= 0: | |
| ids.add(int(tid)) | |
| except Exception: | |
| pass |
| local = hf_hub_download(name, "modules.json", token = token or None) | ||
| except EntryNotFoundError: | ||
| return () | ||
| data = json.loads(open(local).read()) |
There was a problem hiding this comment.
Using open(local).read() leaves the file descriptor open until garbage collection runs, which can cause resource leaks and file locking issues on Windows. Please use a with open(...) block to ensure the file is closed properly.
| data = json.loads(open(local).read()) | |
| with open(local, 'r', encoding = 'utf-8') as f: | |
| data = json.loads(f.read()) |
There was a problem hiding this comment.
Code Review
This pull request introduces several enhancements and robustness fixes across the training and inference backends. Key changes include the addition of DeepSeek-V4 support with custom compute buffer estimations, the implementation of a local request admission control queue for llama-server, lazy loading of inference backends, and a security gate to block unsafe RAG embedding models. It also refactors tool-call parsing and stripping to align GGUF and safetensors paths, adds MLX distributed training and inference support, and improves Windows/WSL AMD GPU detection. Additionally, chat threads now track and sort by last activity, and unstructured seed upload blocks can be deleted in bulk. The reviewer's feedback suggests improving the readability of a dense PowerShell block in install.ps1 used to restore uv index environment variables.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| return [int]$LASTEXITCODE | ||
| } finally { | ||
| $ErrorActionPreference = $prevEap | ||
| if ($savedUvIndex) { foreach ($n in $savedUvIndex.Keys) { if ($null -ne $savedUvIndex[$n]) { Set-Item "Env:$n" $savedUvIndex[$n] } } } |
There was a problem hiding this comment.
This line is functionally correct, but its density makes it difficult to read and debug. For better maintainability, especially within a finally block where clarity is crucial for ensuring correct cleanup, consider expanding this into multiple lines.
if ($savedUvIndex) {
foreach ($n in $savedUvIndex.Keys) {
if ($null -ne $savedUvIndex[$n]) { Set-Item "Env:$n" $savedUvIndex[$n] }
}
}
|
Staging run finished; closing. Staging PRs exist to run CI on a spare queue and are never merged. |
Staging CI for unslothai#6858 (PR head merged with current main). Do not merge.