1. 데이터

  • 일반적으로 train dataset에만 샘플링 전략(over sampling, undersampling)을 사용합니다. 따라서 train/test split하기 전에 sampling을 하지 않고 split한 뒤에 train dataset에 샘플링을 적용합니다.

2. hugging face

  • 사전 훈련된 모델을 사용할 때, 모델 훈련에 사용한 것과 동일한 토크나이저를 사용해야 합니다. 토크나이저를 바꾸는 것은 모델 입장에서 어휘사전을 뒤섞는 것과 다름 없습니다. 주변 사람들이 'house'를 'cat'이라 하는 상황처럼 마음대로 단어를 바꾼다면 도대체 무슨 일인지 상황을 이해하지 못할 것입니다.
728x90

'프로젝트 setup' 카테고리의 다른 글

[Hugging Face 🤗] Load Datasets  (0) 2024.06.15
zsh 및 oh-my-zsh 설치(vscode)  (1) 2024.01.24
requirement.txt 설치  (2) 2024.01.03

1. Hugging Face Hub 내 데이터셋 확인

Hugging Face에서 현재 제공하는 데이터셋의 개수와 정보를 불러옵니다.

from datasets import list_datasets

all_datasets = list_datasets()
print(f'현재 허브에는 {len(all_datasets)}개의 데이터셋이 있습니다.')
print(f'처음 10개 데이터셋: {all_datasets[:10]}')

 

2. Hugging Face Hub 내 데이터셋 불러오기

특정 데이터셋을 불러오고 싶으면 다음과 같이 작성하면 됩니다.

from datasets import load_dataset

# load_dataset('파일 path')
ag_news = load_dataset('fancyzhx/ag_news')

 

다음과 같은 파라미터가 있습니다.

https://huggingface.co/docs/datasets/package_reference/loading_methods#datasets.load_dataset

 

3. 내 컴퓨터에 있는 데이터셋 불러오기

from datasets import load_dataset

# 파일명 = load_dataset('file format', data_files='file path')
csv_file = load_dataset('csv', data_files='my_files.csv')
text_file = load_dataset('text', data_files='text_files.text')
json_file = load_dataset('json', data_files='my_files.json')

# sep, column명 지정
csv_file = load_dataset('csv', data_files='my_files.csv', sep=';', names=['userid', 'age', 'label'])

 

References

1. https://huggingface.co/docs/datasets/package_reference/loading_methods#datasets.load_dataset
2. 루이스 턴스톨 외, 트랜스포머를 활용한 자연어 처리⌟, 2022

728x90

'프로젝트 setup' 카테고리의 다른 글

Tips  (0) 2024.06.15
zsh 및 oh-my-zsh 설치(vscode)  (1) 2024.01.24
requirement.txt 설치  (2) 2024.01.03

 

1. zsh 설치

apt-get install zsh

 

zsh 버전 확인

zsh --version

 

2. oh-my-zsh 설치

curl이나 wget을 이용해서 설치할 수 있다.

# curl
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

# wget
sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"

 

"curl: command not found" 오류가 떴다면 curl이 설치가 안된 상태이므로 아래 코드를 실행해준다.

apt-get install curl

 

다음과 같은 질문이 나오면 Y을 입력한다.

다음과 같은 화면이 뜨면 성공적으로 설치한 것이다

터미널을 끈다.

 

3. Default Shell 설정

지금까지 한 것만으로 default shell이 zsh가 안되서 추가 조치를 취했다.

 

  • Ctrl + Shift + p

Terminal: Select Defalut Profile에 입력해서 클릭 후, zsh을 클릭해준다.

(zsh (2)은 왜 있는지 모르겠다...)


References

https://github.com/ohmyzsh/ohmyzsh/wiki/Installing-ZSH

 

Installing ZSH

🙃 A delightful community-driven (with 2,200+ contributors) framework for managing your zsh configuration. Includes 300+ optional plugins (rails, git, macOS, hub, docker, homebrew, node, php, pyth...

github.com

https://log4cat.tistory.com/7

 

Ubuntu에 Oh My Zsh 설치

# zsh-syntax-highlighting git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting # zsh-autosuggestions git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~

log4cat.tistory.com

https://stackoverflow.com/questions/64001669/zsh-and-vscode-default-shells

 

ZSH And VSCode - Default Shells

I've started setting up ZSH for VSCode. It worked for a small bit, but then it changed to Git Bash (my previous default shell). I tried changing the shell back to ZSH, but it didn't display in the ...

stackoverflow.com

 

728x90

'프로젝트 setup' 카테고리의 다른 글

Tips  (0) 2024.06.15
[Hugging Face 🤗] Load Datasets  (0) 2024.06.15
requirement.txt 설치  (2) 2024.01.03

1. 터미널 열기

vscode: Ctrl + `

2. 코드 입력

pip install -r requirements.txt

 

728x90

'프로젝트 setup' 카테고리의 다른 글

Tips  (0) 2024.06.15
[Hugging Face 🤗] Load Datasets  (0) 2024.06.15
zsh 및 oh-my-zsh 설치(vscode)  (1) 2024.01.24

+ Recent posts