llama.cpp icon indicating copy to clipboard operation
llama.cpp copied to clipboard

Refactoring `convert-pth-to-ggml.py`: more concise and readable

Open qunash opened this issue 1 year ago • 1 comments

qunash avatar Mar 14 '23 00:03 qunash

Exactly what I was thinking, however I think a better approach regarding string concatenation for paths is using os.path.join instead simply to avoid typos either by the user or the programmer if the code changes in the future. Overall, LGTM.

SuajCarrot avatar Mar 16 '23 16:03 SuajCarrot

@SuajCarrot

I get this error:

python3 convert-pth-to-ggml.py models/7B/ 1
{'dim': 4096, 'multiple_of': 256, 'n_heads': 32, 'n_layers': 32, 'norm_eps': 1e-06, 'vocab_size': -1}
n_parts = 1

Processing part 0

Processing variable: tok_embeddings.weight with shape: torch.Size([32000, 4096]) and type: torch.float16

Traceback (most recent call last):
  File "/Users/ggerganov/development/github/llama.cpp/convert-pth-to-ggml.py", line 157, in <module>
    main()
  File "/Users/ggerganov/development/github/llama.cpp/convert-pth-to-ggml.py", line 151, in main
    process_and_write_variables(fout, model, ftype)
  File "/Users/ggerganov/development/github/llama.cpp/convert-pth-to-ggml.py", line 127, in process_and_write_variables
    data.tofile(fout)
AttributeError: 'Tensor' object has no attribute 'tofile'. Did you mean: 'tile'?

Any ideas?

Edit: fixed

ggerganov avatar Mar 19 '23 17:03 ggerganov