# tinker_cookbook.weights.publish_to_hf_hub

### [**tinker_cookbook.weights.publish_to_hf_hub**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/weights/_publish.py#L15)( _model_path_, _repo_id_, _private_, _token_, _model_card_)

Push a model or adapter directory to HuggingFace Hub.

Works with outputs from [`build_hf_model`](https://tinker-docs.thinkingmachines.ai/cookbook/api-reference/weights/build_hf_model/), `build_lora_adapter`, or any HuggingFace-compatible model directory.

**Parameters:**

- [**model_path**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/weights/_publish.py#L17) ( _str_) – Local path to the model or adapter directory to upload.
- [**repo_id**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/weights/_publish.py#L18) ( _str_) – HuggingFace Hub repository ID (e.g. "user/my-model").
- [**private**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/weights/_publish.py#L19) ( _bool_) – Whether the repository should be private. Defaults to `True` for safety.
- [**token**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/weights/_publish.py#L20) ( _str | None_) – HuggingFace API token. If `None` (default), uses the `HF_TOKEN` environment variable or cached login from `hf auth login`.
- [**model_card**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/weights/_publish.py#L21) ( _ModelCardConfig | None_) – Optional model card configuration. When provided, a `README.md` is auto-generated and included in the upload. If the directory already contains a `README.md`, the existing file is preserved and a warning is logged.

**Returns:** URL of the published repository.

```
from tinker_cookbook import weights
url = weights.publish_to_hf_hub(
model_path="./merged_model",
repo_id="my-org/my-model",
)
print(url)
```
