Model reference · open weights
unixcoder is an open-weight embedding model from microsoft, listed in the AxForge catalogue. AxForge can bring it up on EU-owned hardware for you on request — with the licence handled where one is required.
About
Model Card for UniXcoder-base Model Details Model Description UniXcoder is a unified cross-modal pre-trained model that leverages multimodal data (i.e. code comment and AST) to pretrain code representation. - Developed by: Microsoft Team - Shared by [Optional]: Hugging Face - Model type: Feature Engineering - Language(s) (NLP): en - License: Apache-2.0 - Related Models: - Parent Model: RoBERTa - Resources for more information: - Associated Paper Uses 1. Dependency - pip install torch - pip install transformers 2. Quick Tour We implement a class to use UniXcoder and you can follow the code to build UniXcoder. You can download the class by In the following, we will give zero-shot examples for several tasks under different mode, including code search (encoder-only), code completion (decoder-only), function name prediction (encoder-decoder) , API recommendation (encoder-decoder), code summarization (encoder-decoder). 3. Encoder-only Mode For encoder-only mode, we give an example of code search. 1) Code and NL Embeddings Here, we give an example to obtain code fragment embedding from CodeBERT. 2) Similarity between code and NL Now, we calculate cosine similarity between NL and two functions. Although the difference of two functions is only a operator (< and ), UniXcoder can distinguish them. 3. Decoder-only Mode For decoder-only mode, we give an example of code completion. 4. Encoder-Decoder Mode For encoder-decoder mode, we give two examples including: function name prediction, API recommendation, code summarization. 1) Function Name Prediction 2) API Recommendation 3) Code Summarization Reference If you use this code or UniXcoder, please consider citing us. title={UniXcoder: Unified Cross-Modal Pre-training for Code Representation}, author={Guo, Daya and Lu, Shuai and Duan, Nan and Wang, Yanlin and Zhou, Ming and Yin, Jian}, journal={arXiv preprint arXiv:2203.03850}, year={2022} }</code</pre
Summarised from the published model card. Read the full card on the HuggingFace links below.
Specifications
| Maker | microsoft |
|---|---|
| Type | Embedding models |
| Variants | 1 |
| Runs with | transformers |
| Released | 2022-03-23 |
| Popularity | 214k downloads / month |
| Likes | 69 |
| Licence | Open weights |
How it works
Variants
Open weights ship in several sizes and precisions. One page, all the variants — pick the one that fits your GPU. VRAM figures are estimates from model size.
| Variant | Params | Precision | VRAM | Fits 16 GB | Weights |
|---|---|---|---|---|---|
| unixcoder-base | — | BF16 | — | — | Weights ↗ |
Using it via the API
Once AxForge deploys unixcoder for you, it answers on the OpenAI-compatible API — the same base URL and keys as every other model. (unixcoder below is illustrative; you get the exact model name on deployment.)
$ curl -sS https://api.axforge.ai/v1/embeddings \
-H "Authorization: Bearer $AXFORGE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"unixcoder","input":"text to embed"}'
Licence
Open weights under apache-2.0 — commercial use is permitted. Deploy it on AxForge EU hardware on request. Read the licence ↗
Explore