Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -51,7 +51,7 @@ def check_existing_model(stock_symbol, start_date, end_date):
|
|
| 51 |
|
| 52 |
@spaces.GPU(duration=300)
|
| 53 |
def train_stock_model(stock_symbol, start_date, end_date, feature_range=(10, 100), data_seq_length=256, epochs=10, batch_size=16, learning_rate=2e-4):
|
| 54 |
-
repo_id = f"Q-bert/StockLlama-tuned
|
| 55 |
|
| 56 |
if check_existing_model(stock_symbol, start_date, end_date):
|
| 57 |
return f"Model for {stock_symbol} from {start_date} to {end_date} already exists."
|
|
@@ -107,20 +107,20 @@ def train_stock_model(stock_symbol, start_date, end_date, feature_range=(10, 100
|
|
| 107 |
weight_decay=0.01,
|
| 108 |
lr_scheduler_type="linear",
|
| 109 |
seed=3407,
|
| 110 |
-
output_dir=f"StockLlama-LoRA-{stock_symbol}-{
|
| 111 |
),
|
| 112 |
)
|
| 113 |
|
| 114 |
trainer.train()
|
| 115 |
|
| 116 |
model = model.merge_and_unload()
|
| 117 |
-
model.push_to_hub(f"Q-bert/StockLlama-tuned-{stock_symbol}-{
|
| 118 |
scaler_path = "scaler.joblib"
|
| 119 |
joblib.dump(scaler, scaler_path)
|
| 120 |
upload_file(
|
| 121 |
path_or_fileobj=scaler_path,
|
| 122 |
path_in_repo=f"scalers/{scaler_path}",
|
| 123 |
-
repo_id=f"Q-bert/StockLlama-tuned-{stock_symbol}-{
|
| 124 |
)
|
| 125 |
return f"Training completed and model saved for {stock_symbol} from {start_date} to {end_date}."
|
| 126 |
|
|
|
|
| 51 |
|
| 52 |
@spaces.GPU(duration=300)
|
| 53 |
def train_stock_model(stock_symbol, start_date, end_date, feature_range=(10, 100), data_seq_length=256, epochs=10, batch_size=16, learning_rate=2e-4):
|
| 54 |
+
repo_id = f"Q-bert/StockLlama-tuned{stock_symbol}-{start_date}_{end_date}"
|
| 55 |
|
| 56 |
if check_existing_model(stock_symbol, start_date, end_date):
|
| 57 |
return f"Model for {stock_symbol} from {start_date} to {end_date} already exists."
|
|
|
|
| 107 |
weight_decay=0.01,
|
| 108 |
lr_scheduler_type="linear",
|
| 109 |
seed=3407,
|
| 110 |
+
output_dir=f"StockLlama-LoRA-{stock_symbol}-{start_date}_{end_date}",
|
| 111 |
),
|
| 112 |
)
|
| 113 |
|
| 114 |
trainer.train()
|
| 115 |
|
| 116 |
model = model.merge_and_unload()
|
| 117 |
+
model.push_to_hub(f"Q-bert/StockLlama-tuned-{stock_symbol}-{start_date}_{end_date}")
|
| 118 |
scaler_path = "scaler.joblib"
|
| 119 |
joblib.dump(scaler, scaler_path)
|
| 120 |
upload_file(
|
| 121 |
path_or_fileobj=scaler_path,
|
| 122 |
path_in_repo=f"scalers/{scaler_path}",
|
| 123 |
+
repo_id=f"Q-bert/StockLlama-tuned-{stock_symbol}-{start_date}_{end_date}"
|
| 124 |
)
|
| 125 |
return f"Training completed and model saved for {stock_symbol} from {start_date} to {end_date}."
|
| 126 |
|