Model or dataset
thu-pacman/chitu avatar
thu-pacman/chitu

Chitu validates its own build arguments in four Docker layers

High-performance inference framework for large language models, focusing on efficiency, flexibility, and availability.

3,006 stars252 forksPythonApache-2.0

At a glance

What is it?
Chitu is a Python inference engine for large models that ships separate Dockerfiles for four GPU vendors and a build script that makes itself the preferred victim of the out-of-memory killer. The packaging is unusual in ways that are all traceable to the same thing: the project targets non-NVIDIA accelerators whose vendor tooling does not fit the usual Linux conventions. The readme is in Chinese, 172 words long, and contains no performance numbers at all.
Who is it for?
Chitu fits a team deploying models on Chinese accelerator hardware as well as on the usual vendor cards, and willing to build the extension layer themselves rather than take a prebuilt wheel. Two things to check first.
Can I use it commercially?
Yes. Apache-2.0 is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository received new commits within the last day.
What is it written in?
Mainly Python, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 23, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • thu-pacman/chitu3,006 ★ · +6
Star history
Repository2026-09-102026-11-23
thu-pacman/chitu3k3k

6 Stars in the last 74 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

The default branch is not called main

Small thing first: the branch this project publishes from is named with a public prefix, not the conventional name. Every link in the readme, every documentation path and every download instruction is written against that branch, and the release tags are cut from it.

That matters more than it sounds. Scripts that clone a repository and assume the conventional branch name, and automation that resolves a default branch by hardcoding a name, both break on this one, and the failure is a clone that succeeds and then has nothing in it.

The rest of the repository shape follows the same pattern of deliberate divergence. The readme is in Chinese with an English version maintained separately under the documentation directory rather than at the repository root. The documentation set has parallel Chinese and English paths for the development manual, the supported model list, the contribution guide and the frequently asked questions, and the performance data lives in its own document that the readme links to instead of summarising.

Which brings up the thing you will look for first. There are no performance figures in the readme. Not a throughput number, not a latency number, not a comparison. It points at a performance document, invites people to post their own measurements in a discussion, and warns that results depend on your hardware configuration, your software versions and your workload, and that repeated runs may vary.

The build uses a GPU extension mechanism instead of CMake

The build script opens with a comment that answers the question every C++ extension project gets asked, and the answer here is unusual.

It says they use the GPU extension mechanism from the deep learning framework instead of CMake for native sources, because many of the non-NVIDIA GPUs have their own custom extension mechanism but not their own custom CMake support.

So the build system choice is not a preference for a tool. It is a consequence of the hardware matrix. The same comment explains why there are separate Dockerfiles per vendor further down, and why the setup script has conditional logic keyed on environment variables for two specific vendors: if either of those build flags is set, the list of native extensions is left empty rather than built.

The rest of the file follows the same logic of accommodating the ecosystem. It requires the deep learning framework at import time and refuses with a clear message if it is missing, including an example of installing the right build for a particular accelerator version. It imports Cython and compiles some of the Python-side kernels with it, and it has an explicit list of files that must not go through that compilation step, gathered by globbing the kernel directories.

A version requirement enforced with an assert

The build script checks its own tooling with an assertion rather than with a dependency declaration.

It parses the installed setuptools version and compares it against a floor, with a message explaining that the floor is required for wildcard patterns in package data. So a too-old setuptools produces an assertion failure during the build.

An assertion is the wrong tool for that, and it is worth being precise about why. Assertions are removed when the interpreter runs with optimisations enabled. Any packaging environment, container base image or release script that sets that flag turns this version check off, and the build proceeds to fail later, somewhere less legible, when the wildcard expansion does not do what the package expects.

The file is otherwise careful in the same area. It declares the accelerator build flags as environment variables with explicit zero defaults, so an unset flag and a flag set to false behave the same, and it checks both of them with a single condition before deciding whether to build native extensions at all.

The build script volunteers to be killed first

There is a block in the build script that is worth reading twice, because it is unlike anything else in the file.

python
    pid = os.getpid()
    with open(f"/proc/{pid}/oom_score_adj", "w") as f:
        f.write("1000")

It gets the current process identifier, opens that process's entry under the kernel's out-of-memory scoring interface, and writes the maximum acceptable value into it. The comment above it explains the reasoning: in case of an out-of-memory condition, make the out-of-memory killer more likely to kill this process and less likely to let the system hang.

So the build deliberately raises its own kill priority. The practical effect is that a build that exhausts memory dies promptly and the machine recovers, instead of thrashing until something else gives. It is wrapped in a try block that prints a message if it cannot do it, which matters because the interface it writes to only exists on Linux and only for a process that is allowed to write it.

It is a small piece of engineering, and it is the clearest signal in the repository about how the project thinks: the failure mode is considered, named, and handled at the point where it happens.

Four vendor Dockerfiles and four layers that check build arguments

The container story is four files, and the names give the hardware matrix away: one for the default path, one for the first domestic accelerator, a second one for a variant of that same accelerator, and one each for two more vendors.

The default container starts from a deep learning framework image with a pinned framework version, a pinned accelerator toolkit major version and a pinned runtime library version. It then declares the list of GPU architectures to build for, and that default list runs from an older architecture through a recent one and ends with a forward-compatible entry. The newest architecture is not in the list.

That is what the build-argument checking is for. There are four separate validation steps, each one a shell test that exits with a message when two arguments disagree. One requires a flag to be set when the architecture list contains the newest generation and unset when it does not. One requires the Cython flag to be exactly one of two values. One does the same for the test flag. Each is its own layer, so a build that gets the arguments wrong pays four layers before it fails.

There is also an argument for a package index mirror and one for a comma-separated list of optional accelerated dependencies, the default being three flash-attention-related packages.

Conditional environment variables, done with duplicated stages

One comment in the container file explains a structural oddity better than any amount of guessing would.

It says that because a container file does not support setting an environment variable conditionally, separate stages are used. And then there are two stages, both inheriting from the same base, differing only in two variables each. One sets a flag to zero and another to one. The other sets the same flag to one and the other to zero.

The flag in question is a disable switch for one attention implementation on the newest hardware generation, and the second variable is a switch for a four-bit numeric format. So the container decides at build time, by which stage you entered through, whether the newest-generation code paths are live.

That is a workaround with a cost, and the cost is that the base layer is inherited twice. Anything expensive in the base is built once and reused through the cache, so the duplication is cheap in practice. But it does mean reading the container file means reading two near-identical stages, and the comment above them is the only thing that tells you why they exist.

The readme admits it cannot answer issues in time, then sells support

The introduction section is where the project's own limits are stated, and it is unusually direct.

After thanking users and the community for their suggestions and saying the engine will keep being improved, it says that constrained by the energy of the team members, it cannot guarantee timely resolution of all the problems users encounter. It then gives an email address for professional technical services.

That is a two-part statement about the project. The code is open source under a permissive licence, and the maintainers are telling you in the readme that issue response time is not something they have promised, while pointing at a paid channel for people who need it. Plenty of projects would phrase that only in a contributing guide or a support page.

The acknowledgements are similarly specific. The thanks list names hardware vendors, model providers, a telecom operator and a computing company, and the reuse list names eight upstream projects from which functions were taken, including three other inference servers and a quantisation-focused project. Four of those eight are themselves complete inference frameworks, which tells you how much of this project's speed comes from elsewhere and how honest the attribution is about it.

Editorial conclusion

Chitu fits a team deploying models on Chinese accelerator hardware as well as on the usual vendor cards, and willing to build the extension layer themselves rather than take a prebuilt wheel. Two things to check first. Read the build script rather than the readme, because the choice of extension mechanism over CMake, the deliberate out-of-memory self-sacrifice, and four Docker layers that exist only to validate build arguments are all load-bearing decisions that the readme does not mention. And check the hardware support list for your card before anything else, since the default architecture list in the container stops at the generation before the newest one and you have to opt in by hand.

Frequently asked questions

What does chitu mean?

Usually a South Indian word for a spotted pony, and that is what almost every result for the name returns. This repository is unrelated: it is a Python inference engine for large language models, named with a Chinese translation in its title, built and documented for a Chinese audience.

What are the benefits of using chitu?

The readme states three, all about deployment rather than model quality: adaptation across compute, from the newest flagship cards down to older series plus optimised support for domestic chips; scalability from pure CPU through single GPU to large clusters; and stability sufficient to carry concurrent production traffic.

How fast is Chitu?

The readme gives no numbers at all. It points at a performance document maintained by the developers, invites people to post their own measurements in a discussion thread, and warns that results depend on hardware configuration, software versions and test workload, and that repeated runs may vary.

Which GPUs does Chitu support?

The readme says it supports a range of the dominant vendor's cards and adds optimised support for domestic chips, and the repository carries four separate container files, one default and one per vendor including two variants of the same accelerator. The milestone list names DeepSeek, Qwen, GLM and Kimi models as supported.

Can I get support for Chitu?

The readme says the team cannot guarantee timely resolution of issues because of limited capacity, and gives an email address for professional technical services. The code itself is under a permissive licence, with reused upstream snippets marked by SPDX headers and their licences collected in a dedicated directory.

Official sources

  1. License: Apache-2.0
  2. Project website
  3. README
  4. Releases
  5. thu-pacman/chitu on GitHub
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/thu-pacman-chitu.svg)](https://hysenlabs.com/projects/thu-pacman-chitu)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/thu-pacman-chitu.svg)](https://hysenlabs.com/projects/thu-pacman-chitu)

Was this useful?