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

Pytorch Finetuning #6

Merged
merged 2 commits into from
May 21, 2019
Merged

Pytorch Finetuning #6

merged 2 commits into from
May 21, 2019

Conversation

jjbrophy47
Copy link

Hi, I really like this repository and how easy it use to use as a PyTorch alternative for GPT2. In this pull request, I've added the ability to fine-tune a pre-trained gpt2 model in PyTorch. I've adapted training code from nshepperd: https://github.com/nshepperd/gpt-2/blob/finetuning/train.py

I hope you find this useful! Let me know if you have any questions or concerns!
-Jonathan Brophy

@graykode
Copy link
Owner

Hello. First, Thank you for your sincere pull request!
I will read your code in line by line as much as possible. 👍

@graykode
Copy link
Owner

I read your code quickly and I have some questions.
I left code review comment on line corresponding to the question.

train.py Outdated
def load_model(model, state_dict, device):
model = load_weight(model, state_dict)
model.to(device)
model.eval()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jjbrophy47 Why did you try model.eval()?
Didn't you mean fine tuning?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooops! That line is a mistake and should be deleted, thanks.

GPT2/data.py Outdated
else:

# Plain text
with open(path, 'r') as fp:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 43: ordinal not in range(128)

UnicodeDecodeError is occured in here. I think open with utf-8 is right.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I think that would be better, thanks.

@graykode
Copy link
Owner

branch name archive is branch to record before commits, so could you repull request to train branch? Thank you again.

@jjbrophy47 jjbrophy47 changed the base branch from archive to train May 20, 2019 19:50
@graykode graykode merged commit c26dec7 into graykode:train May 21, 2019
@graykode
Copy link
Owner

Thanks! I will also reflect the modifications to the master branch.

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

Successfully merging this pull request may close these issues.

2 participants