studio: route /export/gguf through quantization_method normalizer
Call normalize_gguf_quantization_method on request.quantization_method before invoking the export backend. Empty lists surface as HTTP 400 via the helper's ValueError. Legacy single-string callers are wrapped transparently; batch callers pass the list directly. After this commit the route always hands the backend a List[str].
This commit is contained in:
parent
9a818e7155
commit
176ae1f17a
1 changed files with 9 additions and 1 deletions
|
|
@ -38,6 +38,7 @@ from models import (
|
|||
ExportGGUFRequest,
|
||||
ExportLoRAAdapterRequest,
|
||||
)
|
||||
from models.export import normalize_gguf_quantization_method
|
||||
|
||||
router = APIRouter()
|
||||
logger = get_logger(__name__)
|
||||
|
|
@ -253,11 +254,18 @@ async def export_gguf(
|
|||
|
||||
Wraps ExportBackend.export_gguf.
|
||||
"""
|
||||
try:
|
||||
normalized_methods = normalize_gguf_quantization_method(
|
||||
request.quantization_method,
|
||||
)
|
||||
except ValueError as exc:
|
||||
raise HTTPException(status_code = 400, detail = str(exc))
|
||||
|
||||
try:
|
||||
backend = get_export_backend()
|
||||
success, message = backend.export_gguf(
|
||||
save_directory = request.save_directory,
|
||||
quantization_method = request.quantization_method,
|
||||
quantization_method = normalized_methods,
|
||||
push_to_hub = request.push_to_hub,
|
||||
repo_id = request.repo_id,
|
||||
hf_token = request.hf_token,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue