๋ฐ˜์‘ํ˜•

์ „์ฒด ๊ธ€ 177

[PyTorch Implementation] ResNet-B, ResNet-C, ResNet-D, ResNet Tweaks

Bag of Tricks for Image Classification with Convolutional Neural Networks (He et al., CVPR 2019)์—์„œ ์†Œ๊ฐœ๋œ ResNet์˜ ๋ณ€ํ˜• ๋ชจ๋ธ๋“ค(tweaks)์— ๋Œ€ํ•œ PyTorch ์ฝ”๋“œ์ด๋‹ค. ๋…ผ๋ฌธ์—์„œ๋Š” ๋‘ ๊ฐœ์˜ ์œ ๋ช…ํ•œ ๋ณ€ํ˜• ๋ชจ๋ธ์ธ ResNet-B, C๋ฅผ ์†Œ๊ฐœํ•˜๊ณ , ์ƒˆ๋กœ์šด ๊ตฌ์กฐ์ธ ResNet-D๋ฅผ ์ œ์•ˆํ•˜๊ณ  ์žˆ๋‹ค. ResNet ๊ธฐ๋ณธ์ ์ธ ResNet์˜ ๊ตฌ์กฐ๋Š” Input stem๊ณผ 4๊ฐœ์˜ stage, ๊ทธ๋ฆฌ๊ณ  ๋งˆ์ง€๋ง‰ output layer๋กœ ์ด๋ฃจ์–ด์ ธ ์žˆ๋‹ค. Input stem : 7x7 conv์™€ maxpool๋กœ ์ด๋ฃจ์–ด์ ธ ์žˆ์œผ๋ฉฐ, channel dim์„ 64๋กœ ๋Š˜๋ฆฌ๊ณ  input size๋ฅผ 4๋ฐฐ ์ค„์ธ๋‹ค. Stage : ํ•œ ๊ฐœ์˜ downsampling..

[HuggingFace] Tokenizer์˜ ์—ญํ• ๊ณผ ๊ธฐ๋Šฅ, Token ID, Input ID, Token type ID, Attention Mask

HuggingFace์˜ Tokenizer์„ ์‚ฌ์šฉํ•˜๋ฉด Token (Input) ID, Attention Mask๋ฅผ ํฌํ•จํ•œ BatchEncoding์„ ์ถœ๋ ฅ์œผ๋กœ ๋ฐ›๊ฒŒ ๋œ๋‹ค. ์ด ๊ธ€์—์„œ๋Š” ์ด๋Ÿฌํ•œ HuggingFace์˜ Model input์— ๋Œ€ํ•ด ์ •๋ฆฌํ•ด ๋ณด๊ณ ์ž ํ•œ๋‹ค. Tokenizer class์— ๋Œ€ํ•œ ๊ฒŒ์‹œ๋ฌผ์€ ์—ฌ๊ธฐ์—์„œ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ค. ์ฐธ๊ณ : Official Docs Glossary Fine-tune for downstream tasks huggingface.co Tokenizer HuggingFace์˜ Tokenizer์„ ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์šฐ์„  ์ •์˜ํ•œ๋‹ค. ๋ณธ ์˜ˆ์ œ์—์„œ๋Š” BertTokenizer์„ ์‚ฌ์šฉํ•œ๋‹ค. from transformers import BertTokenizer tokenizer = BertToken..

[HuggingFace] Tokenizer class ์•Œ์•„๋ณด๊ธฐ

Official Docs: https://huggingface.co/docs/transformers/v4.19.2/en/main_classes/tokenizer Tokenizer Returns List[int], torch.Tensor, tf.Tensor or np.ndarray The tokenized ids of the text. huggingface.co Github: https://github.com/huggingface/tokenizers Tokenizer์€ ๋ชจ๋ธ์— ๋“ค์–ด๊ฐˆ input์„ ์ค€๋น„ํ•˜๋Š” ๋ฐ์— ํ•„์š”ํ•˜๋‹ค. Hugging Face์—์„œ ์ œ๊ณตํ•˜๋Š” Tokenizer class๋ฅผ ํ†ตํ•ด ์‰ฝ๊ฒŒ ์ด์šฉํ•  ์ˆ˜ ์žˆ๋‹ค. ๊ธฐ๋ณธ์ด ๋˜๋Š” class๋“ค์€ PreTrainedTokenizer์™€ PreTrainedTokeni..

