GTX 1660 super์— ๋งž๋Š” tensorflow, python, CUDA, Cudnn ๋ฒ„์ „
ยท
๐Ÿ‘พ Deep Learning
[main] gtx 1660 super Python = 3.7.6 tensorflow_version=2.4.0 CUDA = 11.0 cudnn = 8.0.5
Optimizer ( Adam, SGD )
ยท
๐Ÿ‘พ Deep Learning
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..
์†์‹ค ํ•จ์ˆ˜ (loss function)
ยท
๐Ÿ‘พ Deep Learning
๋ชจ๋ธ์„ ํ•™์Šตํ•  ๋•Œ ์†์‹คํ•จ์ˆ˜๋ฅผ ์ง€ํ‘œ๋กœ ์‚ผ๊ณ  ๋ชจ๋ธ์˜ ํ•™์Šต์„ ๊ด€์ฐฐํ•œ๋‹ค. ์ •ํ™•๋„๋ฅผ ๋ชฉํ‘œ๋กœ ํ•˜๋ฉด ๋˜๋Š”๋ฐ ์™œ ์ •ํ™•๋„๋ฅผ ์ง€ํ‘œ๋กœ ํ•˜์ง€ ์•Š์„๊นŒ? ๊ทธ ์ด์œ ๋Š” ๋ฏธ๋ถ„์„ ์ฃผ๋กœ ์‚ฌ์šฉํ•˜๋Š” ํ•™์Šต ๋ชจ๋ธ์—์„œ ์ •ํ™•๋„๋Š” ๋Œ€๋ถ€๋ถ„์ด ๋ฏธ๋ถ„๊ฐ’์ด 0์ธ ์ง€์ ์œผ๋กœ ์‚ผ์•„ ๋ฏธ๋ถ„๊ฐ’์— ๋Œ€ํ•œ ๋ณ€ํ™”๋ฅผ ์•Œ์ˆ˜ ์—†๋‹ค. ์ด์— ๋ฐ˜๋ฉด ์†์‹คํ•จ์ˆ˜๋Š” ๋ฏธ๋ถ„๊ฐ’์— ์˜ํ–ฅ์„ ๋ฐ›์ง€ ์•Š์•„ ๋ณ€ํ™”๋Ÿ‰์„ ๊ด€์ฐฐํ•  ์ˆ˜ ์žˆ๋‹ค. ์ •ํ™•๋„๋Š” ๋งค๊ฐœ ๋ณ€์ˆ˜์˜ ๋ณ€ํ™”์— ๊ฑฐ์˜ ๋ฐ˜์‘์„ ๋ณด์ด์ง€ ์•Š๊ณ  ๋ฐ˜์‘์ด ์žˆ๋”๋ผ๋„ ๊ทธ ๊ฐ’์ด ๋ถˆ์—ฐ์†์ ์œผ๋กœ ๋ณ€ํ•œ๋‹ค. ์˜ˆ๋ฅผ ๋“ค๋ฉด ํ™œ์„ฑํ™” ํ•จ์ˆ˜๋กœ ๊ณ„๋‹จ ํ•จ์ˆ˜๋ฅผ ์‚ฌ์šฉํ–ˆ๋‹ค๊ณ  ๊ฐ€์ •ํ•˜๋ฉด 0์„ ๊ธฐ์ค€์œผ๋กœ ๋ฏธ๋ถ„๊ฐ’์ด ๋ชจ๋‘ 0์ด๋‹ค. ๋”ฐ๋ผ์„œ ๋งค๊ฐœ๋ณ€์ˆ˜๊ฐ€ ์ฃผ๋Š” ๋ณ€ํ™”๋ฅผ ๊ณ„๋‹จํ•จ์ˆ˜๊ฐ€ ๋ชจ๋‘ ์‚ฌ๋ผ์ง€๊ฒŒ ๋งŒ๋“ค์–ด ์†์‹คํ•จ์ˆ˜์˜ ๊ฐ’์— ์•„๋ฌด๋Ÿฐ ๋ณ€ํ™”๊ฐ€ ์—†๋‹ค. ์‹œ๊ทธ๋ชจ์ด๋“œ ํ•จ์ˆ˜๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ๋ฏธ๋ถ„ ๊ฐ’์ด 0์ด ๋˜๋Š” ๊ตฌ๊ฐ„์ด ์—†์–ด ๋ชจ๋“  ๊ตฌ๊ฐ„์—์„œ ๋งค๊ฐœ ๋ณ€์ˆ˜์˜..
tensorboard ์‚ฌ์šฉ๋ฒ•, gpu ํ• ๋‹น ๋ฉ”๋ชจ๋ฆฌ ๊ด€๋ฆฌ
ยท
๐Ÿ‘พ Deep Learning
[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..
OSError: [WinError 127] ์ง€์ •๋œ ํ”„๋กœ์‹œ์ €๋ฅผ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค. Error loading \\torch\\lib\\*_ops_gpu.dll or one of its dependencies.
ยท
๐Ÿ‘พ Deep Learning
ํ•ด๋‹น ์˜ค๋ฅ˜๋Š” 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
TFBertModel parameter
ยท
๐Ÿ‘พ Deep Learning
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 RuntimeWarning ํ•ด๊ฒฐ
ยท
๐Ÿ‘พ Deep Learning
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.])
ํ™œ์„ฑํ™” ํ•จ์ˆ˜(activation function)
ยท
๐Ÿ‘พ Deep Learning
๊ธฐ์ดˆ 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)