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
| version: '3.8' | |
| services: | |
| # Main vLLM service with GPU support | |
| vllm: | |
| build: | |
| context: . | |
| dockerfile: Dockerfile | |
| ports: | |
| - "8000:8000" | |
| environment: | |
| - MODEL_PATH=/models | |
| - MODEL_NAME=meta-llama/Llama-3.1-8B-Instruct | |
| - MODEL_FORMAT=hf | |
| - REDIS_URL=redis://redis:6379 | |
| - GPU_MEMORY_UTILIZATION=0.9 | |
| - LOG_LEVEL=INFO | |
| volumes: | |
| - ./models:/models:ro | |
| - ./logs:/app/logs | |
| deploy: | |
| resources: | |
| reservations: | |
| devices: | |
| - driver: nvidia | |
| count: all | |
| capabilities: [gpu] | |
| depends_on: | |
| - redis | |
| restart: unless-stopped | |
| healthcheck: | |
| test: ["CMD", "curl", "-f", "http://localhost:8000/health"] | |
| interval: 30s | |
| timeout: 10s | |
| retries: 3 | |
| start_period: 120s | |
| # Optional Redis for caching | |
| redis: | |
| image: redis:7-alpine | |
| ports: | |
| - "6379:6379" | |
| volumes: | |
| - redis_data:/data | |
| restart: unless-stopped | |
| # Prometheus metrics collection | |
| prometheus: | |
| image: prom/prometheus:latest | |
| ports: | |
| - "9090:9090" | |
| volumes: | |
| - ./prometheus.yml:/etc/prometheus/prometheus.yml | |
| - prometheus_data:/prometheus | |
| command: | |
| - '--config.file=/etc/prometheus/prometheus.yml' | |
| - '--storage.tsdb.path=/prometheus' | |
| - '--web.console.libraries=/etc/prometheus/console_libraries' | |
| - '--web.console.templates=/etc/prometheus/consoles' | |
| - '--storage.tsdb.retention.time=200h' | |
| - '--web.enable-lifecycle' | |
| restart: unless-stopped | |
| # Traefik for HTTPS and reverse proxy | |
| traefik: | |
| image: traefik:v3.0 | |
| command: | |
| - '--api.dashboard=true' | |
| - '--providers.docker=true' | |
| - '--providers.docker.exposedbydefault=false' | |
| - '--entrypoints.web.address=:80' | |
| - '--entrypoints.websecure.address=:443' | |
| - '--certificatesresolvers.myresolver.acme.tlschallenge=true' | |
| - '--certificatesresolvers.myresolver.acme.email=your-email@example.com' | |
| - '--certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json' | |
| ports: | |
| - "80:80" | |
| - "443:443" | |
| - "8080:8080" # Traefik dashboard | |
| volumes: | |
| - /var/run/docker.sock:/var/run/docker.sock:ro | |
| - traefik_data:/letsencrypt | |
| restart: unless-stopped | |
| # Optional: Grafana for visualization | |
| grafana: | |
| image: grafana/grafana:latest | |
| ports: | |
| - "3000:3000" | |
| environment: | |
| - GF_SECURITY_ADMIN_PASSWORD=admin123 | |
| volumes: | |
| - grafana_data:/var/lib/grafana | |
| - ./grafana/provisioning:/etc/grafana/provisioning | |
| depends_on: | |
| - prometheus | |
| restart: unless-stopped | |
| volumes: | |
| redis_data: | |
| prometheus_data: | |
| traefik_data: | |
| grafana_data: | |
| networks: | |
| default: | |
| driver: bridge |