DEEPL with docker

This commit is contained in:
Mikołaj Pokrywka 2022-04-23 17:15:28 +02:00
parent b167cca6a4
commit fe9995edc1
5 changed files with 81 additions and 3022 deletions

15
Dockerfile Normal file
View File

@ -0,0 +1,15 @@
FROM ubuntu:latest
FROM python:3.8
RUN apt update
COPY ./requirements.txt .
RUN apt-get update
RUN pip3 install -r requirements.txt
RUN apt-get install zip unzip --yes
WORKDIR /app
COPY ./deepl.py .
CMD python3 deepl.py

43
Jenkinsfile vendored Normal file
View File

@ -0,0 +1,43 @@
pipeline {
agent {
dockerfile {
true
}
}
parameters {
string (
defaultValue: 'mikolajpokrywka',
description: 'Kaggle username',
name: 'KAGGLE_USERNAME',
trim: false
)
password(
defaultValue: '',
description: 'Kaggle token',
name: 'KAGGLE_KEY'
)
string (
defaultValue: '17000',
description: 'cut data',
name: 'CUTOFF',
trim: false
)
}
stages {
stage('checkout: Check out from version control') {
steps {
checkout([$class: 'GitSCM', branches: [[name: '*/master']], extensions: [], userRemoteConfigs: [[credentialsId: 's444463', url: 'https://git.wmi.amu.edu.pl/s444463/ium_444463.git']]])
}
}
stage('bash script') {
steps {
withEnv(["KAGGLE_USERNAME=${params.KAGGLE_USERNAME}",
"KAGGLE_KEY=${params.KAGGLE_KEY}",
"CUTOFF=${params.CUTOFF}"]) {
sh 'python3 ./download_data_and_process.py'
archiveArtifacts artifacts: "data_test.csv, data_dev.csv, data_train.csv, column_titles.csv, data.csv"
}
}
}
}
}

10
README.md Normal file
View File

@ -0,0 +1,10 @@
# Run with docker
`docker build -t ium .`
`docker run -e KAGGLE_USERNAME='your_kaggle_username' -e KAGGLE_KEY='<your_kaggle_key>' -e CUTOFF='1600' -it ium:latest`
Read models results:
`docker run -e KAGGLE_USERNAME='your_kaggle_username' -e KAGGLE_KEY='<your_kaggle_key>' -e CUTOFF='1600' -it ium:latest /bin/bash`
`python3 deepl.py`
`cat model_resutls.txt`

View File

@ -133,6 +133,7 @@ if __name__ == "__main__":
else: else:
FN.append(d) FN.append(d)
f_score = len(TP) / (len(TP) + 0.5 * (len(FP) + len(FN))) f_score = len(TP) / (len(TP) + 0.5 * (len(FP) + len(FN)))
print(f"F- score = {f_score}")
f = open("model_resutls.txt", "a") f = open("model_resutls.txt", "a")
f.write(f"F-SCORE = {f_score}\n") f.write(f"F-SCORE = {f_score}\n")
@ -155,15 +156,15 @@ if __name__ == "__main__":
f.write(i+"\n") f.write(i+"\n")
f.close() f.close()
plt.figure(figsize=(12, 5)) # plt.figure(figsize=(12, 5))
ax = plt.subplot(121) # ax = plt.subplot(121)
plt.xlabel('epochs') # plt.xlabel('epochs')
plt.ylabel('negative log likelihood loss') # plt.ylabel('negative log likelihood loss')
plt.plot(train_losses, label='Training loss') # plt.plot(train_losses, label='Training loss')
plt.plot(test_losses, label='Validation loss') # plt.plot(test_losses, label='Validation loss')
plt.legend(frameon=False) # plt.legend(frameon=False)
plt.subplot(122) # plt.subplot(122)
plt.xlabel('epochs') # plt.xlabel('epochs')
plt.ylabel('test accuracy') # plt.ylabel('test accuracy')
plt.plot(test_accuracies) # plt.plot(test_accuracies)
plt.show() # plt.show()

File diff suppressed because it is too large Load Diff