AnglE icon indicating copy to clipboard operation
AnglE copied to clipboard

Code embeddings

Open rragundez opened this issue 1 year ago • 7 comments

Is there any information if this is also recommended for extracting embeddings from code snippets? In particular Javascipt and Solidity?

rragundez avatar Jun 27 '24 00:06 rragundez

Hi @rragundez , Maybe you can have a try to WhereIsAI/UAE-Code-Large-V1. It was trained using the github-issue-similarity dataset, which contains some javascript code.

angle = AnglE.from_pretrained('WhereIsAI/UAE-Code-Large-V1').cuda()

angle.encode("YOUR CODE")

SeanLee97 avatar Jun 27 '24 02:06 SeanLee97

Let me try it and I'll comment back here the results

rragundez avatar Jun 27 '24 03:06 rragundez

It did work but results over solidity code is not very good. thanks.

I am going to try with LLM trained on SOlidity code, but it has GGUF files, how would I use those in this library? for example:

https://huggingface.co/mradermacher/Solidity-Llama3-8b-GGUF

rragundez avatar Jul 02 '24 00:07 rragundez

maybe you can use its base model: https://huggingface.co/andrijdavid/Solidity-Llama3-8b

SeanLee97 avatar Jul 02 '24 02:07 SeanLee97

Would this work out of the box just putting the model name as the argument?

rragundez avatar Jul 02 '24 03:07 rragundez

Yes. For LLM inference, you can check it document: https://angle.readthedocs.io/en/latest/notes/quickstart.html#infer-llm-based-models

Since this model hasn't been trained on sentence embedding learning, it is recommended to use some prompts to improve performance. You can specify a prompt with angle.encode(..., prompt="Here is a prompt: {text}.").

SeanLee97 avatar Jul 02 '24 03:07 SeanLee97

Yes. For LLM inference, you can check it document: https://angle.readthedocs.io/en/latest/notes/quickstart.html#infer-llm-based-models

Since this model hasn't been trained on sentence embedding learning, it is recommended to use some prompts to improve performance. You can specify a prompt with angle.encode(..., prompt="Here is a prompt: {text}.").

there is no need to specify a pretrained_lora_path, just directly specify the model_name_or_path to andrijdavid/Solidity-Llama3-8b

SeanLee97 avatar Jul 02 '24 03:07 SeanLee97