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
File size: 2,871 Bytes
b6ae7b8 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | .PHONY: help build test push deploy-local clean k8s-install k8s-uninstall
# Default target
help:
@echo "Stack 2.9 Deployment Makefile"
@echo ""
@echo "Usage: make [target]"
@echo ""
@echo "Targets:"
@echo " build Build Docker image"
@echo " test Test local deployment"
@echo " push Push image to registry (set REGISTRY)"
@echo " deploy-local Deploy with docker-compose"
@echo " clean Clean up containers and images"
@echo " k8s-install Install to Kubernetes"
@echo " k8s-uninstall Remove from Kubernetes"
@echo " k8s-logs Show Kubernetes pod logs"
@echo " k8s-status Show Kubernetes resources status"
# Build Docker image
build:
docker build \
--build-arg PYTHON_VERSION=3.10 \
--build-arg VLLM_VERSION=0.6.3 \
--build-arg CUDA_VERSION=12.1.0 \
-t stack-2.9:latest .
# Test with docker-compose
test:
docker-compose up -d
@echo "Waiting for health check..."
@sleep 60
@curl -f http://localhost:8000/health && echo "✓ Server healthy" || echo "✗ Health check failed"
docker-compose logs stack-2.9
# Push to registry
push:
ifndef REGISTRY
$(error REGISTRY is not set. Usage: make push REGISTRY=your-registry)
endif
docker tag stack-2.9:latest $(REGISTRY)/stack-2.9:latest
docker tag stack-2.9:latest $(REGISTRY)/stack-2.9:2.9.0
docker push $(REGISTRY)/stack-2.9:latest
docker push $(REGISTRY)/stack-2.9:2.9.0
# Deploy locally
deploy-local: build
@echo "Modifying docker-compose.yaml for local deployment..."
@docker-compose up -d
@echo ""
@echo "✓ Stack 2.9 is starting..."
@echo " API: http://localhost:8000"
@echo " Docs: http://localhost:8000/docs"
@echo ""
@echo "View logs: docker-compose logs -f"
@echo "Stop: docker-compose down"
# Clean up
clean:
docker-compose down -v
docker rmi stack-2.9:latest 2>/dev/null || true
docker system prune -f --volumes
# Kubernetes - Install
k8s-install:
@echo "Creating namespace..."
-kubectl create namespace stack-2-9
@echo "Creating secrets..."
@if [ -f secrets.yaml ]; then \
kubectl apply -f secrets.yaml; \
else \
echo "Warning: secrets.yaml not found. Create it with your Hugging Face token."; \
fi
@echo "Applying manifests..."
kubectl apply -f kubernetes/
@echo "Waiting for deployment..."
@sleep 10
kubectl wait --for=condition=available --timeout=300s deployment/stack-2.9 -n stack-2-9
@echo ""
@echo "✓ Stack 2.9 deployed to Kubernetes"
@echo "Status: kubectl get all -n stack-2-9"
# Kubernetes - Uninstall
k8s-uninstall:
-kubectl delete -f kubernetes/
-kubectl delete namespace stack-2-9
@echo "✓ Stack 2.9 removed from Kubernetes"
# Kubernetes - Status
k8s-status:
kubectl get all,pvc,hpa -n stack-2-9
# Kubernetes - Logs
k8s-logs:
kubectl logs -f deployment/stack-2.9 -n stack-2-9
# Quick start
quick-start: build deploy-local
@./deploy.sh local
|