Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -56,11 +56,12 @@ def train_stock_model(stock_symbol, start_date, end_date, feature_range=(10, 100
|
|
56 |
seq = [np.array(scaled_data[i:i + data_seq_length]) for i in range(len(scaled_data) - data_seq_length)]
|
57 |
target = [np.array(scaled_data[i + data_seq_length:i + data_seq_length + 1]) for i in range(len(scaled_data) - data_seq_length)]
|
58 |
|
59 |
-
seq_tensors = [torch.tensor(s, dtype=torch.float32)
|
60 |
target_tensors = [t[0] for t in target]
|
61 |
|
62 |
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
63 |
model = StockLlamaForForecasting.from_pretrained("Q-bert/StockLlama").to(device)
|
|
|
64 |
config = LoraConfig(
|
65 |
r=64,
|
66 |
lora_alpha=32,
|
@@ -70,7 +71,7 @@ def train_stock_model(stock_symbol, start_date, end_date, feature_range=(10, 100
|
|
70 |
task_type="CAUSAL_LM",
|
71 |
)
|
72 |
model = get_peft_model(model, config)
|
73 |
-
|
74 |
login(token=HF_TOKEN)
|
75 |
wandb.login(key=WANDB_TOKEN)
|
76 |
dct = {"input_ids": seq_tensors, "label": target_tensors}
|
|
|
56 |
seq = [np.array(scaled_data[i:i + data_seq_length]) for i in range(len(scaled_data) - data_seq_length)]
|
57 |
target = [np.array(scaled_data[i + data_seq_length:i + data_seq_length + 1]) for i in range(len(scaled_data) - data_seq_length)]
|
58 |
|
59 |
+
seq_tensors = [torch.tensor(s, dtype=torch.float32) for s in seq]
|
60 |
target_tensors = [t[0] for t in target]
|
61 |
|
62 |
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
63 |
model = StockLlamaForForecasting.from_pretrained("Q-bert/StockLlama").to(device)
|
64 |
+
print("Model Installed.")
|
65 |
config = LoraConfig(
|
66 |
r=64,
|
67 |
lora_alpha=32,
|
|
|
71 |
task_type="CAUSAL_LM",
|
72 |
)
|
73 |
model = get_peft_model(model, config)
|
74 |
+
print("Model pefted.")
|
75 |
login(token=HF_TOKEN)
|
76 |
wandb.login(key=WANDB_TOKEN)
|
77 |
dct = {"input_ids": seq_tensors, "label": target_tensors}
|