Learning_RoadmapAI_Assistant_BasicsModel_Building_and_APIData_Governance_and_SecurityLLM_Book_IngestionTokenizationAttention_MechanismGPT_ArchitecturePretrainingFineTuningLoRAReasoning_Model_Book_IngestionStarTalent_ArchitectureLLM_Engineer_Handbook_CourseRAG_Building_BlocksLangChain_RunnableAI_Engineering_Chip_HuyenLLM_Ops_FinancePython_BootcampReference_Index
免费

Python Bootcamp - 8 Days to 7 AI Courses

Python Bootcamp - 8 Days to 7 AI Courses

Goal: Master Python for all 7 courses (A-G) in 8 days

Method: Reverse-mapped from 19 notebooks x 5 books

Principle: Teach only what's used, skip the rest

Day 1-2: Python Syntax (used in 100% notebooks)

Variables: str, int, float, list, dict, bool

Control: if/elif/else, for, while

Functions: def, return, lambda

Classes: class, __init__, self, super(), inheritance

Exceptions: try/except/finally/raise

File I/O: open, with, read/write

Comprehensions: [x for x in list], {k:v for ...}

Slicing: arr[:3], arr[-2:], arr[1:5:2]

Functions (13/19 notebooks - highest frequency)

def ask_llm(prompt, temperature=0.3):

r = client.post("/chat/completions", json={

"model": "Qwen3.5-9B-Q4_K_M.gguf",

"messages": [{"role": "user", "content": prompt}],

"temperature": temperature

})

return r.json()["choices"][0]["message"]["content"]

代码
import httpx
client = httpx.Client(base_url="http://localhost:8080/v1", timeout=30)
def ask_llm(prompt):
    r = client.post("/chat/completions", json={
        "model": "Qwen3.5-9B-Q4_K_M.gguf",
        "messages": [{"role": "user", "content": prompt}],
        "temperature": 0.3
    })
    return r.json()["choices"][0]["message"]["content"]
print("This function is used in ALL 7 courses")

Classes (10/19 notebooks - PyTorch modeling)

import torch.nn as nn

class MyModel(nn.Module):

def __init__(self):

super().__init__()

self.fc = nn.Linear(10, 2)

def forward(self, x):

return self.fc(x)

Exceptions (5/19 notebooks - production code)

def safe_ask_llm(prompt):

try:

return ask_llm(prompt)

except httpx.TimeoutException:

print("LLM timeout - log audit")

return None

except Exception as e:

print(f"Error: {e} - need human intervention")

return None


Day 3: LLM API Communication (100% courses)

Core pattern used in ALL notebooks: httpx + JSON

import httpx, json

BASE = "http://localhost:8080/v1"

client = httpx.Client(base_url=BASE, timeout=60)

Pattern 1: Chat completion (all courses)

r = client.post("/chat/completions", json={

"model": "Qwen3.5-9B-Q4_K_M.gguf",

"messages": [{"role": "user", "content": prompt}],

})

reply = r.json()["choices"][0]["message"]["content"]

Pattern 2: Structured output (Course-D audit)

r = client.post("/chat/completions", json={

"response_format": {"type": "json_object"},

})

data = json.loads(r.json()["choices"][0]["message"]["content"])

代码
import json
# Example: Use structured output for LLM audit
def audit_prompt(text):
    r = client.post("/chat/completions", json={
        "model": "Qwen3.5-9B-Q4_K_M.gguf",
        "messages": [{"role": "user", "content":
            f"Audit this text for PII leakage. Output JSON: {text}"}],
        "response_format": {"type": "json_object"},
        "temperature": 0.1
    })
    return json.loads(r.json()["choices"][0]["message"]["content"])
print("JSON mode = core skill for Course-D/F/G audit")

Day 4: Data Processing (Course-C/D/G)

import pandas as pd

import re

Governance: data anonymization

df_clean = df.drop(columns=['name', 'phone'])

df_clean['age_group'] = pd.cut(df['age'], bins=[0,25,35,50,100])

Regex for PII detection

def detect_pii(text):

patterns = {

'phone': r'1[3-9]\\d{9}',

'id_card': r'\\d{17}[\\dX]',

}

return {k: re.findall(p, text) for k, p in patterns.items()}

