| pipeline_tag: text-generation | |
| library_name: transformers | |
| license: apache-2.0 | |
| tags: | |
| - interpretable | |
| - text-classification | |
| - text-generation | |
| # Concept Bottleneck Large Language Models | |
| This repository contains the Concept Bottleneck Large Language Model (CB-LLM) presented in [Concept Bottleneck Large Language Models](https://huggingface.co/papers/2412.07992). | |
| [Project Website](https://lilywenglab.github.io/CB-LLMs/) | |
| Code: [https://github.com/Trustworthy-ML-Lab/CB-LLMs](https://github.com/Trustworthy-ML-Lab/CB-LLMs) | |
| This model offers inherent interpretability and controllability in text generation. See the linked paper and GitHub repository for details on training and usage. | |
| ## Usage (Example - Text Generation) | |
| ```python | |
| from transformers import pipeline, AutoTokenizer | |
| model_name = "cesun/cbllm-generation" #replace with actual model name | |
| pipe = pipeline( | |
| "text-generation", | |
| model_name, | |
| tokenizer=AutoTokenizer.from_pretrained(model_name, trust_remote_code=True), | |
| device_map="auto", | |
| trust_remote_code=True, | |
| ) | |
| print(pipe("The key to life is", max_new_tokens=20, do_sample=True)[0]["generated_text"]) | |
| ``` |