gpt 2 Pytorch
1.0.0
더 나은 언어 모델과 그 의미
GPT-2 (GPT의 후임자)라고 불리는 우리의 모델은 40GB의 인터넷 텍스트에서 다음 단어를 예측하도록 훈련을 받았습니다. 기술의 악의적 인 응용에 대한 우려로 인해 우리는 훈련 된 모델을 공개하지 않습니다. 책임있는 공개 실험으로, 우리는 대신 연구자들이 실험 할 수있는 훨씬 작은 모델과 기술 논문을 출시하고 있습니다. OpenAi 블로그에서
이 저장소는 압축 코드를 사용하여 Pytorch 의 텍스트 생성기에 대한 간단한 구현 GPT-2입니다.
원래 레퍼토리는 OpenAI/Gpt-2입니다. 또한 "언어 모델은 감독되지 않은 멀티 태스킹 학습자"에 대한 논문을 읽을 수 있습니다. 더 자세한 개념을 이해하려면 변압기 모델에 대한 논문을 권장합니다.
내가 언급 한 Pytorch에서 GPT-2의 우수한 구현 GPT-2, Huggingface/Pytorch-Prestrained-Bert, Huggingface Repository에서 더 자세한 구현을 볼 수 있습니다.
변압기 (자체 소수) 용지 :주의가 필요한 모든 것 (2017)
첫 번째 OpenAi-GPT 논문 : 생성 사전 훈련에 의한 언어 이해 향상 (2018)
GPT-2 및 종이에 대한 OpenAI 블로그를 참조하십시오
$ git clone https://github.com/graykode/gpt-2-Pytorch && cd gpt-2-Pytorch
# download huggingface's pytorch model
$ curl --output gpt2-pytorch_model.bin https://s3.amazonaws.com/models.huggingface.co/bert/gpt2-pytorch_model.bin
# setup requirements, if using mac os, then run additional setup as descibed below
$ pip install -r requirements.txt$ python main.py --text " It was a bright cold day in April, and the clocks were striking thirteen. Winston Smith, his chin nuzzled into his breast in an effort to escape the vile wind, slipped quickly through the glass doors of Victory Mansions, though not quickly enough to prevent a swirl of gritty dust from entering along with him. "--text : 처음으로 문장.--quiet : "======================="--nsamples : 다국적 기능을 사용할 때 배치에서 샘플링 된 샘플 수--unconditional : 사실, 무조건적인 세대.--batch_size : 배치 크기 수--length : 문장 길이 (<컨텍스트 수)--temperature : 분포의 열역학적 온도 (default 0.7)--top_k : 주어진 입력 텐서의 최상위 k 최대 요소를 주어진 차원을 따라 반환합니다. (default 40) 여기에서 temperature 및 top_k 에 대한 자세한 내용 옵션을 참조하십시오.
$ python3 -m venv venv
$ source venv/bin/activate
$ pip install torch tqdm
$ brew install libomp
$ export LC_ALL=en_US.UTF-8
$ export LANG=en_US.UTF-8
$ pip install -r requirements.txtJeff Wu (@wuthefwasthat), Thomas Wolf (@thomwolf)는 참조 코드를 허용합니다.