misalsathsara commited on
Commit
81ad344
·
verified ·
1 Parent(s): db0ba77

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -1,12 +1,14 @@
 
 
 
 
 
 
1
  from fastapi import FastAPI
2
  from pydantic import BaseModel
3
  from transformers import AutoTokenizer, AutoModelForCausalLM
4
  import torch
5
  import re
6
- import os
7
-
8
- # Fix the permission issue by changing HF cache location
9
- os.environ["HF_HOME"] = "/tmp/hf"
10
 
11
  app = FastAPI()
12
 
 
1
+ import os
2
+
3
+ # Redirect Hugging Face cache to a writable directory
4
+ os.environ["HF_HOME"] = "/tmp"
5
+ os.environ["TRANSFORMERS_CACHE"] = "/tmp/hf-cache"
6
+
7
  from fastapi import FastAPI
8
  from pydantic import BaseModel
9
  from transformers import AutoTokenizer, AutoModelForCausalLM
10
  import torch
11
  import re
 
 
 
 
12
 
13
  app = FastAPI()
14