bert

(★ 40,047)

BERT를 위한 TensorFlow 코드 및 사전 훈련된 모델

파일 탐색기

  • .gitignore
  • __init__.py
  • CONTRIBUTING.md
  • create_pretraining_data.py
  • extract_features.py
  • LICENSE
  • modeling.py
  • modeling_test.py
  • multilingual.md
  • optimization.py
  • optimization_test.py
  • predicting_movie_reviews_with_bert_on_tf_hub.ipynb
  • README.md
  • requirements.txt
  • run_classifier.py
  • run_classifier_with_tfhub.py
  • run_pretraining.py
  • run_squad.py
  • sample_text.txt
  • tokenization.py
  • tokenization_test.py

# 설치 가이드

python
사전 준비물

설치 및 실행 절차

pip install -r requirements.txt

프로젝트 의존성 패키지를 설치합니다.

python create_pretraining_data.py

사전 학습용 데이터를 생성합니다.

python run_pretraining.py

BERT 모델을 사전 학습합니다.

python run_classifier.py

분류 모델을 파인튜닝하고 실행합니다.

핵심 명령어

pip install -r requirements.txt

requirements.txt에 명시된 파이썬 패키지 의존성을 설치합니다.

python run_classifier.py --task_name=SST-2 --do_train=true --do_eval=true --data_dir=$GLUE_DIR/SST-2 --vocab_file=$BERT_BASE_DIR/vocab.txt --bert_config_file=$BERT_BASE_DIR/bert_config.json --init_checkpoint=$BERT_BASE_DIR/bert_model.ckpt --max_seq_length=128 --train_batch_size=32 --learning_rate=2e-5 --num_train_epochs=3.0 --output_dir=/tmp/sst2_output

GLUE 등 분류 작업에 대해 BERT 모델을 파인튜닝하고 평가합니다.

python run_squad.py --vocab_file=$BERT_BASE_DIR/vocab.txt --bert_config_file=$BERT_BASE_DIR/bert_config.json --init_checkpoint=$BERT_BASE_DIR/bert_model.ckpt --do_train=true --train_file=$SQUAD_DIR/train-v1.1.json --do_predict=true --predict_file=$SQUAD_DIR/dev-v1.1.json --train_batch_size=12 --learning_rate=3e-5 --num_train_epochs=2.0 --max_seq_length=384 --doc_stride=128 --output_dir=/tmp/squad_output

SQuAD 1.1 또는 2.0 질의응답 데이터셋을 사용하여 모델을 학습하고 평가합니다.

python extract_features.py --input_file=sample_text.txt --output_file=output.jsonl --vocab_file=$BERT_BASE_DIR/vocab.txt --bert_config_file=$BERT_BASE_DIR/bert_config.json --init_checkpoint=$BERT_BASE_DIR/bert_model.ckpt --layers=-1,-2 --max_seq_length=128 --batch_size=8

사전 학습된 BERT 모델로부터 고차원 벡터(embeddings)를 추출합니다.

사전 학습된 BERT 모델 체크포인트와 데이터셋 경로를 환경에 맞게 준비해야 합니다.

# CDN으로 사용하기

jsDelivr

jsDelivr는 공개 GitHub 리포지토리를 별도 설정 없이 CDN으로 즉시 서빙합니다. 버전과 파일을 고르면 웹페이지에 바로 붙일 수 있는 링크와 예시 코드가 만들어집니다.

명령어 용어집

이 문서에서 사용된 명령어를 모아봤습니다. 낯선 명령어가 있다면 펼쳐서 확인해보세요.

🔍

john

설명 보기 ▼

비밀번호 크래커.
더 많은 정보: <https://www.openwall.com/john/>.

john {{path/to/hashes.txt}}

비밀번호 해시 크래킹:

john --show {{path/to/hashes.txt}}

크래킹된 비밀번호 표시:

john --show --users={{user_ids}} {{path/to/hashes1.txt path/to/hashes2.txt ...}}

여러 파일에서 사용자 식별자로 크래킹된 비밀번호 표시:

🔍

python

설명 보기 ▼

Python 언어 인터프리터.
더 많은 정보: <https://docs.python.org/using/cmdline.html>.

python

REPL(대화형 셸) 시작:

python {{path/to/file.py}}

특정 Python 파일 실행:

python -i {{path/to/file.py}}

특정 Python 파일 실행 후 REPL 시작:

// repository documentation