Skip to content
Open
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
99 changes: 99 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL Advanced"

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
schedule:
- cron: '18 18 * * 3'

jobs:
analyze:
name: Analyze (${{ matrix.language }})
# Runner size impacts CodeQL analysis time. To learn more, please see:
# - https://gh.io/recommended-hardware-resources-for-running-codeql
# - https://gh.io/supported-runners-and-hardware-resources
# - https://gh.io/using-larger-runners (GitHub.com only)
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
permissions:
# required for all workflows
security-events: write

# required to fetch internal or private CodeQL packs
packages: read

# only required for workflows in private repositories
actions: read
contents: read

strategy:
fail-fast: false
matrix:
include:
- language: python
build-mode: none
# CodeQL supports the following values keywords for 'language': 'actions', 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'rust', 'swift'
# Use `c-cpp` to analyze code written in C, C++ or both
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
steps:
- name: Checkout repository
uses: actions/checkout@v7

# Add any setup steps before running the `github/codeql-action/init` action.
# This includes steps like installing compilers or runtimes (`actions/setup-node`
# or others). This is typically only required for manual builds.
# - name: Setup runtime (example)
# uses: actions/setup-example@v1

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v4
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality

# If the analyze step fails for one of the languages you are analyzing with
# "We were unable to automatically build your code", modify the matrix above
# to set the build mode to "manual" for that language. Then modify this step
# to build your code.
# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
- name: Run manual build steps
if: matrix.build-mode == 'manual'
shell: bash
run: |
echo 'If you are using a "manual" build mode for one or more of the' \
'languages you are analyzing, replace this with the commands to build' \
'your code, for example:'
echo ' make bootstrap'
echo ' make release'
exit 1

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v4
with:
category: "/language:${{matrix.language}}"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ vox-adv-cpk.pth.tar
__pycache__

*.log
fomm/
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,28 @@

Photorealistic avatars for video-conferencing.

