diff --git a/.gitignore b/.gitignore index 16a6450..1bcd374 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,5 @@ venv model_resutls.txt model metrics.txt -metrics.png \ No newline at end of file +metrics.png +my_runs \ No newline at end of file diff --git a/Jenkinsfile b/Jenkinsfile index f4584f0..c4aa212 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -21,7 +21,7 @@ pipeline { withEnv(["EPOCH=${params.EPOCH}"]) { copyArtifacts filter: '*', projectName: 's444463-create-dataset' sh 'python3 ./deepl.py $EPOCH' - archiveArtifacts artifacts: "model" + archiveArtifacts artifacts: "model, my_runs" build job: "s444463-evaluation/master" } } diff --git a/deepl.py b/deepl.py index ccb09b3..62720db 100644 --- a/deepl.py +++ b/deepl.py @@ -10,7 +10,17 @@ from torch import nn from torch import optim import matplotlib.pyplot as plt import sys +from sacred import Experiment +from sacred.observers import FileStorageObserver +ex = Experiment() + +ex.observers.append(FileStorageObserver('my_runs')) +vectorizer = TfidfVectorizer() + +@ex.config +def my_config(): + epochs = 10 def convert_text_to_model_form(text): @@ -18,12 +28,12 @@ def convert_text_to_model_form(text): b = torch.tensor(scipy.sparse.csr_matrix.todense(a)).float() return b - -if __name__ == "__main__": - print(sys.argv[1]) - print(type(sys.argv[1])) - print(sys.argv[1]) - epochs = int(sys.argv[1]) +@ex.automain +def my_main(epochs, _run): + # print(sys.argv[1]) + # print(type(sys.argv[1])) + # print(sys.argv[1]) + # epochs = int(sys.argv[1]) # epochs=10 # kaggle.api.authenticate() @@ -59,7 +69,6 @@ if __name__ == "__main__": y_dev = np.array(y_dev) y_test = np.array(y_test) - vectorizer = TfidfVectorizer() company_profile = vectorizer.fit_transform(company_profile) x_train = vectorizer.transform(x_train) @@ -172,6 +181,7 @@ if __name__ == "__main__": f.close() torch.save(model, 'model') + ex.add_artifact("model") # plt.figure(figsize=(12, 5))