MCPcopy Index your code
hub / github.com/OpenBMB/DecT

github.com/OpenBMB/DecT @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
71 symbols 211 edges 5 files 18 documented · 25%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

DecT

Source code for ACL 2023 paper Decoder Tuning

Installation

Our code is based on PyTorch, HuggingFace Transformers, and OpenPrompt, please install dependencies by

pip install -r requirements.txt

Download Datasets

Download the 10 datasets with the following scripts

cd datasets
bash download_datasets.sh
cd ..

Run DecT

Then you can run DecT by running run_dect.py, for example

python src/run_dect.py \
    --model roberta \
    --size large \
    --type mlm \
    --model_name_or_path roberta-large \
    --shot 1 \
    --dataset sst2 \
    --proto_dim 128 \
    --model_logits_weight 1 \

In run_dect.py we provide instructions for each argument. To reproduce the results in paper, please run the following combinations

python src/run_dect.py \
    --shot [1, 4, 16] \
    --dataset [sst2, imdb, yelp, agnews, dbpedia, yahoo, rte, snli, mnli-m, mnli-mm, fewnerd] \
    --seed [0, 1, 2, 3, 4] \

Configure Models

You can configure different models by setting model, type, size, model_name_or_path parameters. - model: Model name. We now support plms in OpenPrompt, LLaMA, Alpaca and Vicuna. - type: mlm, lm or chat. This will determine the prompt template. For lm type models, we put the [mask] token at the end of the template. For chat models, we implement the chat template for Vicuna v1.1. You may change the template if you use other models. - size: Model size. Currently, it is used to set the hidden state dimension for LLaMA models. - model_name_or_path: Path to model weights.

You can also modify the load_model function in src/run_dect.py to support more models!

Core symbols most depended-on inside this repo

process_hiddens
called by 3
src/dect_verbalizer.py
process_logits
called by 3
src/dect_verbalizer.py
gather_outputs
called by 3
src/dect_verbalizer.py
build_dataloader
called by 3
src/run_dect.py
project
called by 2
src/dect_verbalizer.py
sim
called by 2
src/dect_verbalizer.py
test
called by 2
src/dect_trainer.py
load_dataset
called by 1
src/process_data.py

Shape

Method 49
Class 13
Function 9

Languages

Python100%

Modules by API surface

src/process_data.py36 symbols
src/dect_verbalizer.py18 symbols
src/dect_trainer.py9 symbols
datasets/download_glue_data.py5 symbols
src/run_dect.py3 symbols

For agents

$ claude mcp add DecT \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact