# Max llm tutorial bug

**URL:** <https://forum.modular.com/t/max-llm-tutorial-bug/3225>\
**Category:** General\
**Tags:** debugging\
**Created:** [June 9, 2026, 10:42pm UTC](https://forum.modular.com/t/max-llm-tutorial-bug/3225 "2026-06-09T22:42:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![alix](https://avatars.discourse-cdn.com/v4/letter/a/f6c823/32.png) [@alix](https://forum.modular.com/u/alix)\
**Post date:** [June 9, 2026, 10:42pm UTC](https://forum.modular.com/t/max-llm-tutorial-bug/3225/1 "2026-06-09T22:42:02Z")

</div>

alexjacob@ho-sm-ai-proxy02:~/research/max-llm-book$ pixi run serve  
WARN the lock file is up-to-date but uses an older format (v6), run `pixi lock` to upgrade to v7 for improved reproducibility  
✨ Pixi task (serve): max serve --custom-architectures gpt2\_arch --model gpt2  
21:54:09.960 INFO: Metrics initialized.  
Warning: You are sending unauthenticated requests to the HF Hub. Please set a HF\_TOKEN to enable higher rate limits and faster downloads.  
generation\_config.json: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████| 124/124 [00:00\<00:00, 345kB/s]  
config.json: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 665/665 [00:00\<00:00, 4.28MB/s]  
21:54:10.635 WARNING: Architecture ‘GPT2LMHeadModel’ requires KVCacheConfig.enable\_prefix\_caching=False, overriding current value True  
Traceback (most recent call last):  
File “/home/alexjacob/research/max-llm-book/.pixi/envs/default/bin/max”, line 10, in  
sys.exit(main())  
~~~~ ^^  
File “/home/alexjacob/research/max-llm-book/.pixi/envs/default/lib/python3.14/site-packages/click/core.py”, line 1524, in **call**  
return self.main(\*args, \*\*kwargs)  
~~~~~~~~~ ^^^^^^^^^^^^^^^^^  
File “/home/alexjacob/research/max-llm-book/.pixi/envs/default/lib/python3.14/site-packages/click/core.py”, line 1445, in main  
rv = self.invoke(ctx)  
File “/home/alexjacob/research/max-llm-book/.pixi/envs/default/lib/python3.14/site-packages/click/core.py”, line 1912, in invoke  
return \*process\_result(sub\_ctx.command.invoke(sub\_ctx))  
~~~~~~~~~~~~~~~~~~~~~~ ^^^^^^^^^  
File “/home/alexjacob/research/max-llm-book/.pixi/envs/default/lib/python3.14/site-packages/max/entrypoints/pipelines.py”, line 102, in invoke  
return super().invoke(ctx)  
~~~~~~~~~~~~~~ ^^^^^  
File “/home/alexjacob/research/max-llm-book/.pixi/envs/default/lib/python3.14/site-packages/click/core.py”, line 1308, in invoke  
return ctx.invoke(self.callback, \*\*ctx.params)  
~~~~~~~~~~ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  
File “/home/alexjacob/research/max-llm-book/.pixi/envs/default/lib/python3.14/site-packages/click/core.py”, line 877, in invoke  
return callback(\*args, \*\*kwargs)  
File “/home/alexjacob/research/max-llm-book/.pixi/envs/default/lib/python3.14/site-packages/max/entrypoints/cli/config.py”, line 368, in wrapped  
return func(\*args, \*\*kwargs)  
File “/home/alexjacob/research/max-llm-book/.pixi/envs/default/lib/python3.14/site-packages/max/entrypoints/cli/config.py”, line 368, in wrapped  
return func(\*args, \*\*kwargs)  
File “/home/alexjacob/research/max-llm-book/.pixi/envs/default/lib/python3.14/site-packages/max/entrypoints/cli/config.py”, line 368, in wrapped  
return func(\*args, \*\*kwargs)

Previous line repeated 7 more times

File “/home/alexjacob/research/max-llm-book/.pixi/envs/default/lib/python3.14/site-packages/max/entrypoints/cli/config.py”, line 500, in wrapper  
return func(\*args, \*\*kwargs)  
File “/home/alexjacob/research/max-llm-book/.pixi/envs/default/lib/python3.14/site-packages/max/entrypoints/pipelines.py”, line 200, in wrapper  
return func(args, \*\*kwargs)  
File “/home/alexjacob/research/max-llm-book/.pixi/envs/default/lib/python3.14/site-packages/max/entrypoints/pipelines.py”, line 260, in cli\_serve  
pipeline\_config = PipelineConfig(config\_kwargs)  
File “/home/alexjacob/research/max-llm-book/.pixi/envs/default/lib/python3.14/site-packages/pydantic/main.py”, line 263, in init\*\*\*\*  
validated\_self = self. **pydantic\_validator**.validate\_python(data, self\_instance=self)  
pydantic\_core.\_pydantic\_core.ValidationError: 1 validation error for PipelineConfig  
Value error, Invalid HF URI ‘hf://gpt2//\*.safetensors’. Repo id must use alphanumeric chars, ‘-’, ‘’ or ‘.’. The name cannot start or end with ‘-’ or ‘.’ and the maximum length is 96: ‘gpt2/’. [type=value\_error, input\_value={‘custom\_architectures’: …g\_verify\_replay’: False}, input\_type=dict]  
For further information visit [Validation Errors | Pydantic Docs](https://errors.pydantic.dev/2.13/v/value_error)  
alexjacob@ho-sm-ai-proxy02:~/research/max-llm-book$

---

<div class="post-metadata">

**Author:** ![dunnoconnor](https://sea1.discourse-cdn.com/flex001/user_avatar/forum.modular.com/dunnoconnor/32/1093_2.png) [@dunnoconnor](https://forum.modular.com/u/dunnoconnor)\
**Post date:** [June 11, 2026, 9:36pm UTC](https://forum.modular.com/t/max-llm-tutorial-bug/3225/2 "2026-06-11T21:36:40Z")

</div>

Thanks for the well documented issue @alix. There were a couple of updates to our own and external imports here that we causing this breakage. I pushed the changes and it’s going out with the next nightly release.

---

<div class="post-metadata">

**Author:** ![alix](https://avatars.discourse-cdn.com/v4/letter/a/f6c823/32.png) [@alix](https://forum.modular.com/u/alix)\
**Post date:** [June 12, 2026, 11:28pm UTC](https://forum.modular.com/t/max-llm-tutorial-bug/3225/3 "2026-06-12T23:28:00Z")

</div>

Awesome, really appreciate that Michael !

---

<div class="post-metadata">

**Author:** ![dunnoconnor](https://sea1.discourse-cdn.com/flex001/user_avatar/forum.modular.com/dunnoconnor/32/1093_2.png) [@dunnoconnor](https://forum.modular.com/u/dunnoconnor)\
**Post date:** [June 13, 2026, 12:27am UTC](https://forum.modular.com/t/max-llm-tutorial-bug/3225/4 "2026-06-13T00:27:02Z")

</div>

Fix is in and I confirmed that it’s serving correctly again. Don’t hesitate to raise any questions you have as you read through it here!

> <https://github.com/modular/max-llm-book/commit/bf718a747421a7197623f63458f753f1168cb727>
>
> The book's custom GPT-2 architecture no longer served on the current MAX
> nightly…. Several serving defaults changed since the tutorial was
> written:
> 
> \- The experimental \`max.nn.Module.compile()\` path no longer
> auto-discovers
> the built-in \`.mojoc\` kernel packages, so \`max serve\` failed with
> "failed to resolve built-in kernel package paths". Set
> \`MODULAR\_MOJO\_MAX\_IMPORT\_PATH\` via \`\[activation.env\]\` in \`pixi.toml\`.
> 
> \- The overlap scheduler and device graph capture are now auto-enabled
> for
> GPU text-generation architectures, including custom ones. Neither is
> supported by this teaching model's eager, full-sequence execution path
> (no \`capture()\` hook; a ragged 1-D input contract that bypasses
> \`execute()\`). Pin the simple text-generation pipeline with
> \`--no-enable-overlap-scheduler --no-device-graph-capture --force\`
> (\`--force\` is required because the overlap scheduler is otherwise
> re-enabled during startup).
> 
> Update the \`serve\` task and reconcile the documented \`max serve\` command
> in
> \`serve\_first.md\`, \`step\_12.md\`, and \`claude.md\` to match, explaining the
> new
> flags alongside the existing \`required\_arguments\` discussion. Switch the
> model id from the deprecated \`gpt2\` alias to the canonical
> \`openai-community/gpt2\` across prose and API examples.
> 
> MAX\_LLM\_BOOK\_ORIG\_REV\_ID: 150c0c3ee30a37cdbf3e4cc70ac52bd3c65ab8c8

---

<div class="post-metadata">

**Author:** ![alix](https://avatars.discourse-cdn.com/v4/letter/a/f6c823/32.png) [@alix](https://forum.modular.com/u/alix)\
**Post date:** [June 13, 2026, 6:18am UTC](https://forum.modular.com/t/max-llm-tutorial-bug/3225/5 "2026-06-13T06:18:58Z")

</div>

I can play with it again , thanks a lot !
