In this article, I will share some of my experience on installing NVIDIA driver and CUDA on Linux OS. Here I mainly use Ubuntu as example. Comments for CentOS/Fedora are also provided as much as I can.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| os.environ['KERAS_BACKEND'] = 'theano' | |
| from keras.layers import Dense, Input | |
| from keras.layers import Embedding, Dropout, GRU, Bidirectional, TimeDistributed, concatenate, Masking | |
| from keras.models import Model | |
| from keras.layers.core import Reshape | |
| from keras import backend as K | |
| from keras.engine.topology import Layer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def train_step(self, input_data): | |
| labeled_data, labels = input_data | |
| # Train the both | |
| with tf.GradientTape() as tape: | |
| augmented_data, augmented_labels = augment_data(labeled_data, labels, self.unlabeled_train) | |
| logits_student = self.student(augmented_data) | |
| clf_loss = self.classification_costs(logits_student, augmented_labels) | |
| # we augment the data again |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <!--[if lt IE 7]><html lang="tr" xmlns:fb="https://www.facebook.com/2008/fbml" xmlns:addthis="https://www.addthis.com/help/api-spec" class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]--> | |
| <!--[if (IE 7)&!(IEMobile)]><html lang="tr" xmlns:fb="https://www.facebook.com/2008/fbml" xmlns:addthis="https://www.addthis.com/help/api-spec" class="no-js lt-ie9 lt-ie8"><![endif]--> | |
| <!--[if (IE 8)&!(IEMobile)]><html lang="tr" xmlns:fb="https://www.facebook.com/2008/fbml" xmlns:addthis="https://www.addthis.com/help/api-spec" class="no-js lt-ie9"><![endif]--> | |
| <!--[if gt IE 8]><!--> <html lang="tr" xmlns:fb="https://www.facebook.com/2008/fbml" xmlns:addthis="https://www.addthis.com/help/api-spec" class="no-js"><!--<![endif]--> | |
| <head> | |
| <meta charset="utf-8"> | |
| <!--[if IE]><meta http-equiv="X-UA-Compatible" content="IE=edge" /><![endif]--> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| def split_dataset(x, y,save = False, path = 'dataset'): | |
| num_samples = len(x) | |
| indices = np.arange(num_samples) | |
| np.random.shuffle(indices) | |
| split_1 = int(0.8 * num_samples) | |
| split_2 = int(0.9 * num_samples) | |
| indices_train = indices[1:split_1] | |
| indices_dev = indices[split_1:split_2] | |
| indices_test = indices[split_2:] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # install CUDA Toolkit v9.0 | |
| # instructions from https://developer.nvidia.com/cuda-downloads (linux -> x86_64 -> Ubuntu -> 16.04 -> deb) | |
| CUDA_REPO_PKG="cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64-deb" | |
| wget https://developer.nvidia.com/compute/cuda/9.0/Prod/local_installers/${CUDA_REPO_PKG} | |
| sudo dpkg -i ${CUDA_REPO_PKG} | |
| sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/7fa2af80.pub | |
| sudo apt-get update | |
| sudo apt-get -y install cuda-9-0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| False positive: Doğru varsayılan örneğin yanlış çıkması | |
| False negative: Yanlış varsayılan örneğin aslında doğru olması | |
| True positive: Örneğin doğru tahmin edilmesi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * This file is part of General Entity Annotator Benchmark. | |
| * | |
| * General Entity Annotator Benchmark is free software: you can redistribute it and/or modify | |
| * it under the terms of the GNU Lesser General Public License as published by | |
| * the Free Software Foundation, either version 3 of the License, or | |
| * (at your option) any later version. | |
| * | |
| * General Entity Annotator Benchmark is distributed in the hope that it will be useful, | |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of |