{"id":15648112,"url":"https://github.com/fatescript/token_visualizer","last_synced_at":"2025-06-26T02:03:54.518Z","repository":{"id":227188505,"uuid":"768085686","full_name":"FateScript/token_visualizer","owner":"FateScript","description":"Token level visualization tools for large language models ","archived":false,"fork":false,"pushed_at":"2025-01-08T09:24:48.000Z","size":626,"stargazers_count":80,"open_issues_count":1,"forks_count":10,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-20T06:04:04.862Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","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/FateScript.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-06T12:51:24.000Z","updated_at":"2025-04-25T06:35:23.000Z","dependencies_parsed_at":"2024-10-03T12:23:45.183Z","dependency_job_id":"8023f689-c075-4fdb-b7c4-a3446ff99de8","html_url":"https://github.com/FateScript/token_visualizer","commit_stats":{"total_commits":27,"total_committers":2,"mean_commits":13.5,"dds":0.03703703703703709,"last_synced_commit":"facaf36930b37f992593d9cca64ef19fd02b3a13"},"previous_names":["fatescript/token_visualizer"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/FateScript/token_visualizer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FateScript%2Ftoken_visualizer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FateScript%2Ftoken_visualizer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FateScript%2Ftoken_visualizer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FateScript%2Ftoken_visualizer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FateScript","download_url":"https://codeload.github.com/FateScript/token_visualizer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FateScript%2Ftoken_visualizer/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261984640,"owners_count":23240302,"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-03T12:23:36.408Z","updated_at":"2025-06-26T02:03:54.487Z","avatar_url":"https://github.com/FateScript.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n## Introduction\ntoken visualizer is a token-level visualization tool to visualize LLM.\n\n## Quick start\n\n### Installation\n\n#### Install from source\n\nRun the following command to install the package.\n```shell\ngit clone git@github.com:FateScript/token_visualizer.git\ncd token_visualizer\npip install -v -e .  # or  python3 setup.py develop\n```\n\n#### Check installation\n\nIf you could see the version of `token_visualizer` by running \n```shell\npython3 -c \"import token_visualizer; print(token_visualizer.__file__)\"\n```\n\n## Visualization demo\n\n### Inference\n\n#### Start demo\nRun the following command to start inference visualizer.\n```shell\npython3 visualizer.py\n```\n\nThe command will start a OpenAIProxy model, to use it without exception, user should fill in the value of `BASE_URL` and `OPENAI_KEY`.\n\n`token_visualizer` also support `OpenAIModel` and HuggingFace `TransformerModel` in [models.py](https://github.com/FateScript/token_visualizer/blob/main/token_visualizer/models.py), feel free to modify the code.\n\n#### Demo gif\nAfter inputing your prompt, you will see the large language model's answer and the answer's visualization result.\n\n\u003cimg src=\"assets/inference.gif\"\u003e\n\n**The redder the color of the token, the lower the corresponding probability. The greener the color of the token, the higher the corresponding probability.**\n\n### Perplexity\n\n#### Start demo\nRun the following command to start perplexity visualizer, then click the `ppl` tab.\n\n```shell\npython3 visualizer.py\n```\n\n#### Demo gif\nAfter inputing your text, you will see the perplexity and visualization result of the text.\n\n\u003cimg src=\"assets/ppl.gif\"\u003e\n\n### Tokenizer\n\n#### Start demo\nRun the following command to start interactive tokenizer encoding web demo.\n\n```shell\npython3 visual_tokenizer.py\n```\n\n#### Demo gif\nUser could select tokenizer to interacte with and text to encode. For speical string \n\u003cimg src=\"assets/tokenizer.gif\"\u003e\n\n\n## TODO\n- [x] Support ppl visualization.\n- [x] Select transformers/openai/TGI with cli.\n- [ ] Support OpenAI tokenizer visualization.\n- [x] Support TGI inference visualization.\n- [ ] Support multi-turn chat visualization.\n- [ ] Support dark mode.\n\n\n## Related projects/websites\n\n* [LLM architecture visualization](https://bbycroft.net/llm)\n* [perplexity visualization](https://bbycroft.net/ppl)\n\n\n## Acknowledgement\n\n* Use front-end setting from [https://perplexity.vercel.app/](https://bbycroft.net/ppl)\n* Color algorithm from [post](https://twitter.com/thesephist/status/1617909119423500288) by [thesephist](https://twitter.com/thesephist).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffatescript%2Ftoken_visualizer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffatescript%2Ftoken_visualizer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffatescript%2Ftoken_visualizer/lists"}