Comments (1)
안녕하세요 @kimtaehyuk1 님, 답이 너무 늦었습니다.
다음과 같이 수행하면 배치 인퍼런스를 수행할 수 있습니다.
from transformers import GPT2LMHeadModel
model = GPT2LMHeadModel.from_pretrained(
"skt/kogpt2-base-v2",
)
model.eval()
from transformers import PreTrainedTokenizerFast
tokenizer = PreTrainedTokenizerFast.from_pretrained(
"skt/kogpt2-base-v2",
eos_token="</s>",
)
inputs = tokenizer(["안녕하세요", "반갑습니다"], return_tensors="pt") # 이 부분에 배치로 인퍼런스할 문장을 리스트로 입력
generated_ids = model.generate(
inputs['input_ids'],
do_sample=True,
min_length=10,
max_length=50,
repetition_penalty=1.5,
no_repeat_ngram_size=3,
temperature=0.9,
top_k=50,
top_p=0.92,
)
for instance in generated_ids:
print(tokenizer.decode([el.item() for el in instance]) + "\n\n")
위의 수행 결과 예시는 다음과 같습니다.
안녕하세요"라고 말한 뒤 "제가 뭘 할 수 있겠나. 그건 제가 판단할 일이고 우리가 잘 안다"고 말했다.
그러자 박지원 민주당 원내대표는 지난 13일 자신의 페이스북에 올린 글에서 "이런 식으로 가면 이 나라의 미래가
반갑습니다 ᄏ
#오늘의하루<unk></d> 어제 점심 먹으러 나가서
맛있고 다양한 스시 먹을 수 있는 맛집을 찾았어요!
점심은 주로 근처와 가까운 곳에서 먹는것을 추천해용...
from nlpbook.
Related Issues (20)
- Inference - ratsgo's NLPBOOK
- ↗️ Customization - ratsgo's NLPBOOK
- 4-3 마지막 웹서비스 개시에서 실행이 되지 않습니다 HOT 3
- Inference (1) - ratsgo's NLPBOOK
- Deep NLP - ratsgo's NLPBOOK
- 6장 단어에 꼬리표 달기에 대해서 질문 있습니다.
- 1장 kcbert 관련 오류 문의드립니다.
- Environment - ratsgo's NLPBOOK
- Training Pipeline - ratsgo's NLPBOOK
- 4-3 웹서비스 시작하기 HOT 2
- 5-3 학습 마친 모델 실전 투입에서 웹서비스 실행시 ERR_NGROK_6022 이 뜨네요.ㅠ.ㅠ HOT 2
- ratsnlp 라이브러리를 설치하지 않고 일반적인 패키지를 설치하는 방법은 없을까요? HOT 1
- Home - ratsgo's NLPBOOK
- Named Entity Recognition - ratsgo's NLPBOOK
- removal request
- P150 웹 서비스 시작하기가 (기존 해결책대로 했는데도) 에러가 납니다.
- 커스텀 데이터_분류_레이블별 성능체크 방법
- Vocab Tutorial - ratsgo's NLPBOOK
- 4장 5단계 웹서비스 시작하기 관련 질문 HOT 1
- 60페이지 내용 수정
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nlpbook.