Spaces:
Paused
Paused
Update vid2persona/init.py
Browse files- vid2persona/init.py +8 -0
vid2persona/init.py
CHANGED
@@ -14,6 +14,14 @@ ALLOWED_LLM_FOR_HF_PRO_ACCOUNTS = [
|
|
14 |
# "openchat/openchat-3.5-0106"
|
15 |
]
|
16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
def auth_gcp():
|
18 |
gcp_credentials = os.getenv("GCP_CREDENTIALS")
|
19 |
with open("gcp-credentials.json", "w") as f:
|
|
|
14 |
# "openchat/openchat-3.5-0106"
|
15 |
]
|
16 |
|
17 |
+
def init_model(model_id):
|
18 |
+
global tokenizer
|
19 |
+
global model
|
20 |
+
|
21 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
22 |
+
tokenizer.use_default_system_prompt = False
|
23 |
+
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.float16, device_map="auto")
|
24 |
+
|
25 |
def auth_gcp():
|
26 |
gcp_credentials = os.getenv("GCP_CREDENTIALS")
|
27 |
with open("gcp-credentials.json", "w") as f:
|