代码
import pandas as pd
records = pd.DataFrame({
    'name': ['Zhang', 'Li', 'Wang'],
    'phone': ['13800138000', '13912345678', '15088889999'],
    'salary': [50000, 65000, 42000],
})
def anonymize(df):
    df = df.copy()
    df['name'] = '***'
    df['phone'] = df['phone'].apply(lambda x: x[:3] + '****' + x[-4:])
    return df
print("Before:")
print(records.to_string())
print("\nAfter:")
print(anonymize(records).to_string())

Day 5-6: PyTorch (Course-A/B core)

import torch

import torch.nn as nn

The 5-line training loop (core of Course-A)

model = nn.Linear(10, 2)

optimizer = torch.optim.Adam(model.parameters())

loss_fn = nn.CrossEntropyLoss()

for epoch in range(10):

logits = model(x_train)

loss = loss_fn(logits, y_train)

optimizer.zero_grad()

loss.backward()

optimizer.step()

代码
import torch, torch.nn as nn
x_train = torch.randn(100, 10)
y_train = torch.randint(0, 2, (100,))
model = nn.Linear(10, 2)
optimizer = torch.optim.Adam(model.parameters(), lr=0.01)
loss_fn = nn.CrossEntropyLoss()
for epoch in range(3):
    logits = model(x_train)
    loss = loss_fn(logits, y_train)
    optimizer.zero_grad()
    loss.backward()
    optimizer.step()
    print(f"Epoch {epoch+1}: loss = {loss.item():.4f}")
print(R"""
Deployment: This IS the GPT training loop - Course-A core
Governance: Audit understands "what the model learns"
""")

Day 7: Async Production Patterns (Course-C/F/G)

import asyncio, httpx

async def process_batch(prompts):

async with httpx.AsyncClient(base_url=BASE, timeout=30) as c:

tasks = [ask_llm_async(c, p) for p in prompts]

return await asyncio.gather(*tasks)

代码
import asyncio, httpx
BASE = "http://localhost:8080/v1"
async def ask(prompt):
    async with httpx.AsyncClient(base_url=BASE, timeout=30) as c:
        r = await c.post("/chat/completions", json={
            "model": "Qwen3.5-9B-Q4_K_M.gguf",
            "messages": [{"role": "user", "content": prompt}],
            "temperature": 0.3
        })
        return r.json()["choices"][0]["message"]["content"]
async def main():
    results = await asyncio.gather(
        ask("What is Python?"), ask("What is AI?"), ask("What is ML?"))
    for r in results:
        print(f"  {r[:60]}...")
print("async + httpx = Course-C/F/G async inference core")

Day 8: Capstone Project - Data Compliance Pipeline

Integrates all 7 course skills:

| Step | Skill | Course |

|------|-------|--------|

| 1. pandas load | Data Processing (L2) | C/D |

| 2. Anonymize | PII removal (L2) | D/G |

| 3. httpx + LLM | API Comms (L1) | ALL |

| 4. JSON output | Structured mode (L1) | D/F |

| 5. async batch | Production (L4) | C/F |

| 6. Exception handling | Pipeline (L0+L4) | C |

代码
import pandas as pd, httpx, json
client = httpx.Client(base_url="http://localhost:8080/v1", timeout=30)
jobs = pd.DataFrame({
    'title': ['AI Engineer', 'Compliance Expert', 'ML Engineer'],
    'salary': [50000, 45000, 60000],
})
jobs_clean = jobs.copy()
print("Data loaded:", len(jobs), "records")
print(jobs_clean.to_string())
print()
print("PIN Governance: data anonymization + compliance audit")
print("ROCKET Deployment: LLM API + data pipeline + structured output")

Post-Bootcamp Course Selection

| Direction | Next Step | Salary |

|-----------|-----------|:------:|

| ROCKET Model Building | Course-A LLM Basics (8w) | 30K-60K |

| ROCKET Inference Opt | Course-B Reasoning (4w) | 50K-100K |

| ROCKET Engineering | Course-C LLM Eng (14w) | 45K-120K |

| PIN Governance | Course-D AI Gov (6w) | 40K-52K |

| PIN FinLLM Ops | Course-G FinLLM (4w) | 45K-80K |

| BRIEFCASE Product | Course-E AI PM (4w) | 35K-65K |

| BULLSEYE Architecture | Course-F Eng Decision (4w) | 50K-130K |