> ## Documentation Index
> Fetch the complete documentation index at: https://docs.monostate.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# 全局选项

> 所有 CLI 命令可用的选项

# 全局选项

这些选项在大多数 AITraining CLI 命令中都可以使用。

## 版本

检查已安装的版本：

```bash theme={null}
aitraining --version
aitraining -v
```

## 帮助

获取任何命令的帮助：

```bash theme={null}
aitraining --help
aitraining llm --help
aitraining text-classification --help
```

## 配置文件

从 YAML 配置文件加载参数：

```bash theme={null}
aitraining --config path/to/config.yaml
```

这对于以下情况很有用：

* 可重现的实验
* 复杂的配置
* 与团队成员共享设置

## 后端

指定训练运行的位置：

```bash theme={null}
aitraining llm --train --backend local ...
```

可用后端：

| 后端         | 描述                                     |
| ---------- | -------------------------------------- |
| `local`    | 在本地机器上运行（默认）。变体：`local-cli`、`local-ui` |
| `spaces-*` | 在 Hugging Face Spaces 上运行              |
| `ep-*`     | Hugging Face Endpoints                 |
| `ngc-*`    | NVIDIA NGC/DGX Cloud                   |
| `nvcf-*`   | NVIDIA Cloud Functions                 |

### Spaces 后端选项

| 后端                    | GPU          |
| --------------------- | ------------ |
| `spaces-t4-small`     | T4 (small)   |
| `spaces-t4-medium`    | T4 (medium)  |
| `spaces-a10g-small`   | A10G (small) |
| `spaces-a10g-large`   | A10G (large) |
| `spaces-a10g-largex2` | 2x A10G      |
| `spaces-a10g-largex4` | 4x A10G      |
| `spaces-a100-large`   | A100         |
| `spaces-l4x1`         | 1x L4        |
| `spaces-l4x4`         | 4x L4        |
| `spaces-l40sx1`       | 1x L40S      |
| `spaces-l40sx4`       | 4x L40S      |
| `spaces-l40sx8`       | 8x L40S      |
| `spaces-cpu-basic`    | 仅 CPU        |
| `spaces-cpu-upgrade`  | CPU（升级版）     |

<Warning>
  **远程后端需要身份验证**：使用非本地后端（`spaces-*`、`ep-*`、`ngc-*`、`nvcf-*`）时，必须提供 `--username` 和 `--token` 以进行 Hugging Face 身份验证。
</Warning>

<Note>
  **推送到 Hub 也需要身份验证**：即使使用 `--backend local`，使用 `--push-to-hub` 也需要 `--username` 和 `--token` 才能将模型上传到 Hugging Face Hub。
</Note>

## 环境变量

在运行命令之前设置这些变量：

### 身份验证

```bash theme={null}
export HF_TOKEN="hf_..."        # Hugging Face token
export WANDB_API_KEY="..."       # Weights & Biases key
```

### GPU 配置

```bash theme={null}
export CUDA_VISIBLE_DEVICES=0,1  # 使用特定 GPU
export PYTORCH_CUDA_ALLOC_CONF=max_split_size_mb:512  # 内存管理
```

### MPS（Apple Silicon）控制

```bash theme={null}
export AUTOTRAIN_DISABLE_MPS=1  # 在 Mac 上强制 CPU 训练
export AUTOTRAIN_ENABLE_MPS=1   # 即使使用量化也强制 MPS
```

## 交互模式

启动配置向导：

```bash theme={null}
aitraining           # 无参数 = 向导模式
aitraining llm --interactive  # 显式交互模式
```

## 下一步

<CardGroup cols={2}>
  <Card title="YAML 配置" href="/cli/yaml-configs">
    配置文件格式
  </Card>

  <Card title="命令结构" href="/cli/command-structure">
    完整命令参考
  </Card>
</CardGroup>
