Text Generation
Transformers
Safetensors
iquestpltcoder
code
code-generation
code-reasoning
agentic-coding
tool-use
instruction-tuned
looped-transformer
parallel-loop-transformer
plt
conversational
custom_code
Instructions to use Multilingual-Multimodal-NLP/LoopCoder-V2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Multilingual-Multimodal-NLP/LoopCoder-V2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Multilingual-Multimodal-NLP/LoopCoder-V2", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("Multilingual-Multimodal-NLP/LoopCoder-V2", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Multilingual-Multimodal-NLP/LoopCoder-V2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Multilingual-Multimodal-NLP/LoopCoder-V2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Multilingual-Multimodal-NLP/LoopCoder-V2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Multilingual-Multimodal-NLP/LoopCoder-V2
- SGLang
How to use Multilingual-Multimodal-NLP/LoopCoder-V2 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 "Multilingual-Multimodal-NLP/LoopCoder-V2" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Multilingual-Multimodal-NLP/LoopCoder-V2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "Multilingual-Multimodal-NLP/LoopCoder-V2" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Multilingual-Multimodal-NLP/LoopCoder-V2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Multilingual-Multimodal-NLP/LoopCoder-V2 with Docker Model Runner:
docker model run hf.co/Multilingual-Multimodal-NLP/LoopCoder-V2
Update README.md
Browse files
README.md
CHANGED
|
@@ -76,42 +76,6 @@ vllm serve $MODEL --port 8080 \
|
|
| 76 |
--cudagraph-capture-sizes 1 2 4 8 12 16 24 32
|
| 77 |
```
|
| 78 |
|
| 79 |
-
```python
|
| 80 |
-
import torch
|
| 81 |
-
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 82 |
-
|
| 83 |
-
repo_id = "Multilingual-Multimodal-NLP/LoopCoder-V2"
|
| 84 |
-
|
| 85 |
-
tokenizer = AutoTokenizer.from_pretrained(repo_id, trust_remote_code=True)
|
| 86 |
-
model = AutoModelForCausalLM.from_pretrained(
|
| 87 |
-
repo_id,
|
| 88 |
-
torch_dtype=torch.bfloat16,
|
| 89 |
-
device_map="auto",
|
| 90 |
-
trust_remote_code=True,
|
| 91 |
-
)
|
| 92 |
-
|
| 93 |
-
messages = [
|
| 94 |
-
{"role": "user", "content": "Write a Python function that checks whether a string is a palindrome."}
|
| 95 |
-
]
|
| 96 |
-
|
| 97 |
-
inputs = tokenizer.apply_chat_template(
|
| 98 |
-
messages,
|
| 99 |
-
add_generation_prompt=True,
|
| 100 |
-
tokenize=True,
|
| 101 |
-
return_tensors="pt",
|
| 102 |
-
).to(model.device)
|
| 103 |
-
|
| 104 |
-
outputs = model.generate(
|
| 105 |
-
inputs,
|
| 106 |
-
max_new_tokens=512,
|
| 107 |
-
do_sample=True,
|
| 108 |
-
temperature=0.6,
|
| 109 |
-
top_p=0.95,
|
| 110 |
-
top_k=20,
|
| 111 |
-
)
|
| 112 |
-
|
| 113 |
-
print(tokenizer.decode(outputs[0][inputs.shape[-1]:], skip_special_tokens=True))
|
| 114 |
-
```
|
| 115 |
|
| 116 |
## Training Data
|
| 117 |
|
|
|
|
| 76 |
--cudagraph-capture-sizes 1 2 4 8 12 16 24 32
|
| 77 |
```
|
| 78 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
|
| 80 |
## Training Data
|
| 81 |
|