-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
train.py
38 lines (30 loc) · 1.26 KB
/
train.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import os
import zipfile
import torch
import pandas as pd
from model import Model
from data_sources.archetypes import ArchetypeBlender
from data_sources.user_neural_pattern import UserNeuralPattern
from data_processing.process_data import DataProcessingLayer
def main():
print("Welcome to AMI Training")
# Download and extract the dataset
os.system('kaggle datasets download -d openhermes/openhermes -p ./data')
with zipfile.ZipFile('./data/openhermes.zip', 'r') as zip_ref:
zip_ref.extractall('./data')
# Load the dataset
dataset_path = './data/openhermes.csv' # Adjust the path based on the extracted files
data = pd.read_csv(dataset_path)
# Initialize the model
input_dim = data.shape[1] - 1 # Assuming the last column is the target
output_dim = 1 # Adjust based on your target
model = Model(input_dim, output_dim, context="professional")
# Initialize the data processing layer
data_processing_layer = DataProcessingLayer(model)
# Process the data and train the model
data_processing_layer.process_data('my_bucket', 'my_object')
# Save the trained model
model.save_model('trained_model.pth')
print("Model training complete and saved as 'trained_model.pth'")
if __name__ == "__main__":
main()