Spaces:
Paused
Paused
Update model_utils.py
Browse files- model_utils.py +6 -3
model_utils.py
CHANGED
@@ -7,7 +7,8 @@ from dotenv import load_dotenv
|
|
7 |
# Define the model directory and name
|
8 |
MODEL_DIR = "/home/user/model"
|
9 |
# MODEL_NAME = "Giang07/Llama-2-7b-chat-QLoRa"
|
10 |
-
MODEL_NAME = "meta-llama/Meta-Llama-3-8B"
|
|
|
11 |
|
12 |
# Load environment variables from .env file
|
13 |
load_dotenv()
|
@@ -22,9 +23,11 @@ def load_model():
|
|
22 |
config_path = os.path.join(MODEL_DIR, "config.json")
|
23 |
if not os.path.exists(config_path):
|
24 |
os.makedirs(MODEL_DIR, exist_ok=True)
|
25 |
-
model = AutoModelForCausalLM.from_pretrained(MODEL_NAME, use_auth_token=api_token)
|
|
|
26 |
model.save_pretrained(MODEL_DIR)
|
27 |
-
tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME, use_auth_token=api_token)
|
|
|
28 |
tokenizer.save_pretrained(MODEL_DIR)
|
29 |
else:
|
30 |
model = AutoModelForCausalLM.from_pretrained(MODEL_DIR)
|
|
|
7 |
# Define the model directory and name
|
8 |
MODEL_DIR = "/home/user/model"
|
9 |
# MODEL_NAME = "Giang07/Llama-2-7b-chat-QLoRa"
|
10 |
+
# MODEL_NAME = "meta-llama/Meta-Llama-3-8B"
|
11 |
+
MODEL_NAME = "microsoft/Phi-3-mini-128k-instruct"
|
12 |
|
13 |
# Load environment variables from .env file
|
14 |
load_dotenv()
|
|
|
23 |
config_path = os.path.join(MODEL_DIR, "config.json")
|
24 |
if not os.path.exists(config_path):
|
25 |
os.makedirs(MODEL_DIR, exist_ok=True)
|
26 |
+
# model = AutoModelForCausalLM.from_pretrained(MODEL_NAME, use_auth_token=api_token)
|
27 |
+
model = AutoModelForCausalLM.from_pretrained(MODEL_NAME, trust_remote_code=True)
|
28 |
model.save_pretrained(MODEL_DIR)
|
29 |
+
# tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME, use_auth_token=api_token)
|
30 |
+
tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME, trust_remote_code=True)
|
31 |
tokenizer.save_pretrained(MODEL_DIR)
|
32 |
else:
|
33 |
model = AutoModelForCausalLM.from_pretrained(MODEL_DIR)
|