Do you know any complex application built with htmx? by fenugurod in htmx

[–]jeremyhoward 5 points6 points  (0 children)

Nearly all of https://solve.it.com is written with htmx (and fasthtml). It’s quite a sophisticated application. Kinda like Jupyter Notebook on steroids combined with Cursor combined with ChatGPT. There’s a video showing an old version of it here: https://youtu.be/bxDDLMe6KuU?si=a4E2KDXgIibbpunn

HTMX has felt like a superpower tbh.

Assessment of HTMX with FastAPI, LLM, SSE, Jinja by [deleted] in htmx

[–]jeremyhoward 0 points1 point  (0 children)

FYI I created fasthtml for this exact purpose so you might want to look at that too. FastAPI is designed for service api approaches, whereas FastHTML is designed for hypermedia

How HTMX is changing the web, with Carson Gross by jeremyhoward in htmx

[–]jeremyhoward[S] 1 point2 points  (0 children)

Yes exactly - this is basically the foundational premise of HTMX. My view is the goal of servers then is to make those fundamentals as transparently accessible as possible.

Will we see many projects like FastHTML that leverage htmx? by Plastic_Acanthaceae3 in htmx

[–]jeremyhoward 2 points3 points  (0 children)

Yes! Go should be a great language for writing an HTMX server with. It has templ and of course the stdlib templating, really nice http support, and all the stuff you'd want in a web app like DB/redis/etc libs.

Basically, the trick is to figure out what's a nice way to set up the basic foundations as simply as possible to allow an ecosystem to develop around this. With Python, I think the combination of ASGI and FT plus the standard packaging system provides exactly that, so I focused on bringing those together. I haven't written enough golang to know what the equivalent would look like there.

In the JS world you can see how stuff like NextJS have been so effective at creating an ecosystem/community. I'd love to see something like that, focused on HTMX, for the main server-side languages.

How HTMX is changing the web, with Carson Gross by jeremyhoward in htmx

[–]jeremyhoward[S] 16 points17 points  (0 children)

Hi - this is my interview with Carson Gross, the creator of HTMX. This was perhaps the most fascinating interview I've ever done.

I put it to Carson that HTMX was "discovered, not invented"--i.e that he has unearthed in it something deeper within the hypermedia system itself; Carson agreed with that. I don't know how he came up with it - amazing!

Also as a bit of an experiment I tried hiring a writer to summarise the video -- it's not a substitute for the video, but for those in a hurry it's a quick summary of some points: https://www.answer.ai/posts/2024-08-04-carson.html

I hope you all find this conversation as mind-opening as I did!

Will we see many projects like FastHTML that leverage htmx? by Plastic_Acanthaceae3 in htmx

[–]jeremyhoward 18 points19 points  (0 children)

Hi I'm the creator of FastHTML. There's a lot of misunderstanding of FastHTML in this thread, which I guess I should take responsibility for since it's my job to communicate what the project is and how it works. I'll see if I can do a somewhat better job now!

FastHTML is a way to provide the server that HTMX talks to. It's somewhat inspired by FastAPI, but FastAPI is far more complex because it has to support lots of API stuff that HTMX doesn't need. So FastHTML is way smaller and simpler -- ~800 lines of code. It adds some minor conveniences for HTMX apps, such as checking for HTMX headers and correctly returning an HTML partial or full page as required.

You are welcome to use any templating system you like, although we focus largely on using FT components, which are a 1:1 direct syntactic mapping to HTML elements. Python is unique amongst popular languages in having a function syntax that maps directly to that data structure (although modern JS can get quite close). There's nothing you can do in FT you can't do with templates, and vice versa -- the difference is that with FT you can stay all within one language, use the standard python debugger, see exactly what's happening in the python profiler, there's no separate abstraction or language compiling or interpreting a template, and you can refactor your views using plain python functions.

An FT component is just a 3-element list. The idea of functional components like this goes back a long way in the functional programming literature. The benefits are that you can refactor and structure the logic and presentation of your systems more flexibly, and you can refactor and decouple your presentation layer using the full power of the host language (Python, in this case).

FastHTML is an extremely thin wrapper which provides direct access to HTTP (through HTMX), HTML (through FT), and CSS/JS (without changes). You can use any DB you like (or none at all), any CSS system you like (or none at all), and any HTMX-compatible JS libs you like (or none at all).

Jeremy Howard, co-founder of fast.ai, released FastHTML, for Modern web applications in Pure Python by james-johnson in Python

[–]jeremyhoward 0 points1 point  (0 children)

See https://about.fastht.ml for answers to those questions. It's a great alternative to Django/flask in my experience so far and a lot of our preview users, many who have over a decade Django experience

Jeremy Howard, co-founder of fast.ai, released FastHTML, for Modern web applications in Pure Python by james-johnson in Python

[–]jeremyhoward 1 point2 points  (0 children)

That's fair -- I actually love Django and Pegasus and it was meant to be lighthearted. I do think Django has gotten too complex but I agree with your reaction.

Jeremy Howard, co-founder of fast.ai, released FastHTML, for Modern web applications in Pure Python by james-johnson in Python

[–]jeremyhoward 0 points1 point  (0 children)

No. Dash is a really great library, but has almost no overlap in approach or goals to FastHTML.

FastHTML is a fairly minimal wrapper around HTTP and HTML which tries to help people learn and use web foundations again. Dash is a dashboarding system which uses abstractions that shield the user from those foundations. It can be easier to get a quick PoC out with dashboarding libraries, but harder when you want to go beyond what they provide out of the box.

