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

Custom Finetuned Models? #32

Open
mallorbc opened this issue Mar 28, 2023 · 6 comments
Open

Custom Finetuned Models? #32

mallorbc opened this issue Mar 28, 2023 · 6 comments

Comments

@mallorbc
Copy link
Contributor

Looking at the code, it appears that when loading a model the code is loading preprocessed models that are uploaded to Huggingface and then checks that sha256 to make sure that it matches. It does not seem that the code currently allows loading a model from a path.

I have converted GPTJ myself into the GGML format(which I am almost certain this is built from, correct me if wrong).

I am interested in finetuning a model, converting the model to GGML, quantize to 4 bits, and then using the model through an API.

I believe that should this repo support custom fine-tuned models, it would be great for this use case.

@Ayushk4
Copy link
Member

Ayushk4 commented Mar 28, 2023

Hi,
You should be able to convert your custom GPTJ based models.

If you want to add new models, then follow these steps:

After these steps, you should be able to load the model via python.

@mallorbc
Copy link
Contributor Author

I do not want to upload the model to HuggingFace due to the nature of the models being private(although perhaps one can have private models on HuggingFace?).

However, if the method you stated would work, I believe that I could add support for loading models locally. I will likely explore adding this feature.

Thanks for your insight.

@Ayushk4
Copy link
Member

Ayushk4 commented Mar 28, 2023

Yes. If you don't want to upload, a hack would be to put the int4_fixed_zero at ~/.cformers/models/myUserName/myModel/int4_fixed_zero

Then you can do use it by:

from interface import AutoInference as AI
ai = AI('myUserName/myModel')
x = ai.generate('Some Prompt', num_tokens_to_generate=500)
print(x['token_str'])

For example myUserName/myModel can be EleutherAI/gpt-j-6B for the GPTJ model.

@sann3
Copy link

sann3 commented Apr 1, 2023

Is same work for hivemind/gpt-j-6B-8bit model ?

@Ayushk4
Copy link
Member

Ayushk4 commented Apr 1, 2023

You could load it at 4-bit. For now 8-bit isn't supported.

@mallorbc
Copy link
Contributor Author

mallorbc commented Apr 7, 2023

My PR #38 should close this issue. Will close when merged

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

3 participants