Skip to content

Commit

Permalink
code and data
Browse files Browse the repository at this point in the history
  • Loading branch information
nyanyanya committed May 30, 2023
1 parent b1809c9 commit 3ec01dc
Show file tree
Hide file tree
Showing 4 changed files with 518 additions and 0 deletions.
28 changes: 28 additions & 0 deletions llma/src/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Inference code and sample data for LLMA paper.

## Installation

```bash
pip install torch tensorflow transformers sentencepiece tqdm
```
Additionally, you need to get LLaMA model weights and convert to Huggingface format.

## Usage
One Nvidia V100 32GB GPU or better is recommended.

For retrieval-augmented experiments in the paper, run the following:
```bash
# baseline decoding
python decode.py --model_path /path/to/llama_model --input_data_fn ./data/rag.jsonl --type base --forced_decoding --append_docs
# llma decoding
python decode.py --model_path /path/to/llama_model --input_data_fn ./data/rag.jsonl --n 1 --k 20 --type llma --forced_decoding --append_docs
```
Here we run "forced_decoding" which forces the output to be the same as the pre-generated output from davinci-003. The reason, as mentioned in the paper (section 3.2), is that the existing LLaMA models cannot generate high-quality output for RAG.

For experiments without forced decoding, we suggest to run summarization on CNNDM dataset using Alpaca 7B model:
```bash
# baseline decoding
python decode.py --model_path /path/to/alpaca_model --input_data_fn ./data/cnndm.jsonl --type base
# llma decoding
python decode.py --model_path /path/to/alpaca_model --input_data_fn ./data/cnndm.jsonl --n 1 --k 20 --type llma
```
Loading

0 comments on commit 3ec01dc

Please sign in to comment.