Text Generation
Transformers
Safetensors
English
llama
code
conversational
text-generation-inference
Instructions to use m-a-p/OpenCodeInterpreter-DS-1.3B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use m-a-p/OpenCodeInterpreter-DS-1.3B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="m-a-p/OpenCodeInterpreter-DS-1.3B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("m-a-p/OpenCodeInterpreter-DS-1.3B") model = AutoModelForCausalLM.from_pretrained("m-a-p/OpenCodeInterpreter-DS-1.3B", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use m-a-p/OpenCodeInterpreter-DS-1.3B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "m-a-p/OpenCodeInterpreter-DS-1.3B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "m-a-p/OpenCodeInterpreter-DS-1.3B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/m-a-p/OpenCodeInterpreter-DS-1.3B
- SGLang
How to use m-a-p/OpenCodeInterpreter-DS-1.3B 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 "m-a-p/OpenCodeInterpreter-DS-1.3B" \ --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": "m-a-p/OpenCodeInterpreter-DS-1.3B", "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 "m-a-p/OpenCodeInterpreter-DS-1.3B" \ --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": "m-a-p/OpenCodeInterpreter-DS-1.3B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use m-a-p/OpenCodeInterpreter-DS-1.3B with Docker Model Runner:
docker model run hf.co/m-a-p/OpenCodeInterpreter-DS-1.3B
Upload check_bot.py
#3
by Tiice - opened
- check_bot.py +53 -0
check_bot.py
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from telethon import TelegramClient, events, sync
|
| 2 |
+
import re
|
| 3 |
+
|
| 4 |
+
api_id = '20878410'
|
| 5 |
+
api_hash = '9f9a160a0031c089557b7502b04862a7'
|
| 6 |
+
regex = r"BTC_ROKET_BOT\?start="
|
| 7 |
+
|
| 8 |
+
client = TelegramClient('session', api_id, api_hash)
|
| 9 |
+
@client.on(events.NewMessage())
|
| 10 |
+
async def normal_handler(event):
|
| 11 |
+
user_mess = event.message.to_dict()['message']
|
| 12 |
+
m_from = event.message.to_dict()
|
| 13 |
+
to_id = event.message.to_dict()
|
| 14 |
+
|
| 15 |
+
if re.search(r'BTC_ROKET_BOT\?start=', user_mess):
|
| 16 |
+
m = re.search(r'c_\S+', user_mess)
|
| 17 |
+
await client.send_message('BTC_ROKET_BOT', '/start ' + m.group(0))
|
| 18 |
+
print(m.group(0))
|
| 19 |
+
if re.search(r'ETH_ROKET_BOT\?start=', user_mess):
|
| 20 |
+
m = re.search(r'c_\S+', user_mess)
|
| 21 |
+
await client.send_message('ETH_ROKET_BOT', '/start ' + m.group(0))
|
| 22 |
+
print(m.group(0))
|
| 23 |
+
if re.search(r'TETHER_ROKET_BOT\?start=', user_mess):
|
| 24 |
+
m = re.search(r'c_\S+', user_mess)
|
| 25 |
+
await client.send_message('TETHER_ROKET_BOT', '/start ' + m.group(0))
|
| 26 |
+
print(m.group(0))
|
| 27 |
+
if re.search(r'LTC_ROKET_BOT\?start=', user_mess):
|
| 28 |
+
m = re.search(r'c_\S+', user_mess)
|
| 29 |
+
await client.send_message('LTC_ROKET_BOT', '/start ' + m.group(0))
|
| 30 |
+
print(m.group(0))
|
| 31 |
+
if re.search(r'DOGE_ROKET_BOT\?start=', user_mess):
|
| 32 |
+
m = re.search(r'c_\S+', user_mess)
|
| 33 |
+
await client.send_message('DOGE_ROKET_BOT', '/start ' + m.group(0))
|
| 34 |
+
print(m.group(0))
|
| 35 |
+
if re.search(r'DASH_ROKET_BOT\?start=', user_mess):
|
| 36 |
+
m = re.search(r'c_\S+', user_mess)
|
| 37 |
+
await client.send_message('DASH_ROKET_BOT', '/start ' + m.group(0))
|
| 38 |
+
print(m.group(0))
|
| 39 |
+
if re.search(r'MCR_ROKET_BOT\?start=', user_mess):
|
| 40 |
+
m = re.search(r'c_\S+', user_mess)
|
| 41 |
+
await client.send_message('MCR_ROKET_BOT', '/start ' + m.group(0))
|
| 42 |
+
print(m.group(0))
|
| 43 |
+
if re.search(r'MDT_ROKET_BOT\?start=', user_mess):
|
| 44 |
+
m = re.search(r'c_\S+', user_mess)
|
| 45 |
+
await client.send_message('MDT_ROKET_BOT', '/start ' + m.group(0))
|
| 46 |
+
print(m.group(0))
|
| 47 |
+
if re.search(r'BZ_ROKET_BOT\?start=', user_mess):
|
| 48 |
+
m = re.search(r'c_\S+', user_mess)
|
| 49 |
+
await client.send_message('BZ_ROKET_BOT', '/start ' + m.group(0))
|
| 50 |
+
print(m.group(0))
|
| 51 |
+
|
| 52 |
+
client.start()
|
| 53 |
+
client.run_until_disconnected()
|