{"id":20447840,"url":"https://github.com/nlpodyssey/cybertron","last_synced_at":"2025-04-04T08:09:54.655Z","repository":{"id":37761209,"uuid":"505861896","full_name":"nlpodyssey/cybertron","owner":"nlpodyssey","description":"Cybertron: the home planet of the Transformers in Go","archived":false,"fork":false,"pushed_at":"2024-06-08T19:22:45.000Z","size":1231,"stargazers_count":300,"open_issues_count":25,"forks_count":28,"subscribers_count":11,"default_branch":"main","last_synced_at":"2025-03-28T07:09:39.013Z","etag":null,"topics":["bart","bert","bert-as-service","deep-learning","huggingface","machine-learning","machine-translation","named-entity-recognition","natural-language-processing","nlp","question-answering","summarization","text-categorization","text-classification","text-similarity","transformers","translation","zero-shot-classification"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nlpodyssey.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":"2022-06-21T13:45:54.000Z","updated_at":"2025-03-25T02:09:10.000Z","dependencies_parsed_at":"2023-01-19T13:16:47.900Z","dependency_job_id":"6c4762a6-d3af-4be5-ab93-d6c48f21aa7d","html_url":"https://github.com/nlpodyssey/cybertron","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nlpodyssey%2Fcybertron","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nlpodyssey%2Fcybertron/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nlpodyssey%2Fcybertron/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nlpodyssey%2Fcybertron/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nlpodyssey","download_url":"https://codeload.github.com/nlpodyssey/cybertron/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247142074,"owners_count":20890653,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["bart","bert","bert-as-service","deep-learning","huggingface","machine-learning","machine-translation","named-entity-recognition","natural-language-processing","nlp","question-answering","summarization","text-categorization","text-classification","text-similarity","transformers","translation","zero-shot-classification"],"created_at":"2024-11-15T10:29:49.804Z","updated_at":"2025-04-04T08:09:54.625Z","avatar_url":"https://github.com/nlpodyssey.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":["[Tools](#tools-1)"],"readme":"# Cybertron\n\nCybertron is a package in pure Go built upon [spaGO](https://github.com/nlpodyssey/spago) that provides Go developers with an easy interface to use NLP technologies, without needing other programming languages or complex frameworks. It's designed for using pre-trained Transformer models available on the [HuggingFace models repository](https://huggingface.co/models).\n\nThe package is primarily aimed at running **inference** with the possibility of adding fine-tuning in the future.\n\nThe team is open to contributors to expedite its growth.\n\n## Supported models\n\n- BERT\n- ELECTRA\n- BART\n- PEGASUS\n- MarianMT\n\n## Supported tasks\n\n- Masked Language Modeling\n- Supervised and Zero-Shot Text Classification (Sentiment Analysis, Topic Classification, Intent Detection, ...)\n- Token Classification (Named Entity Recognition, Part-of-Speech Tagging, ...)\n- Extractive and Abstractive Question-Answering\n- Text Encoding (Text Embedding, Semantic Search, ...)\n- Text Generation (Translation, Paraphrasing, Summarization, ...)\n- Relation Extraction\n\n# Usage\n\nRequirements:\n\n* [Go 1.21](https://golang.org/dl/)\n\nClone this repo or get the library:\n\n```console\ngo get -u github.com/nlpodyssey/cybertron\n```\n\nCybertron supports two main use cases, which are explained more in detail in the following.\n\n## Server mode\n\nSettings are configured in a `.env` file, which is automatically loaded by Cybertron. Alternatively, it also accepts configurations via flags.\n\nFor a complete list run:\n\n```console\nGOARCH=amd64 go run ./cmd/server -h\n```\n\nOutput:\n\n```console\nUsage of server:\n  -address value\n        server listening address\n  -allowed-origins value\n        allowed origins (comma separated)\n  -loglevel value\n        zerolog global level\n  -model value\n        model name (and sub-path of models-dir)\n  -model-conversion value\n        model conversion policy (\"always\"|\"missing\"|\"never\")\n  -model-conversion-precision value\n        floating-point bits of precision to use if the model is converted (\"32\"|\"64\")\n  -model-download value\n        model downloading policy (\"always\"|\"missing\"|\"never\")\n  -models-dir value\n        models's base directory\n  -network value\n        network type for server listening\n  -task value\n        type of inference/computation that the model can fulfill (\"textgeneration\"|\"zero-shot-classification\"|\"question-answering\"|\"text-classification\"|\"token-classification\"|\"text-encoding\")\n  -tls value\n        whether to enable TLS (\"true\"|\"false\")\n  -tls-cert value\n        TLS cert filename\n  -tls-key value\n        TLS key filename\n\n```\n\nFor example, to run Cybertron in server mode for Machine Translation (e.g. `en` to `it`) with default settings, simply create a `.env` file in the current directory:\n\n```console\necho \"CYBERTRON_MODEL=Helsinki-NLP/opus-mt-en-it\" \u003e .env\necho \"CYBERTRON_MODELS_DIR=models\" \u003e\u003e .env\necho \"CYBERTRON_MODEL_TASK=text-generation\" \u003e\u003e .env\n```\n\nand execute the following command:\n\n```console\nGOARCH=amd64 go run ./cmd/server -address 0.0.0.0:8080\n```\n\nTo test the server, run:\n\n```console\ncurl -X 'POST' \\\n  '0.0.0.0:8080/v1/generate' \\\n  -H 'accept: application/json' \\\n  -H 'Content-Type: application/json' \\\n  -d '{\n  \"input\": \"You must be the change you wish to see in the world.\",\n  \"parameters\": {}\n}'\n```\n\n## Library mode\n\nSeveral examples can be leveraged to tour the current NLP capabilities in Cybertron. A list of the demos now follows.\n\n### Machine Translation (En -\u003e It)\n\n```\nGOARCH=amd64 go run ./examples/textgeneration\n```\n\n### Zero-Shot Text Classification\n⚠️ If the model specified in `.env` file is not compatible, an error will be returned. In this case, remove the specified model from the configuration file, so the default one will be used.\n```\nGOARCH=amd64 go run ./examples/zeroshotclassification politics,business,science,technology,health,culture,sports\n```\n\n# Dependencies\n\nCybertron's pricipal dependencies are:\n\n- [Spago](https://github.com/nlpodyssey/spago) - a lightweight self-contained machine learning framework in pure Go\n- [GoPickle](https://github.com/nlpodyssey/gopickle) - a Go module for loading Python's data serialized with pickle and PyTorch module files\n- [GoTokenizers](https://github.com/nlpodyssey/gotokenizers) - Go implementation of today's most used tokenizers\n\nThe rest are mainly for gRPC and HTTP API developments.\n\n# Dev Tools\n\n\u003e This section is intended for developers who want to change or enrich the Cybertron gRPC and HTTP APIs.\n\nTo get started, you need [buf](https://github.com/bufbuild/buf) installed in your machine. \n\nThen install the following tools:\n\n```\ngo install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway \\\n  github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2 \\\n  google.golang.org/protobuf/cmd/protoc-gen-go \\\n  google.golang.org/grpc/cmd/protoc-gen-go-grpc\n```\n\nThen run the following command to generate the gRPC and HTTP APIs:\n\n```\ngo generate ./...\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnlpodyssey%2Fcybertron","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnlpodyssey%2Fcybertron","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnlpodyssey%2Fcybertron/lists"}