File size: 1,108 Bytes
9245d19
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
org: eagle
app: text-captcha
service: text-captcha

frameworkVersion: "3"
useDotenv: true

# Note: We can set region and stag from commandline
# `$ serverless deploy --region us-east-1 --stage production`
provider:
  # architecture: arm64
  name: aws
  region: ${opt:region, 'ap-northeast-1'}
  stage: ${opt:stage, 'development'}
  runtime: python3.10
  logRetentionInDays: 30
  ecr:
    images:
      appimage:
        path: ./

functions:
  lambda_function:
    # handler: handler.lambda_function
    image:
      name: appimage
    timeout: 90
    memorySize: 4096
    environment:
      # On Lambda, the default location is not writable. Only the "/tmp" folder is writable. Therefore, we need to set the cache location inside "/tmp".
      TORCH_HOME: /tmp/.ml_cache
      # TRANSFORMERS_CACHE: /tmp/.ml_cache/huggingface
custom:
  warmup:
    MLModelWarmer:
      enabled: true
      events:
        - schedule: rate(4 minutes)
      concurrency: ${env:WARMER_CONCURRENCY, 2}
      verbose: false
      timeout: 100
      payload:
        source: KEEP_LAMBDA_WARM

plugins:
  - serverless-plugin-warmup