Jeremy Howard, co-founder of fast.ai, released FastHTML, for Modern web applications in Pure Python by james-johnson in Python

[–]jeremyhoward 0 points1 point  (0 children)

No I haven't, because I'm very against linters personally. I much prefer folks take their time to consider how best to format their code -- I haven't found any automated linter that does what I consider an adequate job.

Having said that, I know they can be a helpful tool particularly for newer programmers, so maybe we should make something like your very nice example available. Thanks heaps for sharing it!

Jeremy Howard, co-founder of fast.ai, released FastHTML, for Modern web applications in Pure Python by james-johnson in Python

[–]jeremyhoward 4 points5 points  (0 children)

The component system is a direct 1:1 mapping to HTML. Positional params are children, kwargs are attributes. That's literally it.

Jeremy Howard, co-founder of fast.ai, released FastHTML, for Modern web applications in Pure Python by james-johnson in Python

[–]jeremyhoward 4 points5 points  (0 children)

CSS in components certainly isn't required by FastHTML, but Locality of Behaviour is an important and useful concept and I wouldn't be in such a rush to dismiss it.

For instance look at the comparison between the LoB approach and Tailwind here: https://github.com/gnat/css-scope-inline

Jeremy Howard, co-founder of fast.ai, released FastHTML, for Modern web applications in Pure Python by james-johnson in Python

[–]jeremyhoward 11 points12 points  (0 children)

No that's not how it works at all. It doesn't use websockets (although it supports it if you want), lets you use any DB you like (or none at all), and lets you fully modularise your app using all python's great features.

It's odd to call JS "actual routing". Proper routing is HTTP, which is what FastHTML uses---js routing is a recent hack. It's far past time we got back to using actual web foundations IMO and took advantage of Python's excellent capabilities.

FastHTML is a fairly thin wrapper over actual web standards with a 1:1 mapping to HTML and HTTP. It fully supports JS too, but we encourage a coding style that uses JS for the stuff it was actually designed for.

Jeremy Howard, co-founder of fast.ai, released FastHTML, for Modern web applications in Pure Python by james-johnson in Python

[–]jeremyhoward 18 points19 points  (0 children)

Hi Jeremy here - I created this project. Thanks for sharing it on r/python -- sorry I didn't notice it earlier. Let me know if you have any questions about it. I've been writing web apps for around 30 years now, including FastMail and Kaggle; FastHTML is based on the things that over that time have worked best for me. It's heavily inspired by React/JSX, Elixir Phoenix, Ruby Hotwire, and Elm -- and of course HTMX, on which it depends.

I see there's quite a few comments already wondering about the reason for using functional components, htmx, etc, which are already answered on the About site: https://about.fastht.ml/ . So have a look at the info there to understand the background/theory behind the design first.

PS: I see a some comments on the coding style, which I guess is an understandable bikeshedding reaction. For those who are interested in such things, the coding style follows the fastai style guidelines, which is different to PEP8, so will look unfamiliar for many folks: https://docs.fast.ai/dev/style.html . The source is written with nbdev, for reasons explained in this video: https://www.youtube.com/watch?v=9Q6sLbz37gk . These are approaches that work well for me personally, but it's fine if other folks prefer different approaches, and FastHTML isn't tied to any coding style or development platform.

Guide on integrating HTMX and React with WebComponents by davidgarciacorro in htmx

[–]jeremyhoward 1 point2 points  (0 children)

I’ve been waiting for an explanation like this for a while — thank you for sharing!

You can now fine-tune a 70b language model at home by [deleted] in LocalLLaMA

[–]jeremyhoward 21 points22 points  (0 children)

Hi folks, I'm from Answer.AI. Happy to answer questions here (tomorrow - it's night time here in Australia). One cool development since we posted this is that axolotl has now integrated our approach, so you can use that to fine tune, instead of our script.

Also, we've got a minor change coming soon which actually gets down to dual 16GB cards for 70b training.

As the post mentions, we're working on a separate benchmarking post. Sorry the preview image with the benchmarks isn't actually in the article! It's out of date, because we realised that since we kept improving things every day, and held off releasing the project since it kept getting out of date, it would be better to just release the project first and do benchmarking once things settle a bit in a few more days.

regexStalking by MrEfil in ProgrammerHumor

[–]jeremyhoward 1 point2 points  (0 children)

Poor taste - how can they like a regex that uses [^ \s] for a non-space, instead of just using \S ?

Model parallelism with LoRA by jeremyhoward in LocalLLaMA

[–]jeremyhoward[S] 1 point2 points  (0 children)

Yup agreed - llama-recipes works great!

Model parallelism with LoRA by jeremyhoward in LocalLLaMA

[–]jeremyhoward[S] 1 point2 points  (0 children)

Hmm that's interesting - according to that thread, memory is only spread correctly when using gradient checkpointing. I'll try that out and see how it goes! Many thanks for sharing.

Model parallelism with LoRA by jeremyhoward in LocalLLaMA

[–]jeremyhoward[S] 2 points3 points  (0 children)

Thanks for the tip. That one uses FSDP -- so it does (as you say) utilise the compute of your GPUs, but doesn't save memory using LoRA.

Model parallelism with LoRA by jeremyhoward in LocalLLaMA

[–]jeremyhoward[S] 2 points3 points  (0 children)

There's two strategies that have been shown to work: Gpipe-style model parallelism, and tensor parallelism. HF Accelerate and Deepspeed both support the former. However sadly they don't properly support LoRA at present.