> ## 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.

# 速率限制

> 了解速率限制和配额

# 速率限制

AITraining 的速率限制在使用云资源时适用。

## 本地训练

本地训练没有速率限制 - 您只受硬件限制。

## Hugging Face Hub

推送到或从 Hub 拉取时：

| 操作    | 速率限制 |
| ----- | ---- |
| 模型下载  | 合理使用 |
| 数据集下载 | 合理使用 |
| 模型上传  | 合理使用 |

### 处理速率限制

如果遇到速率限制：

```python theme={null}
import time
from huggingface_hub import HfApi

def download_with_retry(model_id, max_retries=3):
    api = HfApi()
    for attempt in range(max_retries):
        try:
            return api.model_info(model_id)
        except Exception as e:
            if "rate limit" in str(e).lower():
                wait = 60 * (attempt + 1)
                print(f"Rate limited, waiting {wait}s...")
                time.sleep(wait)
            else:
                raise
```

## W\&B 日志记录

Weights & Biases 根据您的计划有日志限制：

| 计划         | 每月记录小时数 |
| ---------- | ------- |
| 免费         | 200     |
| Teams      | 无限制     |
| Enterprise | 无限制     |

### 减少日志量

```python theme={null}
params = LLMTrainingParams(
    model="google/gemma-3-270m",
    data_path="./data.jsonl",
    project_name="my-model",
    log="wandb",
    logging_steps=50,  # Log less frequently
)
```

## GPU 云服务

如果使用云 GPU（不适用于本地训练）：

### Hugging Face Spaces

* 受您的 Spaces 配额限制
* 适用持久存储限制

### 其他云服务

检查您的云提供商的配额：

* GPU 小时数
* 存储
* 网络带宽

## 最佳实践

1. **本地缓存模型** - 不要重新下载
2. **高效记录** - 不要记录每一步
3. **使用检查点** - 恢复而不是重启
4. **批量操作** - 减少 API 调用

## 下一步

<CardGroup cols={2}>
  <Card title="Error Handling" href="/api/error-handling">
    优雅处理错误
  </Card>

  <Card title="Python SDK" href="/api/python-sdk">
    完整 API 参考
  </Card>
</CardGroup>
