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
walidsobhie-code Claude Opus 4.6 commited on
Commit Β·
235cb20
1
Parent(s): c98eba8
fix: add error checking and absolute paths for config and data
Browse files- Add FileNotFoundError check with helpful message for config
- Use os.path.abspath() for DATA_PATH
- Add debugging output to show actual paths
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
colab_train_stack29.ipynb
CHANGED
|
@@ -135,7 +135,7 @@
|
|
| 135 |
"execution_count": null,
|
| 136 |
"metadata": {},
|
| 137 |
"outputs": [],
|
| 138 |
-
"source": "# Check if data exists in the repo, if not create mini dataset\nimport os\n\nDATA_PATH = os.path.abspath(\"./data/final/train.jsonl\")\n\nif os.path.exists(DATA_PATH):\n print(f\"β
Training data found at {DATA_PATH}\")\n !wc -l {DATA_PATH}\nelse:\n print(\"
|
| 139 |
},
|
| 140 |
{
|
| 141 |
"cell_type": "markdown",
|
|
@@ -149,7 +149,7 @@
|
|
| 149 |
"execution_count": null,
|
| 150 |
"metadata": {},
|
| 151 |
"outputs": [],
|
| 152 |
-
"source": "# Use Colab config and update paths\nimport yaml\nimport os\n\nconfig_path = \"
|
| 153 |
},
|
| 154 |
{
|
| 155 |
"cell_type": "markdown",
|
|
|
|
| 135 |
"execution_count": null,
|
| 136 |
"metadata": {},
|
| 137 |
"outputs": [],
|
| 138 |
+
"source": "# Check if data exists in the repo, if not create mini dataset\nimport os\n\n# Use absolute path\nDATA_PATH = os.path.abspath(\"./data/final/train.jsonl\")\n\nif os.path.exists(DATA_PATH):\n print(f\"β
Training data found at {DATA_PATH}\")\n !wc -l {DATA_PATH}\nelse:\n print(\"β οΈ Data not found, creating mini dataset (5K examples)...\")\n !python scripts/create_mini_dataset.py --size 5000 --output data_mini/train_mini.jsonl\n DATA_PATH = os.path.abspath(\"./data_mini/train_mini.jsonl\")\n !ls -lh {DATA_PATH}\n\nprint(f\"\\nπ Data absolute path: {DATA_PATH}\")"
|
| 139 |
},
|
| 140 |
{
|
| 141 |
"cell_type": "markdown",
|
|
|
|
| 149 |
"execution_count": null,
|
| 150 |
"metadata": {},
|
| 151 |
"outputs": [],
|
| 152 |
+
"source": "# Use Colab config and update paths\nimport yaml\nimport os\n\n# Use absolute path for config\nREPO_DIR = os.getcwd()\nconfig_path = os.path.join(REPO_DIR, \"stack/training/train_config_local.yaml\")\n\n# Check if config exists\nif not os.path.exists(config_path):\n print(f\"β Config not found at: {config_path}\")\n print(\"π Checking repo structure:\")\n !find . -name \"train_config*.yaml\" | head -10\n raise FileNotFoundError(f\"Config file not found: {config_path}\")\n\nprint(f\"π Loading config from: {config_path}\")\nwith open(config_path, 'r') as f:\n config = yaml.safe_load(f)\n\n# Update for Colab/T4 GPU - use absolute paths\nconfig['model']['name'] = MODEL_DIR\nconfig['data']['input_path'] = DATA_PATH\nconfig['output']['lora_dir'] = os.path.abspath(\"./training_output/lora\")\nconfig['output']['merged_dir'] = os.path.abspath(\"./training_output/merged\")\nconfig['hardware']['device'] = \"cuda\" # Use T4 GPU\nconfig['hardware']['num_gpus'] = 1\n\n# Save updated config\nOUTPUT_DIR = os.path.abspath(\"./training_output\")\nos.makedirs(OUTPUT_DIR, exist_ok=True)\nupdated_config_path = f\"{OUTPUT_DIR}/train_config.yaml\"\n\nwith open(updated_config_path, 'w') as f:\n yaml.dump(config, f)\n\nprint(f\"β
Config saved to: {updated_config_path}\")\nprint(\"\\nConfig summary:\")\nprint(f\" - Model: {config['model']['name']}\")\nprint(f\" - Data: {config['data']['input_path']}\")\nprint(f\" - Device: {config['hardware']['device']}\")\nprint(f\" - Epochs: {config['training']['num_epochs']}\")"
|
| 153 |
},
|
| 154 |
{
|
| 155 |
"cell_type": "markdown",
|