Avatarify Python requires manually downloading and installing some dependencies, and is therefore best suited for users who have some experience with command line applications. [Avatarify Desktop](https://github.com/alievk/avatarify-desktop), which aims to be easier to install and use, is recommended for most users. If you still want to use Avatarify Python, proceed to the [install instructions](docs/).
Avatarify Python requires manually downloading and installing some dependencies, and is therefore best suited for users who have some experience with command line applications. [Avatarify Desktop](https://github.com/alievk/avatarify-desktop) is available for users who prefer a graphical interface.

```bash
bash scripts/setup_all.sh
```

Based on [First Order Motion Model](https://github.com/AliaksandrSiarohin/first-order-model).

## News
- **7 Mar 2021.** Renamed project to Avatarify Python to distinguish it from other versions of Avatarify
- **14 December 2020.** Released Avatarify Desktop. Check it out [here](https://github.com/alievk/avatarify-desktop).
- **11 July 2020.** Added Docker support. Now you can run Avatarify from Docker on [Linux](https://github.com/alievk/avatarify-python/blob/master/docs/README.md#docker). Thanks to [mikaelhg](https://github.com/mikaelhg) and [mintmaker](https://github.com/mintmaker) for contribution!
- **11 July 2020.** Added Docker support. Now you can run Avatarify from Docker on [Linux](https://github.com/alievk/avatarify-python/blob/master/docs/README.md#docker). Thanks to [mikaelhg](https://github.com/mikaelhg).
- **22 May 2020.** Added [Google Colab](https://colab.research.google.com/github/alievk/avatarify/blob/master/avatarify.ipynb) mode. Now you can run Avatarify on any computer without GPU!
- **7 May 2020.** Added remote GPU support for all platforms (based on [mynameisfiber's](https://github.com/mynameisfiber) solution). [Demo](https://youtu.be/3Dz_bUIPYFM). Deployment [instructions](https://github.com/alievk/avatarify-python/wiki/Remote-GPU).
- **7 May 2020.** Added remote GPU support for all platforms (based on [mynameisfiber's](https://github.com/mynameisfiber) solution). [Demo](https://youtu.be/3Dz_bUIPYFM). Deployment [instructions](https://github.com/alievk/avatarify-python/wiki/Remote-GPU).
- **24 April 2020.** Added Windows installation [tutorial](https://www.youtube.com/watch?v=lym9ANVb120).
- **17 April 2020.** Created Slack community. Please join via [invitation link](https://join.slack.com/t/avatarify/shared_invite/zt-dyoqy8tc-~4U2ObQ6WoxuwSaWKKVOgg).
- **15 April 2020.** Added [StyleGAN-generated](https://www.thispersondoesnotexist.com) avatars. Just press `Q` and now you drive a person that never existed. Every time you push the button – new avatar is sampled.
- **13 April 2020.** Added Windows support (kudos to [9of9](https://github.com/9of9)).

## Avatarify apps

We have deployed Avatarify on iOS and Android devices using our proprietary inference engine. The iOS version features the Life mode for recording animations in real time. However, the Life mode is not available on Android devices due to the diversity of the devices we have to support.
We have deployed Avatarify on iOS and Android devices using our proprietary inference engine. The iOS version features the Life mode for recording animations in real time. However, the Life mode is not available on the web and desktop versions yet.

[<img src=docs/appstore-badge.png alt="drawing" height="40"/>](https://apps.apple.com/app/apple-store/id1512669147?pt=121960189&ct=GitHub&mt=8)
[<img src=docs/google-play-badge.png alt="drawing" height="40"/>](https://play.google.com/store/apps/details?id=com.avatarify.android)
21 changes: 21 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Security Policy

## Supported Versions

Use this section to tell people about which versions of your project are
currently being supported with security updates.

| Version | Supported |
| ------- | ------------------ |
| 5.1.x | :white_check_mark: |
| 5.0.x | :x: |
| 4.0.x | :white_check_mark: |
| < 4.0 | :x: |

## Reporting a Vulnerability

Use this section to tell people how to report a vulnerability.

Tell them where to go, how often they can expect to get an update on a
reported vulnerability, what to expect if the vulnerability is accepted or
declined, etc.
7 changes: 7 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@ Of course, you also need a webcam!

## Install

#### One-command setup
Run the all-in-one setup helper to install dependencies for your platform and download the pretrained network weights:
```bash
bash scripts/setup_all.sh
```
On Linux, add `--no-vcam` if you want to skip virtual camera kernel module installation. Use `--skip-install` or `--skip-weights` to run only part of the setup. If the default weights host is unavailable, set `AVATARIFY_WEIGHTS_URL` to a reachable mirror before running the command.

#### Download network weights
Download model's weights from [here](https://openavatarify.s3-avatarify.com/weights/vox-adv-cpk.pth.tar) or [here](https://yadi.sk/d/M0FWpz2ExBfgAA) or [here](https://drive.google.com/file/d/1coUCdyRXDbpWnEkA99NLNY60mb9dQ_n3/view?usp=sharing) [228 MB, md5sum `8a45a24037871c045fbb8a6a8aa95ebc`]

Expand Down
5 changes: 5 additions & 0 deletions docs/admin-speaking-expanded.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Project Documentation

This directory contains documentation for the Avatarify Python project.

For detailed setup and usage instructions, see [README.md](README.md).
46 changes: 40 additions & 6 deletions scripts/download_data.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,48 @@
#!/usr/bin/env bash
set -euo pipefail

filename=vox-adv-cpk.pth.tar
expected_checksum=8a45a24037871c045fbb8a6a8aa95ebc

curl https://openavatarify.s3-avatarify.com/weights/$filename -o $filename
urls=(
"${AVATARIFY_WEIGHTS_URL:-}"
"https://openavatarify.s3-avatarify.com/weights/$filename"
"https://openavatarify.s3.amazonaws.com/weights/$filename"
)

echo "Expected checksum: 8a45a24037871c045fbb8a6a8aa95ebc"
downloaded=0
for url in "${urls[@]}"; do
if [[ -z "$url" ]]; then
continue
fi

if [ "$(uname)" == "Darwin" ]; then
sum=`md5 ${filename}`
echo "Downloading $filename from $url"
if curl -fL "$url" -o "$filename"; then
downloaded=1
break
fi

echo "Download failed from $url" >&2
done

if [[ "$downloaded" -ne 1 ]]; then
echo "Unable to download $filename. Set AVATARIFY_WEIGHTS_URL to a reachable mirror and retry." >&2
exit 1
fi

if command -v md5sum >/dev/null 2>&1; then
found_checksum=$(md5sum "$filename" | awk '{print $1}')
elif command -v md5 >/dev/null 2>&1; then
found_checksum=$(md5 -q "$filename")
else
sum=`md5sum ${filename}`
echo "Neither md5sum nor md5 is available; cannot verify $filename." >&2
exit 1
fi

echo "Expected checksum: $expected_checksum"
echo "Found checksum: $found_checksum"

if [[ "$found_checksum" != "$expected_checksum" ]]; then
echo "Checksum mismatch for $filename." >&2
exit 1
fi
echo "Found checksum: $sum"
89 changes: 89 additions & 0 deletions scripts/setup_all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
#!/usr/bin/env bash
set -euo pipefail

# One-command setup helper for Avatarify Python.
# Installs Python dependencies using the platform install script and downloads
# the pretrained network weights into the repository root.

ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$ROOT_DIR"

WEIGHTS_FILE="vox-adv-cpk.pth.tar"
EXPECTED_MD5="8a45a24037871c045fbb8a6a8aa95ebc"

RUN_INSTALL=1
RUN_DOWNLOAD=1
INSTALL_ARGS=()

usage() {
cat <<USAGE
Usage: bash scripts/setup_all.sh [options]

Install Avatarify Python dependencies and download model weights.

Options:
--no-vcam Skip Linux virtual camera kernel module installation.
--skip-install Do not run the dependency installer.
--skip-weights Do not download model weights.
-h, --help Show this help text.

Any other option is forwarded to the platform install script.
USAGE
}

md5_value() {
if command -v md5sum >/dev/null 2>&1; then
md5sum "$1" | awk '{print $1}'
elif command -v md5 >/dev/null 2>&1; then
md5 -q "$1"
else
echo "Neither md5sum nor md5 is available." >&2
return 1
fi
}

for arg in "$@"; do
case "$arg" in
--no-vcam)
INSTALL_ARGS+=("$arg")
;;
--skip-install)
RUN_INSTALL=0
;;
--skip-weights)
RUN_DOWNLOAD=0
;;
-h|--help)
usage
exit 0
;;
*)
INSTALL_ARGS+=("$arg")
;;
esac
done

if [[ "$RUN_INSTALL" -eq 1 ]]; then
case "$(uname)" in
Linux)
bash scripts/install.sh "${INSTALL_ARGS[@]}"
;;
Darwin)
bash scripts/install_mac.sh "${INSTALL_ARGS[@]}"
;;
*)
echo "Unsupported platform: $(uname). Use the Windows installer on Windows." >&2
exit 1
;;
esac
fi

if [[ "$RUN_DOWNLOAD" -eq 1 ]]; then
if [[ -f "$WEIGHTS_FILE" ]] && [[ "$(md5_value "$WEIGHTS_FILE")" == "$EXPECTED_MD5" ]]; then
echo "$WEIGHTS_FILE already exists with the expected checksum."
else
bash scripts/download_data.sh
fi
fi

echo "Avatarify Python setup complete."