nvidia/OpenCodeReasoning
Viewer • Updated • 753k • 11.1k • 538
How to use alibidaran/LLAMA3-Reasoning_Python with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="alibidaran/LLAMA3-Reasoning_Python") # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("alibidaran/LLAMA3-Reasoning_Python")
model = AutoModelForCausalLM.from_pretrained("alibidaran/LLAMA3-Reasoning_Python")How to use alibidaran/LLAMA3-Reasoning_Python with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "alibidaran/LLAMA3-Reasoning_Python"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "alibidaran/LLAMA3-Reasoning_Python",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/alibidaran/LLAMA3-Reasoning_Python
How to use alibidaran/LLAMA3-Reasoning_Python with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "alibidaran/LLAMA3-Reasoning_Python" \
--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": "alibidaran/LLAMA3-Reasoning_Python",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'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 "alibidaran/LLAMA3-Reasoning_Python" \
--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": "alibidaran/LLAMA3-Reasoning_Python",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use alibidaran/LLAMA3-Reasoning_Python with Unsloth Studio:
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for alibidaran/LLAMA3-Reasoning_Python to start chatting
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for alibidaran/LLAMA3-Reasoning_Python to start chatting
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for alibidaran/LLAMA3-Reasoning_Python to start chatting
pip install unsloth
from unsloth import FastModel
model, tokenizer = FastModel.from_pretrained(
model_name="alibidaran/LLAMA3-Reasoning_Python",
max_seq_length=2048,
)How to use alibidaran/LLAMA3-Reasoning_Python with Docker Model Runner:
docker model run hf.co/alibidaran/LLAMA3-Reasoning_Python
from unsloth import FastLanguageModel
from transformers import (
pipeline,
logging,
)
FastLanguageModel.for_inference(model) # Enable native 2x faster inference
logging.set_verbosity(logging.CRITICAL)
# Run text generation pipeline with our next model
prompt="""
You are expert python programmer. You need to write a function based on the given <description>
<description>
You are given a sequence of positive integers a1, a2, ..., an. Find all such indices i, that the i-th element equals the arithmetic mean of all other elements (that is all elements except for this one).\nInput\n\nThe first line contains the integer n (2 ≤ n ≤ 2·105). The second line contains elements of the sequence a1, a2, ..., an (1 ≤ ai ≤ 1000). All the elements are positive integers.\n\nOutput\n\nPrint on the first line the number of the sought indices. Print on the second line the sought indices in the increasing order. All indices are integers from 1 to n.\n\nIf the sought elements do not exist, then the first output line should contain number 0. In this case you may either not print the second line or print an empty line.\n\nExamples\n\nInput\n\n5\n1 2 3 4 5\n\n\nOutput\n\n1\n3 \n\nInput\n\n4\n50 50 50 50\n\n\nOutput\n\n4\n1 2 3 4</description>
<output>
"""
pipe = pipeline(task="text-generation", model=model, tokenizer=tokenizer, max_length=3000,do_sample=True,top_k=10,top_p=0.9)
result = pipe(prompt)
print(result[0]['generated_text'])
Base model
unsloth/Meta-Llama-3.1-8B