Skip to content

Repository files navigation

TableCache

Installation

Quick Start

1. Create Conda Environment

conda create -n TableCache python=3.10
conda activate TableCache
pip install -r requirements.txt

###Configuration Before running TableCache, you need to extract all table information from the dataset and store it in the appropriate directory:

# For BIRD dataset:
mkdir -p ./inst_datas_bird
# For Spider dataset:
mkdir -p ./inst_datas_spider

Make sure to modify the model path in make_table_cache.py and make_table_cache_spider:

device = "cuda"
# Update the model path to your local model directory
model = Qwen2ModifiedForCausalLM.from_pretrained("/path/to/your/model", torch_dtype=torch.bfloat16).to(device)
tokenizer = AutoTokenizer.from_pretrained("/path/to/your/model")

Now, create a folder that will be used to store the precomputed KV cache. For example:

mkdir ./path/to/cache

And in make_table_cache.py and make_table_cache_spider.py, update the output_path to the path you just set.

output_path = "./path/to/cache"

Next, you should run the code to obtain the offline KV cache.

python make_table_cache.py //For bird
python make_table_cache_spider.py //For spider

Finally, run main.py to test TableCache.

python main.py --cache_method TableCache --cache_method FIFO --dataset dev_spider --capacity 32 --model_name qwen --model_path ./path/to/model --cache_path ./path/to/cache --output_path ./path/to/output/

Parameter Description

Parameter List

Parameter Type Default Value Description
--cache_method str "TableCache" Cache method selection
--cache_manager str "FIFO" Cache manager selection (FIFO/LRU/LFU)
--dataset str 'dev_spider' Dataset selection (dev_spider,dev_bird)
--capacity int 32 Cache capacity
--model_name str "qwen" Model name (qwen,llama,qwen_moe)
--model_path str "./Qwen2-7B" Model file path
--cache_path str "./chunk_cache" Cache output path
--output_path str "./eval_results/test.json" Result output path

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages