{"id":37073425,"url":"https://github.com/tungsten-ai/tungstenkit","last_synced_at":"2026-01-14T08:37:07.232Z","repository":{"id":170601497,"uuid":"646788108","full_name":"tungsten-ai/tungstenkit","owner":"tungsten-ai","description":"ML container made simple","archived":false,"fork":false,"pushed_at":"2024-06-06T23:56:28.000Z","size":2321,"stargazers_count":25,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-06-07T22:53:05.863Z","etag":null,"topics":["ai","deep-learning","docker","machine-learning","ml","model-deployment","model-management"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tungsten-ai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-29T10:45:08.000Z","updated_at":"2024-06-06T23:56:31.000Z","dependencies_parsed_at":"2024-06-06T22:45:39.113Z","dependency_job_id":"5d7c610d-ed98-4c8e-9449-1c449afd4908","html_url":"https://github.com/tungsten-ai/tungstenkit","commit_stats":null,"previous_names":["tungsten-ai/tungstenkit"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tungsten-ai/tungstenkit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tungsten-ai%2Ftungstenkit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tungsten-ai%2Ftungstenkit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tungsten-ai%2Ftungstenkit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tungsten-ai%2Ftungstenkit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tungsten-ai","download_url":"https://codeload.github.com/tungsten-ai/tungstenkit/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tungsten-ai%2Ftungstenkit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28414667,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T08:31:27.429Z","status":"ssl_error","status_checked_at":"2026-01-14T08:31:19.098Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","deep-learning","docker","machine-learning","ml","model-deployment","model-management"],"created_at":"2026-01-14T08:37:06.640Z","updated_at":"2026-01-14T08:37:07.219Z","avatar_url":"https://github.com/tungsten-ai.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tungstenkit: ML container made simple\n[![Version](https://img.shields.io/pypi/v/tungstenkit?color=%2334D058\u0026label=pypi%20package)](https://pypi.org/project/tungstenkit/)\n[![License](https://img.shields.io/github/license/tungsten-ai/tungstenkit)](https://raw.githubusercontent.com/tungsten-ai/tungstenkit/main/LICENSE)\n[![Downloads](https://static.pepy.tech/badge/tungstenkit?style=flat-square)](https://pypi.org/project/tungstenkit/)\n[![Supported Python versions](https://img.shields.io/pypi/pyversions/tungstenkit.svg?color=%2334D058)](https://pypi.org/project/tungstenkit/)\n\n[Introduction](#tungstenkit-ml-container-made-simple) | [Installation](#prerequisites) | [Documentation](#documentation) | [Community](#join-our-community)\n\n**Tungstenkit** is ML containerization tool with a focus on developer productivity and versatility. \n\nHave you ever struggled to use models from github?\nYou may have repeated tedious steps like: cuda/dependency problems, file handling, and scripting for testing.\n\nStanding on the shoulder of Docker, this project aims to make using ML models less painful by adding functionalities for typical use cases - REST API server, GUI, CLI, and Python script.\n\nWith Tungstenkit, sharing and consuming ML models can be quick and enjoyable.\n\n\n## Features\n- [Requires only a few lines of Python code](#requires-only-a-few-lines-of-python-code)\n- [Build once, use everywhere](#build-once-use-everywhere):\n    - [REST API server](#rest-api-server)\n    - [GUI application](#gui-application)\n    - [CLI application](#cli-application)\n    - [Python function](#python-function)\n- [Framework-agnostic and lightweight](#framework-agnostic-and-lightweight)\n- [Pydantic input/output definitions with convenient file handling](#pydantic-inputoutput-definitions-with-convenient-file-handling)\n- [Supports batched prediction](#supports-batched-prediction)\n- Supports clustering with distributed machines (coming soon)\n\n## Take the tour\n### Requires only a few lines of python code\nBuilding a Tungsten model is easy. All you have to do is write a simple ``tungsten_model.py`` like:\n\n```python\nfrom typing import List\nimport torch\nfrom tungstenkit import BaseIO, Image, define_model\n\n\nclass Input(BaseIO):\n    prompt: str\n\n\nclass Output(BaseIO):\n    image: Image\n\n\n@define_model(\n    input=Input,\n    output=Output,\n    gpu=True,\n    python_packages=[\"torch\", \"torchvision\"],\n    batch_size=4,\n    gpu_mem_gb=16,\n)\nclass TextToImageModel:\n    def setup(self):\n        weights = torch.load(\"./weights.pth\")\n        self.model = load_torch_model(weights)\n\n    def predict(self, inputs: List[Input]) -\u003e List[Output]:\n        input_tensor = preprocess(inputs)\n        output_tensor = self.model(input_tensor)\n        outputs = postprocess(output_tensor)\n        return outputs\n\n```\n\nStart a build process:\n\n```console\n$ tungsten build . -n text-to-image\n\n✅ Successfully built tungsten model: 'text-to-image:e3a5de56'\n```\n\nCheck the built image:\n```\n$ tungsten models\n\nRepository        Tag       Create Time          Docker Image ID\n----------------  --------  -------------------  ---------------\ntext-to-image     latest    2023-04-26 05:23:58  830eb82f0fcd\ntext-to-image     e3a5de56  2023-04-26 05:23:58  830eb82f0fcd\n```\n\n### Build once, use everywhere\n\n#### REST API server\n\nStart a server:\n\n```console\n$ tungsten serve text-to-image -p 3000\n\nINFO:     Uvicorn running on http://0.0.0.0:3000 (Press CTRL+C to quit)\n```\n\nSend a prediction request with a JSON payload:\n\n```console\n$ curl -X 'POST' 'http://localhost:3000/predictions' \\\n  -H 'Accept: application/json' \\\n  -H 'Content-Type: application/json' \\\n  -d '[{\"prompt\": \"a professional photograph of an astronaut riding a horse\"}]'\n\n{\n    \"prediction_id\": \"39c9eb6b\"\n}\n```\n\nGet the result:\n```console\n$ curl -X 'GET' 'http://localhost:3000/predictions/39c9eb6b' \\\n  -H 'Accept: application/json'\n\n{\n    \"outputs\": [{\"image\": \"data:image/png;base64,...\"}],\n    \"status\": \"success\"\n}\n```\n\n\n#### GUI application\nIf you need a more user-friendly way to make predictions, start a GUI app with the following command:\n\n```console\n$ tungsten demo text-to-image -p 8080\n\nINFO:     Uvicorn running on http://localhost:8080 (Press CTRL+C to quit)\n```\n\n![tungsten-dashboard](https://github.com/tungsten-ai/assets/blob/main/common/local-model-demo.gif?raw=true \"Demo GIF\")\n\n#### CLI application\nRun a prediction in a terminal:\n```console\n$ tungsten predict text-to-image \\\n   -i prompt=\"a professional photograph of an astronaut riding a horse\"\n\n{\n  \"image\": \"./output.png\"\n}\n```\n\n#### Python function\nIf you want to run a model in your Python application, use the Python API:\n```python\n\u003e\u003e\u003e from tungstenkit import models\n\u003e\u003e\u003e model = models.get(\"text-to-image\")\n\u003e\u003e\u003e model.predict(\n    {\"prompt\": \"a professional photograph of an astronaut riding a horse\"}\n)\n{\"image\": PosixPath(\"./output.png\")}\n```\n\n### Framework-agnostic and lightweight\nTungstenkit doesn't restrict you to use specific ML libraries. Just use any library you want, and declare dependencies:\n\n```python\n# The latest cpu-only build of Tensorflow will be included\n@define_model(gpu=False, python_packages=[\"tensorflow\"])\nclass TensorflowModel:\n    def predict(self, inputs):\n        \"\"\"Run a batch prediction\"\"\"\n        # ...ops using tensorflow...\n        return outputs\n```\n\n### Pydantic input/output definitions with convenient file handling\nLet's look at the example below:\n```python\nfrom tungstenkit import BaseIO, Image, define_model\n\n\nclass Input(BaseIO):\n    image: Image\n\n\nclass Output(BaseIO):\n    image: Image\n\n\n@define_model(input=Input, output=Output)\nclass StyleTransferModel:\n    ...\n```\nAs you see, input/output types are defined as subclasses of the ``BaseIO`` class. The ``BaseIO`` class is a simple wrapper of the [``BaseModel``](https://docs.pydantic.dev/latest/usage/models/) class of [Pydantic](https://docs.pydantic.dev/latest/), and Tungstenkit validates JSON requests utilizing functionalities Pydantic provides.\n\nAlso, you can see that the ``Image`` class is used. Tungstenkit provides four file classes for easing file handling - ``Image``, ``Audio``, ``Video``, and ``Binary``. They have useful methods for writing a model's ``predict`` method:\n\n```python\nclass StyleTransferModel:\n    def predict(self, inputs: List[Input]) -\u003e List[Output]:\n        # Preprocessing\n        input_pil_images = [inp.image.to_pil_image() for inp in inputs]\n        # Inference\n        output_pil_images = do_inference(input_pil_images)\n        # Postprocessing\n        output_images = [Image.from_pil_image(pil_image) for pil_image in output_pil_images]\n        outputs = [Output(image=image) for image in output_images]\n        return outputs\n```\n\n### Supports batched prediction\nTungstenkit supports both server-side and client-side batching.\n\n- **Server-side batching**  \n    \u003c!-- Explain more? Mention hashing? --\u003e\n    A server groups inputs across multiple requests and processes them together.\n    You can configure the max batch size:\n    ```python\n    @define_model(input=Input, output=Output, gpu=True, batch_size=32)\n    ```\n    The max batch size can be changed when running a server:\n    ```console\n    $ tungsten serve mymodel -p 3000 --batch-size 16\n    ```\n\n- **Client-side batching**  \n    Also, you can reduce traffic volume by putting multiple inputs in a single prediction request:\n    ```console\n    $ curl -X 'POST' 'http://localhost:3000/predictions' \\\n      -H 'accept: application/json' \\\n      -H 'Content-Type: application/json' \\\n      -d '[{\"field\": \"input1\"}, {\"field\": \"input2\"}, {\"field\": \"input3\"}]'\n    ```\n\n## Prerequisites\n- Python 3.7+\n- [Docker](https://docs.docker.com/get-docker/)\n\n## Installation\n```shell\npip install tungstenkit\n```\n\n## Documentation\n- [Getting Started](https://tungsten-ai.github.io/docs/getting_started/installation/)\n- [Building Your Model](https://tungsten-ai.github.io/docs/building_your_model/model_definition/)\n- [Running Models](https://tungsten-ai.github.io/docs/running_models/using_gpus/)\n- [Pushing and Pulling Models](https://tungsten-ai.github.io/docs/pushing_and_pulling_models/pushing/)\n- [CLI Reference](https://tungsten-ai.github.io/docs/cli_reference/)\n- [REST API Reference](https://tungsten-ai.github.io/docs/rest_api_reference/)\n- [Examples](https://tungsten-ai.github.io/docs/examples/image_blurring/)\n\n## Join our community\nIf you have questions about anything related to Tungstenkit, you're always welcome to ask our community on [Discord](https://discord.gg/NESFeXzFuy).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftungsten-ai%2Ftungstenkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftungsten-ai%2Ftungstenkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftungsten-ai%2Ftungstenkit/lists"}