Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prop:Help How create interactive environment for simple try/test #46

Open
remotejob opened this issue Jul 23, 2020 · 1 comment
Open

Comments

@remotejob
Copy link

After python demo.py was created dir models/output_model/GPT2.1e-05.64.0gpu.2020-07-19022953/GP2-pretrain-step-10000.pkl

Question: How create simple interactive program to use GP2-pretrain-step-10000.pk.

Something like on:

https://huggingface.co/microsoft/DialoGPT-small

`from transformers import AutoModelWithLMHead, AutoTokenizer
import torch

tokenizer = AutoTokenizer.from_pretrained("microsoft/DialoGPT-small")
model = AutoModelWithLMHead.from_pretrained("microsoft/DialoGPT-small")
for step in range(5):
new_user_input_ids = tokenizer.encode(input(">> User:") + tokenizer.eos_token, return_tensors='pt')
bot_input_ids = torch.cat([chat_history_ids, new_user_input_ids], dim=-1) if step > 0 else new_user_input_ids
chat_history_ids = model.generate(bot_input_ids, max_length=1000, pad_token_id=tokenizer.eos_token_id)
print("DialoGPT: {}".format(tokenizer.decode(chat_history_ids[:, bot_input_ids.shape[-1]:][0], skip_special_tokens=True)))`

@pranavpawar3
Copy link

@remotejob Hi, I am curious about the same thing. Did you find any help on this yet?

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants