ggml icon indicating copy to clipboard operation
ggml copied to clipboard

[Feature Request] Salesforce Codegen model

Open siilats opened this issue 2 years ago • 5 comments
trafficstars

Hi, could you give us a hint on how to convert the Salesforce codegen model to ggml? The models are here https://github.com/salesforce/CodeGen and they allow Github copilot style code complete locally. Thank you!

siilats avatar Dec 08 '22 06:12 siilats

Can you point me to the python implementation of the models?

ggerganov avatar Dec 08 '22 07:12 ggerganov

The python implementation should be here: https://github.com/salesforce/CodeGen/blob/main/jaxformer/hf/codegen/modeling_codegen.py

Could you explain how to convert these models first to ggml and then to cpp.

(P.S.: @ggerganov I contacted you also on twitter)

prof-schacht avatar Mar 26 '23 08:03 prof-schacht

I have fast CPP implementations of Codegen (at int4 quantization) at https://github.com/NolanoOrg/cformers/

from interface import AutoInference as AI
ai = AI('Salesforce/codegen-6B-mono')
x = ai.generate('def return1():, num_tokens_to_generate=50)
# print(x['token_str'])

It has same backend as codegen. Let me know if you need any help with it.

Ayushk4 avatar Mar 26 '23 15:03 Ayushk4

Great I will try it out. Thanks for your hint.

prof-schacht avatar Mar 26 '23 15:03 prof-schacht

Working code from @ravenscroftj can be found here: https://github.com/ravenscroftj/ggml/tree/d130cc0c799621637c7914d6b89bf99e4403bd3a/examples/codegen I have written a more detailed tutorial about it to do conversion and quantization on Apple Silicon M1/M2 CPU: https://github.com/virtualramblas/codegen-quantization-M1 and shared some of the ported to ggml and quantized mono models through the Hugging Face Hub: https://huggingface.co/Guglielmo/CodeGen-350M-mono-ggml-quant https://huggingface.co/Guglielmo/CodeGen-2B-mono-ggml-quant https://huggingface.co/Guglielmo/CodeGen-6B-mono-ggml-quant

virtualramblas avatar Apr 20 '23 12:04 virtualramblas