[HuggingFace] Pipeline & AutoClass

PyTorch์—์„œ์˜ ์‚ฌ์šฉ๋ฒ• ์œ„์ฃผ๋กœ ์ •๋ฆฌํ•œ ๊ธ€ Quick tour Get up and running with ๐Ÿค— Transformers! Start using the pipeline() for rapid inference, and quickly load a pretrained model and tokenizer with an AutoClass to solve your text, vision or audio task. All code examples presented in the documentation have a huggingface.co HuggingFace์˜ ๊ฐ€์žฅ ๊ธฐ๋ณธ ๊ธฐ๋Šฅ์ธ pipeline()๊ณผ AutoClass๋ฅผ ์†Œ๊ฐœํ•œ๋‹ค. pipeline()์€ ๋น ๋ฅธ inference๋ฅผ ์œ„ํ•ด ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๊ณ , Au..

์ •๊ทœํ‘œํ˜„์‹ (Regular Expression) ๊ธฐ์ดˆ

์ •๊ทœํ‘œํ˜„์‹, ๋˜๋Š” ์ •๊ทœ์‹์€ 'ํŠน์ •ํ•œ ๊ทœ์น™์„ ๊ฐ€์ง„ ๋ฌธ์ž์—ด์˜ ์ง‘ํ•ฉ์„ ํ‘œํ˜„ํ•˜๋Š” ๋ฐ ์‚ฌ์šฉํ•˜๋Š” ํ˜•์‹ ์–ธ์–ด' ์ด๋‹ค. (์œ„ํ‚ค๋ฐฑ๊ณผ) ๊ธด ๋ฌธ์ž์—ด์—์„œ ํŠน์ • ํŒจํ„ด์„ ๊ฐ€์ง„ ๋ถ€๋ถ„์„ ์ฐพ์•„๋‚ด๋Š” ๋ฐ์— ์œ ์šฉํ•˜๊ฒŒ ์‚ฌ์šฉ๋  ์ˆ˜ ์žˆ๋‹ค. RegExr RegExr์—์„œ ์ •๊ทœํ‘œํ˜„์‹์„ ํ…Œ์ŠคํŠธํ•ด๋ณผ ์ˆ˜ ์žˆ๋‹ค. RegExr: Learn, Build, & Test RegEx RegExr is an online tool to learn, build, & test Regular Expressions (RegEx / RegExp). regexr.com [Expression] ๋ถ€๋ถ„์— ํ‘œํ˜„์‹์„ ์“ฐ๋ฉด, [Text] ๋ถ€๋ถ„์— ์ž…๋ ฅํ•œ ๋ฌธ์ž์—ด์—์„œ ํ•ด๋‹น๋˜๋Š” ๋ถ€๋ถ„์„ ํ‘œ์‹œํ•ด์ค€๋‹ค. ์•„๋ž˜ [Tools] ๋ถ€๋ถ„์—์„œ ํ‘œํ˜„์‹์˜ ๊ฐ ๋ถ€๋ถ„์„ ์„ค๋ช…ํ•ด์ค€๋‹ค. ํ‘œํ˜„์‹์— ๋งˆ์šฐ์Šค๋ฅผ ๊ฐ€์ ธ๊ฐ€๋ฉด ๊ฐ ๋ถ€๋ถ„์ด ์–ด..

LaTex ํ‘œ ๊ด€๋ จ ํŒ (ํ‘œ ์ž๋™ ์ƒ์„ฑ๊ธฐ, ํฐํŠธ ํฌ๊ธฐ ์กฐ์ •, ์…€ ๋„ˆ๋น„, ํ‘œ ๋‚ด๋ถ€ ์—ฌ๋ฐฑ, footnote ๋‹ฌ๊ธฐ)

ํ‘œ ์ž๋™ ์ƒ์„ฑ๊ธฐ Table generator https://www.tablesgenerator.com/# {\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}} \newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}} \newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}m{#1}} \begin{table} \begin{tabular}{L{2cm} | C{1cm} | R{2cm}} \hline a1 & a2 & a3 \\ \hline\hline b1 & b2 & b3 \\ \hli..

