This is an implementation of the SDVN10-Anime as a Cog model. Cog packages machine learning models as standard containers.
You can use this template to deploy any CivitAI Stable Diffusion model to Replicate. Here's how:
To use a different model from CivitAI:
- Find your desired model on CivitAI.
- Locate the "Download" button for the
safetensors
file of the model. It's important to use thesafetensors
version for compatibility and security. - Right-click the "Download" button and select "Copy Link Address". This will copy the direct download URL of the model file.
- Open the
predict.py
file. - Find the line that defines the
MODEL_LINK
variable. It will look like this:MODEL_LINK = "https://civitai.com/api/download/models/286354?type=Model&format=SafeTensor&size=full&fp=fp16"
- Replace the existing URL within the quotes with the link you copied from CivitAI. Make sure to keep the quotes. For example:
MODEL_LINK = "YOUR_COPIED_LINK_ADDRESS_HERE"
Install the Cog CLI:
Follow the instructions on the Cog documentation for installing the CLI. A common method is:
sudo curl -o /usr/local/bin/cog -L /~https://github.com/replicate/cog/releases/latest/download/cog_`uname -s`_`uname -m`
sudo chmod +x /usr/local/bin/cog
Navigate to the repository directory in your terminal and install the necessary Python packages:
pip install -r requirements.txt
This script will download the model specified by the MODEL_LINK
in predict.py
and the necessary VAE
.
cog run script/download-weights
Once the weights are downloaded, you can run predictions using the cog predict command. Here's an example:
cog predict -i prompt="child boy, short hair, crew neck sweater, (masterpiece, best quality:1.6), ghibli, Sun in the sky, Rocky Mountain National Park, Charismatic"
- Create a new model on replicate. Choose a name and visibility for your model.
- Push the model to Replicate using the cog push command. Replicate will provide you with the specific cog push command after you create the model on their platform. It will look something like:
cog push r8.im/YOUR_USERNAME/YOUR_MODEL_NAME
Contributions are welcome! Please feel free to submit a Pull Request.