Skip to main content
This page shows how to prepare your model repository on Hugging Face so it can be deployed on SynapsAI Cloud. If you want to use a model from the HuggingFace Hub that is already in SafeTensors format, you can skip this step. We currently only support model architectures that are on the transformers and diffusers library from Hugging Face. However, we are currently working on adding support for custom architectures. ;)

Prerequisites

pip install --upgrade huggingface_hub transformers safetensors

Create a model repository

Create a new model repo on Hugging Face (UI or CLI)
  • UI: New model at https://huggingface.co/new
  • CLI:
    huggingface-cli login
    huggingface-cli repo create <namespace>/<model-name> --type model
    

Required files

Your repository should include:
  • Model weights in .safetensors format
  • Model configuration files (e.g., config.json)
  • Tokenizer files (e.g., tokenizer.json, tokenizer_config.json, vocab.json, merges.txt)
  • Any processors (e.g., preprocessor_config.json, image processor files)
  • A README.md describing the model
Refer to the official docs for file layouts and best practices:

Push model weights and artifacts

Below is a Python example that saves a model and tokenizer, then pushes them to the Hub using transformers and huggingface_hub.
from huggingface_hub import login
from transformers import AutoModelForCausalLM, AutoTokenizer

# 1) Login using a token with read/write during setup
login(token="<HF_TOKEN>")

model_id = "<namespace>/<model-name>"

# 2) Load a base model (example) and tokenizer
model = AutoModelForCausalLM.from_pretrained("gpt2")
tokenizer = AutoTokenizer.from_pretrained("gpt2")

# 3) (Optional) Save in safetensors
model.save_pretrained("./model", safe_serialization=True)
tokenizer.save_pretrained("./model")

# 4) Push to Hub
model.push_to_hub(model_id, private=True)
tokenizer.push_to_hub(model_id, private=True)
CLI alternative with Git:
# inside the cloned repo directory
cp -r ./model/* .

git add .
git commit -m "Add model weights, config, and tokenizer"
git push

Verify repository readiness

  • Check that all required files are present (weights, config, tokenizer, processors)
  • Confirm weights are in .safetensors
  • Ensure README.md has a pipeline tag, for example:
pipeline_tag: text-generation
Next, proceed to deployment: Deploy a model.
I