Feature Extraction
Transformers
Safetensors
sentence-transformers
English
Chinese
c2llm
code
custom_code
Run this model with HF Jobs
Run codefuse-ai/C2LLM-0.5B on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/codefuse-ai/C2LLM-0.5B. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/codefuse-ai/C2LLM-0.5B on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use codefuse-ai/C2LLM-0.5B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use codefuse-ai/C2LLM-0.5B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="codefuse-ai/C2LLM-0.5B", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("codefuse-ai/C2LLM-0.5B", trust_remote_code=True, device_map="auto") - sentence-transformers
How to use codefuse-ai/C2LLM-0.5B with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("codefuse-ai/C2LLM-0.5B", trust_remote_code=True) sentences = [ "The weather is lovely today.", "It's so sunny outside!", "He drove to the stadium." ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [3, 3] - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files6 unmodified lines7891011121314153 unmodified lines19202122232425102 unmodified lines1281291301311321336 unmodified linestags:- code---# IntroductionC2LLM: Advanced Code Embeddings for Deep Semantic Understanding**C2LLMs (Code Contrastive Large Language Model)** is a powerful new model for generating code embeddings, designed to capture the deep semantics of source code.3 unmodified lines- **Intelligent Pooling with PMA**: Instead of traditional `mean pooling` or `last token pooling`, C2LLM uses **PMA (Pooling by Multi-head Attention)**. This allows the model to dynamically focus on the most critical parts of the code, creating a more informative and robust embedding.- **Trained for Retrieval**: C2LLM was fine-tuned on a massive dataset of **3 million query-document pairs**, optimizing it for real-world code retrieval and semantic search tasks. Supporting Text2Code/Code2Code/Code2Text tasks.C2LLM is designed to be a go-to model for tasks like code search and Retrieval-Augmented Generation (RAG).# Model Details102 unmodified linesresults = mteb.evaluate(model, tasks=tasks, cache=cache, encode_kwargs={"batch_size": 16})```## Correspondence toJin Qin (qj431428@antgroup.com), Zihan Liao (liaozihan.lzh@antgroup.com), Ziyin Zhang (zhangziying.zzy@antgroup.com), Hang Yu (hyu.hugo@antgroup.com), Peng Di (dipeng.dp@antgroup.com)6 unmodified lines78910111213141516171819202122233 unmodified lines27282930313233102 unmodified lines1361371381391401411421431441451461471486 unmodified linestags:- code---<div align="center" style="display: flex; justify-content: center; align-items: center; gap: 20px;"><a href="https://github.com/codefuse-ai/CodeFuse-Embeddings/tree/main/" style="display: flex; align-items: center; text-decoration: none; color: inherit;"><img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" width="30" height="30" style="vertical-align: middle; margin-right: 8px;"><span style="font-size: 1.5em; font-weight: bold;">CodeFuse-Embeddings</span></a></div># Introduction## C2LLM: Advanced Code Embeddings for Deep Semantic Understanding**C2LLMs (Code Contrastive Large Language Model)** is a powerful new model for generating code embeddings, designed to capture the deep semantics of source code.3 unmodified lines- **Intelligent Pooling with PMA**: Instead of traditional `mean pooling` or `last token pooling`, C2LLM uses **PMA (Pooling by Multi-head Attention)**. This allows the model to dynamically focus on the most critical parts of the code, creating a more informative and robust embedding.- **Trained for Retrieval**: C2LLM was fine-tuned on a massive dataset of **3 million query-document pairs**, optimizing it for real-world code retrieval and semantic search tasks. Supporting Text2Code/Code2Code/Code2Text tasks.C2LLM is designed to be a go-to model for tasks like code search and Retrieval-Augmented Generation (RAG). For more details, please see our [GitHub repository](https://github.com/codefuse-ai/CodeFuse-Embeddings/tree/main).# Model Details102 unmodified linesresults = mteb.evaluate(model, tasks=tasks, cache=cache, encode_kwargs={"batch_size": 16})```## Support UsIf you find this project helpful, please give it a star. It means a lot to us](https://github.com/codefuse-ai/CodeFuse-Embeddings/tree/main)## Correspondence toJin Qin (qj431428@antgroup.com), Zihan Liao (liaozihan.lzh@antgroup.com), Ziyin Zhang (zhangziying.zzy@antgroup.com), Hang Yu (hyu.hugo@antgroup.com), Peng Di (dipeng.dp@antgroup.com)
README.md+17-2