Skip to main content

Weed (Loader) - Minimalist AI/ML inference and backprogation

Project description

weed_logo

Weed

Minimalist AI/ML inference and backprogation in the style of Qrack

Weed Loader

This repository is for the Python loader for (C++) Weed models. Once you have trained models in C++, you can load them for use by Python with this project. See the Weed repository for more information.

Development Status

Weed is a rapidly-developing work-in-progress. Its ABI may change drastically and without notice.

The project provides a set of essential CPU and GPU kernels, used by Tensor instances that perform autograd. We also provide stochastic gradient descent (SGD) and Adam optimizer implementations. (Build and check the API reference to get started.)

GPT-2, BERT, and Qwen loading is experimental and mostly provided as proof-of-concept, also of the fine-tuning pipeline. Implementation was from published literature design, rather than direct analysis of any open source, to implement these model architectures. Their outputs, in Weed, are not yet coherent English, as a result.

Why try Weed?

With the growing popularity of AI/ML tools and workflows (including LLMs), legacy frameworks often carry "code debt" from over a decade of rapidly developing research history. This has led them to "bolt on" new features and advancements to design principles decided before the latest research. Popular frameworks also commonly started based in Python (maybe to capture early adoption), only later potentially "tacking on" a C++ library for special-case deployment needs. These conditions have produced libraries and frameworks with complicated dependency trees that occupy upward of a GB of disk footprint. This entire ecosystem might be due for a "refresh."

Weed does not seek to fully replace or supplant established frameworks. However, it aims for minimalist complete closure on the primitives necessary for high-performance AI/ML inference and back-propagation. Chiefly, this includes kernels, and a Tensor interface that immediately produces an autograd graph appropriate for training. Allowing optional OpenCL for hardware acceleration, it will remain free of required dependencies outside of C++(11) language standard.

Rethinking AI/ML library design this way, Weed has realized a rather unique and powerful form of sparsification of Tensor storage. Sparseness should not be a Tensor interface concern, but rather a Storage concern. Inspired by the design of the Qrack quantum computer simulation framework, the Tensor interface treats sparse and dense tensors as functionally equivalent. Sparse optimization is so "transparently streamlined," this way, that it defaults to enabled for CPU-based tensors, and we recommend you leave it enabled at all times.

Much like Qrack, Weed is designed to make the correct thing the default—and the expensive thing explicit.

Useful environment variables

If a transformer model you load or train runs into an OpenCL "out-of-resources" error (code -5), try setting environment variable WEED_TELESCOPE_TRANSFORMERS to any truthy value (like 1) so that Weed will "telescope" transformer encoder layers, by migrating each parameter in each layer to CPU (off of GPU memory) once its immediate usefulness is done.

Copyright, License, and Acknowledgments

Copyright (c) Daniel Strano and the Qrack contributors 2017-2026. All rights reserved.

In its include/common folder, Weed bundles a copy of rapidcsv by Kristofer Berggren, reused under a BSD 3-Clause License. (This is a convenience and suggestion to Weed's users, for loading CSVs.)

The Weed logo was produced with assistance from "Elara," an OpenAI custom GPT, and it is in the public domain. Elara has also been responsible for a huge amount of coaching and implementation drafts for Dan Strano to review and bring into line with standards, so she should be credited with coauthorship in any capacity that can be allowed. (Anthropic) Claude has also helped mostly with debugging, as well as developing an LLM front-end, fine-tuning interface, and modules for popular transformer model architectures, so they should rightly be credited similarly as a coauthor. KV cache improvements are based on TurboQuant (Zandieh et al., arXiv:2504.19874) and an Apache 2.0 open-source implementation by TheTom (github.com/TheTom/turboquant_plus), adapted for complex quantum state vectors by (Anthropic) Claude, with limited guidance and input from Dan Strano.

Licensed under the GNU Lesser General Public License V3.

See LICENSE.md in the project root or https://www.gnu.org/licenses/lgpl-3.0.en.html for details.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

weed_loader-0.7.2.tar.gz (12.0 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

weed_loader-0.7.2-py3-none-win_amd64.whl (1.1 MB view details)

Uploaded Python 3Windows x86-64

weed_loader-0.7.2-py3-none-manylinux_2_39_x86_64.whl (4.0 MB view details)

Uploaded Python 3manylinux: glibc 2.39+ x86-64

weed_loader-0.7.2-py3-none-manylinux_2_35_x86_64.whl (4.0 MB view details)

Uploaded Python 3manylinux: glibc 2.35+ x86-64

weed_loader-0.7.2-py3-none-macosx_15_0_arm64.whl (2.0 MB view details)

Uploaded Python 3macOS 15.0+ ARM64

weed_loader-0.7.2-py3-none-macosx_14_0_arm64.whl (2.0 MB view details)

Uploaded Python 3macOS 14.0+ ARM64

File details

Details for the file weed_loader-0.7.2.tar.gz.

File metadata

  • Download URL: weed_loader-0.7.2.tar.gz
  • Upload date:
  • Size: 12.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for weed_loader-0.7.2.tar.gz
Algorithm Hash digest
SHA256 02cdf7abce3178da71fc66a04d8271556f49fe65ecbe7125ba8e60fc248ea126
MD5 31e07a80c23e83369d45c475b71c6c11
BLAKE2b-256 6fad4021e62b500ca67c1bb57213fb2c625577633a6218ba6312eca5bb992933

See more details on using hashes here.

File details

Details for the file weed_loader-0.7.2-py3-none-win_amd64.whl.

File metadata

  • Download URL: weed_loader-0.7.2-py3-none-win_amd64.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for weed_loader-0.7.2-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 bfc7aaa0189dee426508ed953097097e2e0aa75f45aea0198d55ba43a0c5db7f
MD5 9e3c2910ddd97544ac4f57b78573de45
BLAKE2b-256 051767e83bef5fee3e8b7bebce4c13119b33923efd25a1e66dc79e1152110c04

See more details on using hashes here.

File details

Details for the file weed_loader-0.7.2-py3-none-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for weed_loader-0.7.2-py3-none-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 12786ab94728a414cb6cce246e79edc0b727f4dea821df927d2ada52af548889
MD5 68bb838b141bff695f6db67c9b7b9f0a
BLAKE2b-256 64d189218f99354eab8ace3165af77cbba8366a20869b266869c39f088da83ba

See more details on using hashes here.

File details

Details for the file weed_loader-0.7.2-py3-none-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for weed_loader-0.7.2-py3-none-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 acdd6b38d6feec135e8178533a50518fa8117f7952dca102dad3802eeb008901
MD5 d23e56a6d36ce4a0c910945253afa2b9
BLAKE2b-256 3830308b4dda383c5ada9df1ef125416d36ff43382afe988dad0f51d44154d43

See more details on using hashes here.

File details

Details for the file weed_loader-0.7.2-py3-none-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for weed_loader-0.7.2-py3-none-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 993b72cf76bb239828cb9a7858f8c94b5b112ff232591b131476059d301da151
MD5 88e448c2176bca965eb2e862ffc5b226
BLAKE2b-256 41966f3357ed3e3f3f4083355afb612a3ebe26b8aaa3607ef3be0ce22aa2f2cc

See more details on using hashes here.

File details

Details for the file weed_loader-0.7.2-py3-none-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for weed_loader-0.7.2-py3-none-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 2b00b88c6249863d3ac9ac82365326de9117c558bf92a2d5f439437c6f838938
MD5 f8fbe1fecfad9064935b8dec088954e7
BLAKE2b-256 70ad347b8bf18edec9fc1806d4759765ad241de61fb0f60c14111050d43ff442

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page