Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Push model to Replicate

# This workflow is triggered manually from the GitHub website.
# To run it, click the "Actions" tab on the repo page.
on:
workflow_dispatch:
inputs:
model_name:
required: true
description: The name of the Replicate model to publish, in the format `username-or-org/modelname`.

jobs:
push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Free disk space
uses: jlumbroso/free-disk-space@main
with:
large-packages: false
tool-cache: false

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Install Cog and NVIDIA drivers
run: |
curl https://replicate.github.io/codespaces/scripts/install-cog.sh | bash

# This version of Cog adds support `cog run` on non-GPU environments like GitHub Actions' default runners
- name: Install Cog v0.8.0-beta3
run: |
sudo curl -o /usr/local/bin/cog -L https://github.com/replicate/cog/releases/download/v0.8.0-beta3/cog_Linux_x86_64
sudo chmod +x /usr/local/bin/cog

- name: Print Docker and Cog version info
run: |
docker version
cog --version

- name: Download model weights from HuggingFace
run: |
cog run script/download-weights

- name: Log in to Replicate
env:
REPLICATE_API_TOKEN: ${{ secrets.REPLICATE_API_TOKEN }}
run: |
echo $REPLICATE_API_TOKEN | cog login --token-stdin

- name: Push to Replicate
run: |
cog push r8.im/${{ inputs.model_name }}
8 changes: 1 addition & 7 deletions cog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@ build:
gpu: true
cuda: "11.6"
python_version: "3.10"
python_packages:
- "diffusers==0.11.1"
- "torch==1.13.0"
- "ftfy==6.1.1"
- "scipy==1.9.3"
- "transformers==4.25.1"
- "accelerate==0.15.0"
python_requirements: "requirements.txt"
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think python_requirements is a thing now? See replicate/cog#714

Using it here so I can manually pip install -r requirements.txt in the Actions workflow.


predict: "predict.py:Predictor"
6 changes: 6 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
diffusers==0.11.1
torch==1.13.0
ftfy==6.1.1
scipy==1.9.3
transformers==4.25.1
accelerate==0.15.0