[PyTorch] model weight ๊ฐ’ ์กฐ์ •ํ•˜๊ธฐ / weight normalization

PyTorch model์˜ weight๊ฐ’์„ ๋ฐ”๋กœ ๋ฐ”๊พธ๋ ค๊ณ  ํ•˜๋ฉด FloatTensor์„ parameter๋กœ ์‚ฌ์šฉํ•  ์ˆ˜ ์—†๋‹ค๋Š” ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ•œ๋‹ค. import torch.nn as nn model = nn.Sequential(nn.Linear(10, 5), nn.ReLU(), nn.Linear(5, 4, bias=False)) model[2].weight = model[2].weight/2. >> cannot assign 'torch.FloatTensor' as parameter 'weight' (torch.nn.Parameter or None expected) ํ•™์Šต ๋„์ค‘ ์‚ฌ์šฉํ•˜๋Š” weight normalization์€ nn.utils.weight_norm์„ ์‚ฌ์šฉํ•˜๋ฉด ๋˜๋Š” ๊ฒƒ ๊ฐ™์ง€๋งŒ, ๋ฐ”๋กœ weight ๊ฐ’์— ..

[PyTorch Implementation] CBAM: Convolutional Block Attention Module ์„ค๋ช… + ์ฝ”๋“œ

CBAM: Convolutional Block Attention Module์€ ECCV 2018์—์„œ ๋ฐœํ‘œ๋œ channel&spatial attention module์ด๋‹ค. ์ฝ”๋“œ๋Š” ๊ณต์‹ github์„ ์ฐธ๊ณ ํ•˜์—ฌ ์กฐ๊ธˆ ์ˆ˜์ •ํ–ˆ๋‹ค. Paper: https://arxiv.org/pdf/1807.06521.pdf Code: https://github.com/Jongchan/attention-module/ Author's blog: https://blog.lunit.io/2018/08/30/bam-and-cbam-self-attention-modules-for-cnn/ BAM CBAM์€ BAM: Bottleneck Attention Module์˜ ํ›„์† ๋…ผ๋ฌธ์ด๋‹ค. BAM์€ ๋ชจ๋ธ์˜ bottleneck ๋ถ€๋ถ„์—์„œ attent..

[๋”ฅ๋Ÿฌ๋‹ ๋…ผ๋ฌธ๋ฆฌ๋ทฐ] CSI: Novelty Detection via Contrastive Learning on Distributionally Shifted Instances (NeurIPS 2020)

NeurIPS 2020์—์„œ ๋ฐœํ‘œ๋œ CSI: Novelty Detection via Contrastive Learning on Distributionally Shifted Instances ๋ผ๋Š” ๋…ผ๋ฌธ์ด๋‹ค. Out-of-distribution detection์— SimCLR์„ ํ† ๋Œ€๋กœ ํ•œ contrastive learning์„ ์ ์šฉํ•˜์˜€๋‹ค. ๋…ผ๋ฌธ: https://arxiv.org/pdf/2007.08176.pdf ์ฝ”๋“œ: https://github.com/alinlab/CSI Abstract Novelty detection์ด๋ผ๊ณ ๋„ ๋ถ€๋ฅด๋Š” Out-of-distribution (OOD) detection์€, ์ฃผ์–ด์ง„ sample์ด training distribution ๋‚ด๋ถ€์˜ ๊ฒƒ์ธ์ง€ (in-distribution), ..

XGBoost GPU ๋กœ ๊ฐ€์†ํ•˜๊ธฐ

์ถœ์ฒ˜: https://xgboost.readthedocs.io/en/stable/gpu/index.html XGBoost GPU Support — xgboost 1.5.2 documentation XGBoost GPU Support This page contains information about GPU algorithms supported in XGBoost. Note CUDA 10.0, Compute Capability 3.5 required The GPU algorithms in XGBoost require a graphics card with compute capability 3.5 or higher, with CUDA toolkits 10 xgboost.readthedocs.io CUDA 10...

๋ฐ˜์‘ํ˜•