Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -64,9 +64,11 @@ def train_model(request: TrainingRequest):
|
|
| 64 |
with open(dataset_path, "w", encoding="utf-8") as f:
|
| 65 |
f.write(request.dataset_content)
|
| 66 |
|
| 67 |
-
#
|
|
|
|
|
|
|
| 68 |
cmd = [
|
| 69 |
-
"python",
|
| 70 |
"--task", request.task,
|
| 71 |
"--model_name", request.model_name,
|
| 72 |
"--dataset", dataset_path,
|
|
@@ -76,7 +78,7 @@ def train_model(request: TrainingRequest):
|
|
| 76 |
"--vocab_size", str(request.model_params.get('vocab_size', 30000)),
|
| 77 |
"--sequence_length", str(request.model_params.get('sequence_length', 512))
|
| 78 |
]
|
| 79 |
-
|
| 80 |
# Start the training process as a background task
|
| 81 |
subprocess.Popen(cmd, cwd=session_dir)
|
| 82 |
|
|
|
|
| 64 |
with open(dataset_path, "w", encoding="utf-8") as f:
|
| 65 |
f.write(request.dataset_content)
|
| 66 |
|
| 67 |
+
# Define the path to train_model.py (assuming it's in the root directory)
|
| 68 |
+
TRAIN_MODEL_PATH = os.path.join(os.path.dirname(__file__), "train_model.py")
|
| 69 |
+
|
| 70 |
cmd = [
|
| 71 |
+
"python", TRAIN_MODEL_PATH,
|
| 72 |
"--task", request.task,
|
| 73 |
"--model_name", request.model_name,
|
| 74 |
"--dataset", dataset_path,
|
|
|
|
| 78 |
"--vocab_size", str(request.model_params.get('vocab_size', 30000)),
|
| 79 |
"--sequence_length", str(request.model_params.get('sequence_length', 512))
|
| 80 |
]
|
| 81 |
+
|
| 82 |
# Start the training process as a background task
|
| 83 |
subprocess.Popen(cmd, cwd=session_dir)
|
| 84 |
|