{"id":15684878,"url":"https://github.com/erfanium/huggingface-sentence-generator","last_synced_at":"2025-08-20T12:37:25.088Z","repository":{"id":196017982,"uuid":"694163079","full_name":"erfanium/huggingface-sentence-generator","owner":"erfanium","description":"HuggingFace text-generation model that never generates \u003ceos\u003e token and always continues the current sentence ","archived":false,"fork":false,"pushed_at":"2023-09-20T13:07:06.000Z","size":1,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-05T12:45:35.627Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/erfanium.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-09-20T13:01:39.000Z","updated_at":"2023-09-20T13:10:55.000Z","dependencies_parsed_at":"2023-09-21T02:38:56.782Z","dependency_job_id":null,"html_url":"https://github.com/erfanium/huggingface-sentence-generator","commit_stats":null,"previous_names":["erfanium/huggingface-sentence-generator"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erfanium%2Fhuggingface-sentence-generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erfanium%2Fhuggingface-sentence-generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erfanium%2Fhuggingface-sentence-generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erfanium%2Fhuggingface-sentence-generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/erfanium","download_url":"https://codeload.github.com/erfanium/huggingface-sentence-generator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246307931,"owners_count":20756478,"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":[],"created_at":"2024-10-03T17:22:08.174Z","updated_at":"2025-03-30T10:45:37.655Z","avatar_url":"https://github.com/erfanium.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# The Idea\n\n```py\nfrom transformers import GPT2LMHeadModel, AutoTokenizer\nimport torch\n\ntokenizer = AutoTokenizer.from_pretrained(\"gpt2\")\n\n\nclass MyGPT2LMHeadModel(GPT2LMHeadModel):\n    def __init__(self, config):\n        super().__init__(config)\n        with torch.no_grad():\n            self._masking = torch.zeros(\n                1, 1, config.vocab_size, device=self.device, dtype=self.dtype\n            )\n            self._masking[0, 0, tokenizer.eos_token_id] = -2\n\n    def __call__(self, *inputs, **kwargs):\n        result = super().__call__(*inputs, **kwargs)\n        result.logits += self._masking\n        return result\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferfanium%2Fhuggingface-sentence-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ferfanium%2Fhuggingface-sentence-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferfanium%2Fhuggingface-sentence-generator/lists"}