ggml icon indicating copy to clipboard operation
ggml copied to clipboard

[Feature Request] rinna's Japanese GPT model support

Open katsu560 opened this issue 1 year ago • 2 comments

Thanks @ggerganov for your sharing.

I want to use GPT on my local pc. rinna Co.,Ltd is Japanese AI company. rinna provides some GPT models on huggingface. https://huggingface.co/rinna/japanese-gpt-1b https://huggingface.co/rinna/japanese-gpt2-xsmall https://huggingface.co/rinna/japanese-gpt2-small https://huggingface.co/rinna/japanese-gpt2-medium I'd like to use these models with ggml gpt. But, I can't convert these models for ggml. I think these models are pytorch bin model and tensorflow H5 weight.

Could you convert and support these models ?

katsu560 avatar Mar 04 '23 22:03 katsu560

You can use examples/gpt-2/convert-h5-to-ggml.py to convert these models:

PR #35

ocordeiro avatar Mar 28 '23 23:03 ocordeiro

Thank you for your comment, ocordeiro. I sync-ed to new master branch code and then did gpt-2/convert-h5-to-ggml.py. But, unfortunately, rinna's gpt-2 model has no vocab.json and added_tokens.json. So, the conversion was failed.

Traceback (most recent call last):
  File "../examples/gpt-2/convert-h5-to-ggml.py", line 58, in <module>
    with open(dir_model + "/vocab.json", "r") as f:
FileNotFoundError: [Errno 2] No such file or directory: '/mnt/g/gpt/rinna-gpt-2/medium//vocab.json'
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
    from apport.fileutils import likely_packaged, get_recent_crashes
  File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
    from apport.report import Report
  File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
    import apport.fileutils
  File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
    from apport.packaging_impl import impl as packaging
  File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 24, in <module>
    import apt
  File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
    import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'

Original exception was:
Traceback (most recent call last):
  File "../examples/gpt-2/convert-h5-to-ggml.py", line 58, in <module>
    with open(dir_model + "/vocab.json", "r") as f:
FileNotFoundError: [Errno 2] No such file or directory: '/mnt/g/gpt/rinna-gpt-2/medium//vocab.json'

I'm sorry for no understanding the model file's detail. rinna's x-small model's files as follows.

-rwxrwxrwx 1 user user       845 Feb 19 00:13 config.json
-rwxrwxrwx 1 user user       737 Feb 19 00:14 gitattributes.txt
-rwxrwxrwx 1 user user 155916167 Feb 19 00:14 pytorch_model.bin
-rwxrwxrwx 1 user user     60349 Feb 19 00:13 rinna.png
-rwxrwxrwx 1 user user       153 Feb 19 00:13 special_tokens_map.json
-rwxrwxrwx 1 user user    805634 Feb 19 00:13 spiece.model
-rwxrwxrwx 1 user user 149686584 Feb 19 00:13 tf_model.h5
-rwxrwxrwx 1 user user       282 Feb 19 00:13 tokenizer_config.json

katsu560 avatar Apr 06 '23 19:04 katsu560