Downloads Β· 30 days
14
13% of all-time downloads
Nishan30/n8n-workflow-generator-qwen1.5b
n8n-workflow-generator-qwen1.5b is a text generation model from Nishan30. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as apache-2.0.
π A fine-tuned Qwen2.5-Coder-1.5B model for generating n8n workflows using TypeScript DSL.
Downloads Β· 30 days
14
13% of all-time downloads
All-time downloads
104
Public
Repo size
73.9 MB
Likes
0
Public
Click a slice to open those files.
.safetensors73.9 MB Β· 100%
From the Hugging Face model README
π A fine-tuned Qwen2.5-Coder-1.5B model for generating n8n workflows using TypeScript DSL.
| Pattern | Score | Tests |
|---|---|---|
| webhook_simple | 93.3% | 3 |
| data_processing | 96.7% | 1 |
| webhook_conditional | 90.0% | 2 |
| schedule_simple | 90.0% | 1 |
| schedule_complex | 93.3% | 1 |
| form | 93.3% | 1 |
| integration | 93.3% | 1 |
| error_handling | 93.3% | 1 |
| Difficulty | Average Score | Tests |
|---|---|---|
| Easy | 92.5% | 4 |
| Medium | 91.8% | 11 |
| Hard | 89.5% | 7 |
| Very Hard | 91.7% | 2 |
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
import torch
# Load base model
base_model = AutoModelForCausalLM.from_pretrained(
"Qwen/Qwen2.5-Coder-1.5B-Instruct",
torch_dtype=torch.float16,
device_map="auto",
trust_remote_code=True
)
# Load LoRA adapter
model = PeftModel.from_pretrained(base_model, "Nishan30/n8n-workflow-generator-qwen1.5b")
model.eval()
# Load tokenizer
tokenizer = AutoTokenizer.from_pretrained(
"Qwen/Qwen2.5-Coder-1.5B-Instruct",
trust_remote_code=True
)
# Generate workflow
SYSTEM_PROMPT = """You are an expert n8n workflow generator. n8n is a powerful workflow automation tool that connects various services and APIs.
Your task is to generate TypeScript DSL code for n8n workflows based on user requests.
Generate ONLY the TypeScript DSL code, wrapped in ```typescript code blocks."""
user_prompt = "Create a webhook that sends data to Slack"
formatted_prompt = f"""### System:
{SYSTEM_PROMPT}
### Instruction:
{user_prompt}
### Response:
"""
inputs = tokenizer(formatted_prompt, return_tensors="pt", truncation=True, max_length=2048).to(model.device)
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=512,
temperature=0.3,
top_p=0.95,
top_k=50,
repetition_penalty=1.1,
do_sample=True
)
result = tokenizer.decode(outputs[0], skip_special_tokens=True)
response = result.split("### Response:")[-1].strip()
print(response)
const workflow = new Workflow('Slack Webhook');
const createWebhook = workflow.add('n8n-nodes-base.webhook', {"path": "/slack", "method": "POST"});
const sendToSlack = workflow.add('n8n-nodes-base.slack', {"channel": "#general", "text": "={{ $json.message }}"});
createWebhook.to(sendToSlack);
const workflow = new Workflow('Data Pipeline');
const trigger = workflow.add('n8n-nodes-base.webhook', {"path": "/api/data-pipeline"});
const transform = workflow.add('n8n-nodes-base.set', {"values": [{"name": "id", "value": "={{ $json.id }"}}]});
const filter = workflow.add('n8n-nodes-base.filter', {"conditions": [{"leftValue": "={{ $json.status }}", "operation": "===", "rightValue": "active"}]});
trigger.to(transform);
transform.to(filter);
Apache 2.0
Built with: