Compare commits
7 commits
main
...
fix/test-u
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c8c371610b | ||
|
|
4b057bc84e | ||
|
|
7ad2224909 | ||
|
|
54afb10206 | ||
|
|
9648c43065 | ||
|
|
24914d359b | ||
|
|
d260fbb30c |
6 changed files with 41 additions and 26 deletions
|
|
@ -118,6 +118,7 @@ def _build_stream_load_kwargs(
|
|||
"path": dataset_name,
|
||||
"split": split,
|
||||
"streaming": True,
|
||||
"trust_remote_code": False,
|
||||
}
|
||||
if data_file:
|
||||
kwargs["data_files"] = [data_file]
|
||||
|
|
|
|||
10
studio/backend/tests/test_data_recipe_seed.py
Normal file
10
studio/backend/tests/test_data_recipe_seed.py
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
# Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def test_seed_inspect_load_kwargs_disables_remote_code_execution():
|
||||
seed_route = Path("studio/backend/routes/data_recipe/seed.py").read_text()
|
||||
|
||||
assert '"trust_remote_code": False' in seed_route
|
||||
|
|
@ -285,7 +285,7 @@ class TestLogGpuMemory:
|
|||
def test_does_not_raise(self):
|
||||
log_gpu_memory("test")
|
||||
|
||||
def test_logs_gpu_info_when_available(self, caplog):
|
||||
def test_logs_gpu_info_when_available(self, capsys):
|
||||
fake_info = {
|
||||
"available": True,
|
||||
"backend": "cuda",
|
||||
|
|
@ -295,35 +295,27 @@ class TestLogGpuMemory:
|
|||
"utilization_pct": 12.5,
|
||||
"free_gb": 14.0,
|
||||
}
|
||||
import structlog
|
||||
from loggers import get_logger
|
||||
|
||||
with (
|
||||
patch(
|
||||
"utils.hardware.hardware.get_gpu_memory_info", return_value = fake_info
|
||||
),
|
||||
caplog.at_level(logging.INFO, logger = "utils.hardware.hardware"),
|
||||
with patch(
|
||||
"utils.hardware.hardware.get_gpu_memory_info", return_value = fake_info
|
||||
):
|
||||
log_gpu_memory("unit-test")
|
||||
|
||||
assert "unit-test" in caplog.text
|
||||
assert "CUDA" in caplog.text
|
||||
assert "FakeGPU" in caplog.text
|
||||
captured = capsys.readouterr().out
|
||||
assert "unit-test" in captured
|
||||
assert "CUDA" in captured
|
||||
assert "FakeGPU" in captured
|
||||
|
||||
def test_logs_cpu_fallback_when_no_gpu(self, caplog):
|
||||
def test_logs_cpu_fallback_when_no_gpu(self, capsys):
|
||||
fake_info = {"available": False, "backend": "cpu"}
|
||||
import structlog
|
||||
from loggers import get_logger
|
||||
|
||||
with (
|
||||
patch(
|
||||
"utils.hardware.hardware.get_gpu_memory_info", return_value = fake_info
|
||||
),
|
||||
caplog.at_level(logging.INFO, logger = "utils.hardware.hardware"),
|
||||
with patch(
|
||||
"utils.hardware.hardware.get_gpu_memory_info", return_value = fake_info
|
||||
):
|
||||
log_gpu_memory("cpu-test")
|
||||
|
||||
assert "No GPU available" in caplog.text
|
||||
captured = capsys.readouterr().out
|
||||
assert "No GPU available" in captured
|
||||
|
||||
|
||||
# ========== format_error_message() ==========
|
||||
|
|
|
|||
|
|
@ -515,7 +515,12 @@ def _run_multi_pass_advisor(
|
|||
try:
|
||||
from utils.models.model_config import load_model_config
|
||||
|
||||
config = load_model_config(model_name, use_auth = True, token = hf_token)
|
||||
config = load_model_config(
|
||||
model_name,
|
||||
use_auth = True,
|
||||
token = hf_token,
|
||||
trust_remote_code = False,
|
||||
)
|
||||
archs = getattr(config, "architectures", [])
|
||||
if archs and "Gemma3nForConditionalGeneration" in archs:
|
||||
is_gemma_3n = True
|
||||
|
|
|
|||
|
|
@ -383,7 +383,10 @@ for canonical_file, model_names in MODEL_NAME_MAPPING.items():
|
|||
|
||||
|
||||
def load_model_config(
|
||||
model_name: str, use_auth: bool = False, token: Optional[str] = None
|
||||
model_name: str,
|
||||
use_auth: bool = False,
|
||||
token: Optional[str] = None,
|
||||
trust_remote_code: bool = True,
|
||||
):
|
||||
"""
|
||||
Load model config with optional authentication control.
|
||||
|
|
@ -392,18 +395,23 @@ def load_model_config(
|
|||
if token:
|
||||
# Explicit token provided - use it
|
||||
return AutoConfig.from_pretrained(
|
||||
model_name, trust_remote_code = True, token = token
|
||||
model_name, trust_remote_code = trust_remote_code, token = token
|
||||
)
|
||||
|
||||
if not use_auth:
|
||||
# Load without any authentication (for public model checks)
|
||||
with without_hf_auth():
|
||||
return AutoConfig.from_pretrained(
|
||||
model_name, trust_remote_code = True, token = None
|
||||
model_name,
|
||||
trust_remote_code = trust_remote_code,
|
||||
token = None,
|
||||
)
|
||||
|
||||
# Use default authentication (cached tokens)
|
||||
return AutoConfig.from_pretrained(model_name, trust_remote_code = True)
|
||||
return AutoConfig.from_pretrained(
|
||||
model_name,
|
||||
trust_remote_code = trust_remote_code,
|
||||
)
|
||||
|
||||
|
||||
# VLM architecture suffixes and known VLM model_type values.
|
||||
|
|
|
|||
|
|
@ -270,7 +270,6 @@ def install_python_stack() -> int:
|
|||
"Installing local data-designer unstructured plugin",
|
||||
"--no-cache-dir",
|
||||
"--no-deps",
|
||||
"-e",
|
||||
str(LOCAL_DD_UNSTRUCTURED_PLUGIN),
|
||||
constrain = False,
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue