Skip to content

Commit a55d3ea

Browse files
authored
chore: set PYTORCH_ENABLE_MPS_FALLBACK=1 for examples using GPU (#877)
1 parent 397f38f commit a55d3ea

File tree

13 files changed

+52
-0
lines changed

13 files changed

+52
-0
lines changed

examples/amazon_s3_embedding/.env.example

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,7 @@ AMAZON_S3_BUCKET_NAME=your-bucket-name
99

1010
# Optional
1111
# AMAZON_S3_SQS_QUEUE_URL=
12+
13+
# Fallback to CPU for operations not supported by MPS on Mac.
14+
# It's no-op for other platforms.
15+
PYTORCH_ENABLE_MPS_FALLBACK=1

examples/azure_blob_embedding/.env.example

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,7 @@ COCOINDEX_DATABASE_URL=postgres://cocoindex:cocoindex@localhost/cocoindex
55
AZURE_STORAGE_ACCOUNT_NAME=testnamecocoindex1
66
AZURE_BLOB_CONTAINER_NAME=testpublic1
77
AZURE_BLOB_PREFIX=
8+
9+
# Fallback to CPU for operations not supported by MPS on Mac.
10+
# It's no-op for other platforms.
11+
PYTORCH_ENABLE_MPS_FALLBACK=1

examples/code_embedding/.env

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
# Postgres database address for cocoindex
22
COCOINDEX_DATABASE_URL=postgres://cocoindex:cocoindex@localhost/cocoindex
3+
4+
# Fallback to CPU for operations not supported by MPS on Mac.
5+
# It's no-op for other platforms.
6+
PYTORCH_ENABLE_MPS_FALLBACK=1

examples/face_recognition/.env

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
# Postgres database address for cocoindex
22
COCOINDEX_DATABASE_URL=postgres://cocoindex:cocoindex@localhost/cocoindex
3+
4+
# Fallback to CPU for operations not supported by MPS on Mac.
5+
# It's no-op for other platforms.
6+
PYTORCH_ENABLE_MPS_FALLBACK=1

examples/fastapi_server_docker/.env

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,7 @@ COCOINDEX_DATABASE_URL=postgres://cocoindex:cocoindex@coco_db:5436/cocoindex
33

44
# For local testing
55
# COCOINDEX_DATABASE_URL=postgres://cocoindex:cocoindex@localhost/cocoindex
6+
7+
# Fallback to CPU for operations not supported by MPS on Mac.
8+
# It's no-op for other platforms.
9+
PYTORCH_ENABLE_MPS_FALLBACK=1

examples/gdrive_text_embedding/.env.example

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,7 @@ GOOGLE_SERVICE_ACCOUNT_CREDENTIAL=/path/to/service_account_credential.json
88
# Google Drive root folder IDs, comma separated.
99
#! PLEASE FILL IN
1010
GOOGLE_DRIVE_ROOT_FOLDER_IDS=id1,id2
11+
12+
# Fallback to CPU for operations not supported by MPS on Mac.
13+
# It's no-op for other platforms.
14+
PYTORCH_ENABLE_MPS_FALLBACK=1

examples/image_search/.env

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
11
export COCOINDEX_DATABASE_URL="postgres://cocoindex:cocoindex@localhost/cocoindex"
2+
3+
# Fallback to CPU for operations not supported by MPS on Mac.
4+
# It's no-op for other platforms.
5+
PYTORCH_ENABLE_MPS_FALLBACK=1
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
# Postgres database address for cocoindex
22
COCOINDEX_DATABASE_URL=postgres://cocoindex:cocoindex@localhost/cocoindex
3+
4+
# Fallback to CPU for operations not supported by MPS on Mac.
5+
# It's no-op for other platforms.
6+
PYTORCH_ENABLE_MPS_FALLBACK=1
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
# Postgres database address for cocoindex
22
COCOINDEX_DATABASE_URL=postgres://cocoindex:cocoindex@localhost/cocoindex
3+
4+
# Fallback to CPU for operations not supported by MPS on Mac.
5+
# It's no-op for other platforms.
6+
PYTORCH_ENABLE_MPS_FALLBACK=1

examples/paper_metadata/.env.example

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,7 @@
22
COCOINDEX_DATABASE_URL=postgres://cocoindex:cocoindex@localhost/cocoindex
33

44
OPENAI_API_KEY=
5+
6+
# Fallback to CPU for operations not supported by MPS on Mac.
7+
# It's no-op for other platforms.
8+
PYTORCH_ENABLE_MPS_FALLBACK=1

0 commit comments

Comments
 (0)