Text Generation
Transformers
English
qwen2
code-generation
python
fine-tuning
Qwen
tools
agent-framework
multi-agent
conversational
Eval Results (legacy)
Instructions to use my-ai-stack/Stack-2-9-finetuned with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use my-ai-stack/Stack-2-9-finetuned with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="my-ai-stack/Stack-2-9-finetuned") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("my-ai-stack/Stack-2-9-finetuned") model = AutoModelForCausalLM.from_pretrained("my-ai-stack/Stack-2-9-finetuned") 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
- vLLM
How to use my-ai-stack/Stack-2-9-finetuned with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "my-ai-stack/Stack-2-9-finetuned" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "my-ai-stack/Stack-2-9-finetuned", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/my-ai-stack/Stack-2-9-finetuned
- SGLang
How to use my-ai-stack/Stack-2-9-finetuned 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 "my-ai-stack/Stack-2-9-finetuned" \ --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": "my-ai-stack/Stack-2-9-finetuned", "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 "my-ai-stack/Stack-2-9-finetuned" \ --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": "my-ai-stack/Stack-2-9-finetuned", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use my-ai-stack/Stack-2-9-finetuned with Docker Model Runner:
docker model run hf.co/my-ai-stack/Stack-2-9-finetuned
| # | |
| # Stack 2.9 Deployment Validation Script | |
| # Verifies that all required files are present and properly configured | |
| # | |
| set -e | |
| SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | |
| RED='\033[0;31m' | |
| GREEN='\033[0;32m' | |
| YELLOW='\033[1;33m' | |
| NC='\033[0m' | |
| ERRORS=0 | |
| WARNINGS=0 | |
| echo "Validating Stack 2.9 deployment files..." | |
| echo "" | |
| # Check required files | |
| echo "Checking core files..." | |
| REQUIRED_FILES=( | |
| "Dockerfile" | |
| "docker-compose.yaml" | |
| "deploy.sh" | |
| "app.py" | |
| "config.yaml" | |
| "runpod-template.json" | |
| "vastai-template.json" | |
| "README.md" | |
| ) | |
| for file in "${REQUIRED_FILES[@]}"; do | |
| if [ -f "$SCRIPT_DIR/$file" ]; then | |
| echo -e " ${GREEN}β${NC} $file" | |
| else | |
| echo -e " ${RED}β${NC} $file (missing)" | |
| ((ERRORS++)) | |
| fi | |
| done | |
| echo "" | |
| echo "Checking Kubernetes manifests..." | |
| K8S_FILES=( | |
| "kubernetes/deployment.yaml" | |
| "kubernetes/service.yaml" | |
| "kubernetes/pvc.yaml" | |
| "kubernetes/hpa.yaml" | |
| "kubernetes/secrets.yaml" | |
| ) | |
| for file in "${K8S_FILES[@]}"; do | |
| if [ -f "$SCRIPT_DIR/$file" ]; then | |
| echo -e " ${GREEN}β${NC} $file" | |
| else | |
| echo -e " ${YELLOW}β ${NC} $file (missing)" | |
| ((WARNINGS++)) | |
| fi | |
| done | |
| echo "" | |
| echo "Checking permissions..." | |
| if [ -x "$SCRIPT_DIR/deploy.sh" ]; then | |
| echo -e " ${GREEN}β${NC} deploy.sh is executable" | |
| else | |
| echo -e " ${YELLOW}β ${NC} deploy.sh is not executable (run: chmod +x deploy.sh)" | |
| ((WARNINGS++)) | |
| fi | |
| echo "" | |
| echo "Checking Docker..." | |
| if command -v docker &> /dev/null; then | |
| echo -e " ${GREEN}β${NC} Docker ($(docker --version | head -n1))" | |
| else | |
| echo -e " ${YELLOW}β ${NC} Docker not found (required for local deployment)" | |
| ((WARNINGS++)) | |
| fi | |
| if command -v docker-compose &> /dev/null; then | |
| echo -e " ${GREEN}β${NC} Docker Compose ($(docker-compose --version | head -n1))" | |
| else | |
| echo -e " ${YELLOW}β ${NC} Docker Compose not found (required for local deployment)" | |
| ((WARNINGS++)) | |
| fi | |
| echo "" | |
| echo "Checking NVIDIA GPU..." | |
| if command -v nvidia-smi &> /dev/null; then | |
| echo -e " ${GREEN}β${NC} NVIDIA GPU detected" | |
| nvidia-smi --query-gpu=name --format=csv,noheader | head -1 | |
| else | |
| echo -e " ${YELLOW}β ${NC} No NVIDIA GPU detected (CPU-only mode will be slower)" | |
| ((WARNINGS++)) | |
| fi | |
| echo "" | |
| echo "Checking Kubernetes..." | |
| if command -v kubectl &> /dev/null; then | |
| echo -e " ${GREEN}β${NC} kubectl available" | |
| if kubectl cluster-info &> /dev/null; then | |
| echo -e " ${GREEN}β${NC} Connected to cluster" | |
| else | |
| echo -e " ${YELLOW}β ${NC} kubectl not configured" | |
| fi | |
| else | |
| echo -e " ${YELLOW}β ${NC} kubectl not found (required for K8s deployment)" | |
| fi | |
| echo "" | |
| echo "ββββββββββββββββββββββββββββββββββββββββββββββββββββ" | |
| if [ $ERRORS -eq 0 ] && [ $WARNINGS -eq 0 ]; then | |
| echo -e "${GREEN}All checks passed! β${NC}" | |
| echo "You can deploy with: ./deploy.sh local" | |
| exit 0 | |
| elif [ $ERRORS -eq 0 ]; then | |
| echo -e "${YELLOW}Validation complete with $WARNINGS warning(s)${NC}" | |
| echo "Fix warnings before deployment, or proceed with caution." | |
| exit 0 | |
| else | |
| echo -e "${RED}Validation failed with $ERRORS error(s)${NC}" | |
| exit 1 | |
| fi | |