autodistill-kosmos-2


Nameautodistill-kosmos-2 JSON
Version 0.1.1 PyPI version JSON
download
home_pagehttps://github.com/autodistill/autodistill-kosmos-2
SummaryKosmos-2 base model for use with Autodistill.
upload_time2024-01-30 21:18:31
maintainer
docs_urlNone
authorRoboflow
requires_python>=3.7
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <div align="center">
  <p>
    <a align="center" href="" target="_blank">
      <img
        width="850"
        src="https://media.roboflow.com/open-source/autodistill/autodistill-banner.png"
      >
    </a>
  </p>
</div>

# Autodistill Kosmos-2 Module

This repository contains the code supporting the Kosmos-2 base model for use with [Autodistill](https://github.com/autodistill/autodistill).

[Kosmos-2](https://github.com/microsoft/unilm/tree/master/kosmos-2), developed by Microsoft, is a multimodal language model that you can use for zero-shot object detection. You can use Kosmos-2 with autodistill for object detection.

Read the full [Autodistill documentation](https://autodistill.github.io/autodistill/).

Read the [Kosmos-2 Autodistill documentation](https://autodistill.github.io/autodistill/base_models/kosmos_2/).

## Installation

To use Kosmos-2 with autodistill, you need to install the following dependency:


```bash
pip3 install autodistill-kosmos-2
```

## Quickstart

```python
from autodistill_kosmos_2 import Kosmos2

# define an ontology to map class names to our Kosmos2 prompt
# the ontology dictionary has the format {caption: class}
# where caption is the prompt sent to the base model, and class is the label that will
# be saved for that caption in the generated annotations
# then, load the model
base_model = Kosmos2(
    ontology=CaptionOntology(
        {
            "person": "person",
            "a forklift": "forklift"
        }
    )
)

predictions = base_model.predict("./example.png")

base_model.label("./context_images", extension=".jpeg")
```


## License

This package is implemented using the [Transformers Kosmos-2 implementation](https://huggingface.co/microsoft/kosmos-2-patch14-224). The underlying Kosmos-2 model, developed by Microsoft, is licensed under an [MIT license](https://github.com/microsoft/unilm/blob/master/LICENSE).

## 🏆 Contributing

We love your input! Please see the core Autodistill [contributing guide](https://github.com/autodistill/autodistill/blob/main/CONTRIBUTING.md) to get started. Thank you 🙏 to all our contributors!

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/autodistill/autodistill-kosmos-2",
    "name": "autodistill-kosmos-2",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "",
    "author": "Roboflow",
    "author_email": "support@roboflow.com",
    "download_url": "https://files.pythonhosted.org/packages/34/bb/4c354bb3faa80abac8d3b76fb4672a7f9678270c75ff72257dfbd9384bc5/autodistill-kosmos-2-0.1.1.tar.gz",
    "platform": null,
    "description": "<div align=\"center\">\n  <p>\n    <a align=\"center\" href=\"\" target=\"_blank\">\n      <img\n        width=\"850\"\n        src=\"https://media.roboflow.com/open-source/autodistill/autodistill-banner.png\"\n      >\n    </a>\n  </p>\n</div>\n\n# Autodistill Kosmos-2 Module\n\nThis repository contains the code supporting the Kosmos-2 base model for use with [Autodistill](https://github.com/autodistill/autodistill).\n\n[Kosmos-2](https://github.com/microsoft/unilm/tree/master/kosmos-2), developed by Microsoft, is a multimodal language model that you can use for zero-shot object detection. You can use Kosmos-2 with autodistill for object detection.\n\nRead the full [Autodistill documentation](https://autodistill.github.io/autodistill/).\n\nRead the [Kosmos-2 Autodistill documentation](https://autodistill.github.io/autodistill/base_models/kosmos_2/).\n\n## Installation\n\nTo use Kosmos-2 with autodistill, you need to install the following dependency:\n\n\n```bash\npip3 install autodistill-kosmos-2\n```\n\n## Quickstart\n\n```python\nfrom autodistill_kosmos_2 import Kosmos2\n\n# define an ontology to map class names to our Kosmos2 prompt\n# the ontology dictionary has the format {caption: class}\n# where caption is the prompt sent to the base model, and class is the label that will\n# be saved for that caption in the generated annotations\n# then, load the model\nbase_model = Kosmos2(\n    ontology=CaptionOntology(\n        {\n            \"person\": \"person\",\n            \"a forklift\": \"forklift\"\n        }\n    )\n)\n\npredictions = base_model.predict(\"./example.png\")\n\nbase_model.label(\"./context_images\", extension=\".jpeg\")\n```\n\n\n## License\n\nThis package is implemented using the [Transformers Kosmos-2 implementation](https://huggingface.co/microsoft/kosmos-2-patch14-224). The underlying Kosmos-2 model, developed by Microsoft, is licensed under an [MIT license](https://github.com/microsoft/unilm/blob/master/LICENSE).\n\n## \ud83c\udfc6 Contributing\n\nWe love your input! Please see the core Autodistill [contributing guide](https://github.com/autodistill/autodistill/blob/main/CONTRIBUTING.md) to get started. Thank you \ud83d\ude4f to all our contributors!\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Kosmos-2 base model for use with Autodistill.",
    "version": "0.1.1",
    "project_urls": {
        "Homepage": "https://github.com/autodistill/autodistill-kosmos-2"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "71ce5217936d6abd316676eaf4e5925cdca23af297640016e21812892d6f2c20",
                "md5": "8e7eb1a4eca200e565f648264348227d",
                "sha256": "67074b9dc1d405c10d3e28342bb7be7a3476a29014733e20b89238b6bc06a3a3"
            },
            "downloads": -1,
            "filename": "autodistill_kosmos_2-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8e7eb1a4eca200e565f648264348227d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 4611,
            "upload_time": "2024-01-30T21:18:29",
            "upload_time_iso_8601": "2024-01-30T21:18:29.470925Z",
            "url": "https://files.pythonhosted.org/packages/71/ce/5217936d6abd316676eaf4e5925cdca23af297640016e21812892d6f2c20/autodistill_kosmos_2-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "34bb4c354bb3faa80abac8d3b76fb4672a7f9678270c75ff72257dfbd9384bc5",
                "md5": "f4419803939b5b3bcd28ab0af63494a4",
                "sha256": "a86a0edfaf3ffd3f2569036f75c6b94bd7d42389bcf4cb44d6b65ad4d9cc65e9"
            },
            "downloads": -1,
            "filename": "autodistill-kosmos-2-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "f4419803939b5b3bcd28ab0af63494a4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 4328,
            "upload_time": "2024-01-30T21:18:31",
            "upload_time_iso_8601": "2024-01-30T21:18:31.723475Z",
            "url": "https://files.pythonhosted.org/packages/34/bb/4c354bb3faa80abac8d3b76fb4672a7f9678270c75ff72257dfbd9384bc5/autodistill-kosmos-2-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-30 21:18:31",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "autodistill",
    "github_project": "autodistill-kosmos-2",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "autodistill-kosmos-2"
}
        
Elapsed time: 0.24452s