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

support Chinese model ,please #1199

Closed
louis-gg opened this issue Jul 14, 2023 · 12 comments
Closed

support Chinese model ,please #1199

louis-gg opened this issue Jul 14, 2023 · 12 comments
Labels
enhancement New feature or request models

Comments

@louis-gg
Copy link

Feature request

Here is the Chinese model git:https://github.com/ymcui/Chinese-LLaMA-Alpaca.
Support it please!

Motivation

support Chinese model

Your contribution

no

@cosmic-snow
Copy link
Collaborator

cosmic-snow commented Jul 14, 2023

Is there a ggml version of that somewhere?

If not, you need to find someone to create that or try yourself. Then it should automatically be supported, as it's based on LLaMA.

P.S. With "automatically supported" I mean that the model type would be, not that it would automatically be in the download list. But you could download that version from somewhere and put it next to your other models.

@cosmic-snow cosmic-snow added enhancement New feature or request need-info Further information from issue author is requested models labels Jul 14, 2023
@louis-gg
Copy link
Author

Is there a ggml version of that somewhere?

If not, you need to find someone to create that or try yourself. Then it should automatically be supported, as it's based on LLaMA.

P.S. With "automatically supported" I mean that the model type would be, not that it would automatically be in the download list. But you could download that version from somewhere and put it next to your other models.

Thank you !
I download many Model on https://huggingface.co/models ,format is ggml,but warning not support.
link is:https://huggingface.co/models?language=zh&sort=trending&search=ggml

@cosmic-snow
Copy link
Collaborator

Thank you ! I download many Model on https://huggingface.co/models ,format is ggml,but warning not support. link is:https://huggingface.co/models?language=zh&sort=trending&search=ggml

I'm not sure if I understand you right.

Have you tried for example: https://huggingface.co/TheBloke/baichuan-llama-7B-GGML/tree/main? I recommend baichuan-llama-7b.ggmlv3.q5_K_M.bin or if you have a Mac M1/M2 baichuan-llama-7b.ggmlv3.q4_0.bin.

This is the right format. If you download it and put it next to the other models (the download directory), it should just work.

For https://github.com/ymcui/Chinese-LLaMA-Alpaca, it would need to be converted into a format like that.

@louis-gg
Copy link
Author

Thank you ! I download many Model on https://huggingface.co/models ,format is ggml,but warning not support. link is:https://huggingface.co/models?language=zh&sort=trending&search=ggml

I'm not sure if I understand you right.

Have you tried for example: https://huggingface.co/TheBloke/baichuan-llama-7B-GGML/tree/main? I recommend baichuan-llama-7b.ggmlv3.q5_K_M.bin or if you have a Mac M1/M2 baichuan-llama-7b.ggmlv3.q4_0.bin.

This is the right format. If you download it and put it next to the other models (the download directory), it should just work.

For https://github.com/ymcui/Chinese-LLaMA-Alpaca, it would need to be converted into a format like that.
thank you reply!
I already down the llama-7b.ggmlv3.q5_K_M.bin. My os is windows 11.
But I still get error:
image

I guess some bugs in chat .

@cosmic-snow
Copy link
Collaborator

cosmic-snow commented Jul 17, 2023

Not necessarily. What's your CPU and how much RAM do you have?

There's also a possibility the download didn't complete right, and maybe there is something wrong with that model.

I might have to download it myself to compare.

Edit: I've downloaded it, verified its checksum and tried to load it. I'm running into the same error as you. So I think there's something wrong with that model. I might have a closer look later.

@louis-gg
Copy link
Author

I might have a closer look later.

Thank you for your reply!
My System is :
image

Thank you for looking !
I test almost Chinese models in https://huggingface.co/models?language=zh&sort=trending&search=ggml , but same error.
I debug in the qt,found that:
image
When choose the impl,the impl is null!
So, I think it might choose model impl will cause some error.

@cosmic-snow
Copy link
Collaborator

cosmic-snow commented Jul 19, 2023

I've looked into it some more. The good news is that it is possible to get it to run by disabling a check. The bad news is: that check is there for a reason, it is used to tell LLaMA apart from Falcon.

If you are not going to use a Falcon model and since you are able to compile yourself, you can disable the check on your own system if you want. In gpt4all-backend/llamamodel.cpp comment out return false in the vocabulary size check:

llama_file_hparams hparams;
f.read(reinterpret_cast<char*>(&hparams), sizeof(hparams));
if (!(hparams.n_vocab >= 32000 && hparams.n_vocab <= 32100)) {
return false; // not a llama.
}


That is, you can change it to:

    llama_file_hparams hparams;
    f.read(reinterpret_cast<char*>(&hparams), sizeof(hparams));
    if (!(hparams.n_vocab >= 32000 && hparams.n_vocab <= 32100)) {
        //return false; // not a llama.
    }

It's not generally recommended to do that, however.

@louis-gg
Copy link
Author

I've looked into it some more. The good news is that it is possible to get it to run by disabling a check. The bad news is: that check is there for a reason, it is used to tell LLaMA apart from Falcon.

If you are not going to use a Falcon model and since you are able to compile yourself, you can disable the check on your own system if you want. In gpt4all-backend/llamamodel.cpp comment out return false in the vocabulary size check:

llama_file_hparams hparams;
f.read(reinterpret_cast<char*>(&hparams), sizeof(hparams));
if (!(hparams.n_vocab >= 32000 && hparams.n_vocab <= 32100)) {
return false; // not a llama.
}

That is, you can change it to:

    llama_file_hparams hparams;
    f.read(reinterpret_cast<char*>(&hparams), sizeof(hparams));
    if (!(hparams.n_vocab >= 32000 && hparams.n_vocab <= 32100)) {
        //return false; // not a llama.
    }

It's not generally recommended to do that, however.

Thank you ! I had to change it.
Work well!
Maybe new version will fix it?

@cosmic-snow
Copy link
Collaborator

Thank you ! I had to change it.
Work well!
Maybe new version will fix it?

Not sure.

As I said, the check is necessary to distinguish LLaMA from Falcon models, so it's kind of important. And this model is a bit special. Only remove the check if you are not going to use Falcon models.

@louis-gg
Copy link
Author

Thank you!

@cvcuiwei
Copy link

文章有帮助

@niansa niansa removed the need-info Further information from issue author is requested label Aug 17, 2023
@niansa
Copy link
Contributor

niansa commented Aug 18, 2023

Duplicate of #176

@niansa niansa marked this as a duplicate of #176 Aug 18, 2023
@niansa niansa closed this as not planned Won't fix, can't repro, duplicate, stale Aug 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request models
Projects
None yet
Development

No branches or pull requests

4 participants