Instructions to use elsagranger/VirtualCompiler with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use elsagranger/VirtualCompiler with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="elsagranger/VirtualCompiler")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("elsagranger/VirtualCompiler") model = AutoModelForCausalLM.from_pretrained("elsagranger/VirtualCompiler") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use elsagranger/VirtualCompiler with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "elsagranger/VirtualCompiler" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "elsagranger/VirtualCompiler", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/elsagranger/VirtualCompiler
- SGLang
How to use elsagranger/VirtualCompiler with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "elsagranger/VirtualCompiler" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "elsagranger/VirtualCompiler", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "elsagranger/VirtualCompiler" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "elsagranger/VirtualCompiler", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use elsagranger/VirtualCompiler with Docker Model Runner:
docker model run hf.co/elsagranger/VirtualCompiler
Update README.md
Browse files
README.md
CHANGED
|
@@ -81,12 +81,19 @@ def calc_map_at_k(logits, pos_cnt, ks=[10,]):
|
|
| 81 |
pos_asm_cnt = 1
|
| 82 |
|
| 83 |
query = ["List all files in a directory"]
|
| 84 |
-
|
| 85 |
-
|
|
|
|
|
|
|
| 86 |
|
| 87 |
query_embs = text_encoder(**text_tokenizer(query))
|
| 88 |
-
|
| 89 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
|
| 91 |
# query_embs: [query_cnt, emb_dim]
|
| 92 |
# asm_embs: [pos_asm_cnt, emb_dim]
|
|
|
|
| 81 |
pos_asm_cnt = 1
|
| 82 |
|
| 83 |
query = ["List all files in a directory"]
|
| 84 |
+
|
| 85 |
+
# Extracted by the process_asm.py script mentioned above
|
| 86 |
+
anchor_asm = [ {"1": "endbr64", "2": "mov eax, 0" }, ... ]
|
| 87 |
+
neg_anchor_asm = [ {"1": "push rbp", "2": "mov rbp, rsp", ... }, ... ]
|
| 88 |
|
| 89 |
query_embs = text_encoder(**text_tokenizer(query))
|
| 90 |
+
|
| 91 |
+
kwargs = dict(padding=True, pad_to_multiple_of=8, return_tensors="pt")
|
| 92 |
+
anchor_asm_ids = asm_tokenizer.pad([asm_tokenizer(pos) for pos in anchor_asm], **kwargs)
|
| 93 |
+
neg_anchor_asm_ids = asm_tokenizer.pad([asm_tokenizer(neg) for neg in neg_anchor_asm], **kwargs)
|
| 94 |
+
|
| 95 |
+
asm_embs = asm_encoder(**anchor_asm_ids)
|
| 96 |
+
asm_neg_emb = asm_encoder(**neg_anchor_asm_ids)
|
| 97 |
|
| 98 |
# query_embs: [query_cnt, emb_dim]
|
| 99 |
# asm_embs: [pos_asm_cnt, emb_dim]
|