migrated cli. fixed imports. fixed unsloth studio command logic
This commit is contained in:
parent
a1b8cd6696
commit
55eb0bb66a
4 changed files with 26 additions and 14 deletions
|
|
@ -14,7 +14,7 @@ def list_checkpoints(
|
|||
),
|
||||
):
|
||||
"""List checkpoints detected in the outputs directory."""
|
||||
from backend.export import ExportBackend
|
||||
from studio.backend.core.export import ExportBackend
|
||||
|
||||
backend = ExportBackend()
|
||||
checkpoints = backend.scan_checkpoints(outputs_dir=str(outputs_dir))
|
||||
|
|
@ -65,7 +65,7 @@ def export(
|
|||
typer.echo("Error: --repo-id required when using --push-to-hub", err=True)
|
||||
raise typer.Exit(code=2)
|
||||
|
||||
from backend.export import ExportBackend
|
||||
from studio.backend.core.export import ExportBackend
|
||||
backend = ExportBackend()
|
||||
|
||||
typer.echo(f"Loading checkpoint: {checkpoint}")
|
||||
|
|
|
|||
|
|
@ -24,8 +24,7 @@ def inference(
|
|||
load_in_4bit: bool = typer.Option(True, "--load-in-4bit/--no-load-in-4bit"),
|
||||
):
|
||||
"""Run a single inference using the specified model."""
|
||||
from backend.model_config import ModelConfig
|
||||
from backend.inference import get_inference_backend
|
||||
from studio.backend.core import ModelConfig, get_inference_backend
|
||||
|
||||
inference_backend = get_inference_backend()
|
||||
model_config = ModelConfig.from_ui_selection(
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ def train(
|
|||
)
|
||||
raise typer.Exit(code=2)
|
||||
|
||||
from backend.trainer import UnslothTrainer
|
||||
from studio.backend.core.training import UnslothTrainer
|
||||
|
||||
trainer = UnslothTrainer()
|
||||
|
||||
|
|
|
|||
|
|
@ -1,19 +1,32 @@
|
|||
import time
|
||||
from pathlib import Path
|
||||
from typing import Optional
|
||||
|
||||
import typer
|
||||
|
||||
|
||||
def ui(
|
||||
port: int = typer.Option(8000, "--port", "-p", help="Port to run the UI server on."),
|
||||
host: str = typer.Option("0.0.0.0", "--host", "-H", help="Host address to bind to."),
|
||||
share: bool = typer.Option(True, "--share", "-s", help="Create a public Gradio share link."),
|
||||
frontend: Optional[Path] = typer.Option(None, "--frontend", "-f", help="Path to frontend build directory."),
|
||||
silent: bool = typer.Option(False, "--silent", "-q", help="Suppress startup messages."),
|
||||
):
|
||||
"""Launch the Unsloth web UI for training, inference, and export."""
|
||||
from app import demo, script_dir
|
||||
"""Launch the Unsloth web UI backend server."""
|
||||
from studio.backend.run import run_server
|
||||
|
||||
typer.echo(f"Starting Unsloth UI on http://{host}:{port}")
|
||||
if not silent:
|
||||
typer.echo(f"Starting Unsloth UI on http://{host}:{port}")
|
||||
|
||||
demo.launch(
|
||||
share=share,
|
||||
server_port=port,
|
||||
server_name=host,
|
||||
favicon_path=f"{script_dir}/assets/favicon-32x32.png",
|
||||
run_server(
|
||||
host=host,
|
||||
port=port,
|
||||
frontend_path=frontend,
|
||||
silent=silent,
|
||||
)
|
||||
|
||||
# Keep running until interrupted
|
||||
try:
|
||||
while True:
|
||||
time.sleep(1)
|
||||
except KeyboardInterrupt:
|
||||
typer.echo("\nShutting down...")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue