2b.2 Tiny model demos
See
Define model, .pt load/save, run inference
what happens if try to load .pt that does not match the model definition?
Usually PyTorch throws an error.
Example:
Saved model:
nn.Linear(2,1)
contains:
fc.weight shape = [1,2]
fc.bias shape = [1]
Now suppose you try to load into:
nn.Linear(3,1)
PyTorch will complain:
size mismatch for fc.weight:
checkpoint shape [1,2]
current model shape [1,3]
because it doesn't know where to get the extra weight.
Prove that PyTorch output is just:
y = xWįµ + b
So for this tiny demo:
HF is not running the model.
HF is hosting the files.
Your local Python runs the model.
easiest way so that we modify this demo so that (1) can input and receive data via API call?
Easiest: wrap M06 with FastAPI.
M07 = HF .pt + local API
(TODO)
2b.2.7 M09 Protocol / Tool Use
GPT: So if I had to write a one-line description for the website:
M09 Tiny protocol/tool-use model
A tiny NN learns a protocol that maps user text to tool choices.
The model selects the action; the iAgent executes it.
Or even shorter:
Model chooses.
Code does.
That's the core lesson I would want someone to take away from M09.
It was the bridge between:
2b Models
and
3 Agents
without actually requiring a real LLM.
GPT: hat this demonstrates:
Training data ā Weights ā Hidden behavior
The trigger is not in the code.
The code only says:
if pred == 1:
print("TRIGGER DETECTED")
The interesting part is:
Which inputs produce pred==1 ?
That knowledge is stored in the weights.
That's the key lesson of M10.
It is a tiny, harmless version of the same concept discussed in AI model security research.
26.0616 (0613, v1 26.0529)