Deep Learning

[main] gtx 1660 super Python = 3.7.6 tensorflow_version=2.4.0 CUDA = 11.0 cudnn = 8.0.5
Adam Adam: Adaptive moment estimation Adam = RMSprop + Momentum Momentum : gradient descent 시 최소점을 찾기 위해 모든 스텝을 밟는 것이 아닌 스텝을 건너 뛴다. Stochastic gradient descent(SGD) Adagrad It makes big updates for infrequent parameters and small updates for frequent parameters. For this reason, it is well-suited for dealing with sparse data. The main benefit of Adagrad is that we don’t need to tune the learning..
모델을 학습할 때 손실함수를 지표로 삼고 모델의 학습을 관찰한다. 정확도를 목표로 하면 되는데 왜 정확도를 지표로 하지 않을까? 그 이유는 미분을 주로 사용하는 학습 모델에서 정확도는 대부분이 미분값이 0인 지점으로 삼아 미분값에 대한 변화를 알수 없다. 이에 반면 손실함수는 미분값에 영향을 받지 않아 변화량을 관찰할 수 있다. 정확도는 매개 변수의 변화에 거의 반응을 보이지 않고 반응이 있더라도 그 값이 불연속적으로 변한다. 예를 들면 활성화 함수로 계단 함수를 사용했다고 가정하면 0을 기준으로 미분값이 모두 0이다. 따라서 매개변수가 주는 변화를 계단함수가 모두 사라지게 만들어 손실함수의 값에 아무런 변화가 없다. 시그모이드 함수를 사용하면 미분 값이 0이 되는 구간이 없어 모든 구간에서 매개 변수의..
[tensorboard] 아나콘다 명령 prompt >tensorboard --logdir=./path/logs/ [gpu 메모리 관리] tf version 1.xx config = tf.ConfigProto() config.gpu_options.allow_growth = True session = tf.Session(config=config) [gpu 메모리 관리] tf version 2.xx config = tf.compat.v1.ConfigProto() config.gpu_options.allow_growth = True session = tf.compat.v1.Session(config=config) [gpu 사용량 80%] config = tf.compat.v1.ConfigProto() conf..
해당 오류는 pytorch 버전을 1.5.1이하로 낮추면 해결된다. 버전별 설치 방법 pytorch.org/get-started/previous-versions/ PyTorch An open source deep learning platform that provides a seamless path from research prototyping to production deployment. pytorch.org
huggingface.co/transformers/model_doc/bert.html BERT — transformers 4.3.0 documentation past_key_values (tuple(tuple(torch.FloatTensor)), optional, returned when use_cache=True is passed or when config.use_cache=True) – Tuple of tuple(torch.FloatTensor) of length config.n_layers, with each tuple having 2 tensors of shape (batch_size, num_he huggingface.co vocab_size (int, optional, defaults to 3..
softmax 구현 def softmax(x): return np.exp(x)/np.sum(np.exp(x)) 수식을 잘 구현했지만 한 가지 문제가 있다. softmax([900,123,22]) # array([nan, 0., 0.] 900만 돼도 Runtimewarning 과 함께 nan 값이 나온다. 따라서 값을 집어 넣어 값에 영향을 주지않고 0으로 가지 않게 해야한다. 인풋의 최댓값을 값들에서 빼서 해결한다. def softmax(x): return np.exp(x-np.max(x))/np.sum(np.exp(x-np.max(x))) softmax([900,123,22]) # array([0., 0., 0.])
기초 input과 가중치(wi)의 곱들의 합이 threshold 문턱값을 넘었을 때 출력하는 hidden layer의 또는 output layer의 값을 말한다. 가장 많이 사용하는 시그모이드 함수느 0~1의 연속된 값을 갖도록한다. 시그모이드 함수에 앞서 계단함수를 구현해 본다. def step_function(x): if x>0: return 1 else: return 0 step_function은 x의 값이 0보다 크면 1의 값을 작거나 같으면 0의 값을 리턴해준다. 하지만 이 함수는 x의 값 하나만 받을 수 있다. 따라서 배열 형태의 input 값을 받을 수 있게 함수화 한다. x = np.array([-1.0,1.,2.]) y = x > 0 y # array([False, True, True])..
다했다
'Deep Learning' 카테고리의 글 목록 (6 Page)