{"id":37083531,"url":"https://github.com/torchql/torchql","last_synced_at":"2026-01-14T10:11:32.216Z","repository":{"id":214351327,"uuid":"736048716","full_name":"TorchQL/torchql","owner":"TorchQL","description":"TorchQL is a query language for Python-based machine learning models and datasets.","archived":false,"fork":false,"pushed_at":"2024-05-01T00:37:38.000Z","size":23878,"stargazers_count":10,"open_issues_count":1,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-11-28T06:46:40.556Z","etag":null,"topics":["machine-learning","ml","python-package","pytorch","query-language"],"latest_commit_sha":null,"homepage":"https://torchql.github.io/torchql/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TorchQL.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}},"created_at":"2023-12-26T20:54:10.000Z","updated_at":"2025-09-05T02:00:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"38366e00-0e07-4f23-b4cb-40f37c47084b","html_url":"https://github.com/TorchQL/torchql","commit_stats":{"total_commits":8,"total_committers":2,"mean_commits":4.0,"dds":0.125,"last_synced_commit":"0698234c459a4572a56b884275e5ccddd65ad1fd"},"previous_names":["torchql/torchql"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/TorchQL/torchql","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TorchQL%2Ftorchql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TorchQL%2Ftorchql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TorchQL%2Ftorchql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TorchQL%2Ftorchql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TorchQL","download_url":"https://codeload.github.com/TorchQL/torchql/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TorchQL%2Ftorchql/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28416659,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T08:38:59.149Z","status":"ssl_error","status_checked_at":"2026-01-14T08:38:43.588Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["machine-learning","ml","python-package","pytorch","query-language"],"created_at":"2026-01-14T10:11:31.683Z","updated_at":"2026-01-14T10:11:32.197Z","avatar_url":"https://github.com/TorchQL.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TorchQL\n\nTorchQL is a query language for Python-based machine learning models and datasets.\n\n## Demo\n\nTry TorchQL using our demo in this [colab notebook](https://colab.research.google.com/drive/1dXsyx20GK6OXuRsQzwANlZzu_0mFqtrZ).\n\n\n## Installation\n\nThe easiest way to install TorchQL is as a Python package:\n```bash\npip install torchql\n```\n\nAlternatively, install TorchQL from source to contribute and keep up with the latest updates:\n```bash\ngit clone https://github.com/TorchQL/torchql.git\ncd torchql\n\npip install . # add the -e option to install an editable version of the package\n```\n\n## Writing your first query\n\nHere is a simple example of a query that can be written in TorchQL.  It loads the MNIST training dataset and extracts\nsamples with the label equal to 7.\n\nFirst, we set up a TorchQL database:\n\n```python\nfrom torchvision import datasets\n\nfrom torchql import Database, Query\n\n\ntrain_data = datasets.MNIST(\n        root = 'data',\n        train = True,\n        download = True,\n    )\n\n\ndb = Database(\"mnist\")\ndb.register_dataset(train_data, \"train\")\n```\n\nObserve that we can directly instantiate a TorchQL table from the PyTorch MNIST train dataset.\nNext, we write the query and execute it on this dataset:\n\n```python\nq = Query('seven', base='train').filter(lambda img, label : label == 7)\nprint(q(db).sample())\n```\n\nThe TorchQL `Query` object is instantiated with a name (here `seven`), and a base table over which operations\ncan be specified (here `train`).\nWe then specify a `filter` operation to only keep the records that have the label as 7.\nEach record contains an image and its label.\n\nWe run this query on the database using `q(db)`, and randomly sample a single record from the resulting table.\nThis is the output of running the above code:\n```\nFiltering: 100%|██████████| 60000/60000 [00:00\u003c00:00, 992096.76it/s]\n\n(\u003cPIL.Image.Image image mode=L size=28x28\u003e, 7)\n```\n\nPlease refer to the documentation and the demo for in-depth description of each functionality of TorchQL.\n\n\n## Documentation\n\nYou can find more documentation on TorchQL [here](https://torchql.github.io/torchql/).\n\n## Papers\n\n```\n@inproceedings{naik2023torchql,\n      title={TorchQL: A Programming Framework for Integrity Constraints in Machine Learning},\n      author={Aaditya Naik and Adam Stein and Yinjun Wu and Mayur Naik and Eric Wong},\n      booktitle={OOPSLA}\n      year={2024}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftorchql%2Ftorchql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftorchql%2Ftorchql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftorchql%2Ftorchql/lists"}