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

TypeError - Read only flag not supported - converttopytorch.py #5

Open
gbrackenridge opened this issue Mar 28, 2023 · 1 comment
Open

Comments

@gbrackenridge
Copy link

I am struggling to get converttotorch.py running properly. I keep throwing a TypeError as show below. Looks like there was some noise in git over in the numpy code repo. Any ideas? Thanks in advance!


loading shards for part 0
read from checkpoint
< (8, 4096) to (4096,)

transformer.wte.bias torch.Size([4096])
< (8, 6300, 4096) to (1, 50400, 4096)
transformer.wte.weight torch.Size([4096, 50400])
< (8, 4096, 512) to (1, 4096, 4096)
Traceback (most recent call last):
File "/data/models/model38/gpt-j-6B/converttotorch.py", line 147, in
params = torch.tensor(params.copy()).half()
TypeError: the read only flag is not supported, should always be False

@NatLee
Copy link

NatLee commented Jul 16, 2023

Replace the line with this and it'll be fixed.

Before:

params = torch.tensor(params.copy()).half()

After:

params = torch.from_numpy(np.array(params)).half()

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