Skip to content

Commit

Permalink
starting the repo
Browse files Browse the repository at this point in the history
  • Loading branch information
goncalorafaria committed May 23, 2024
0 parents commit 84bcd63
Show file tree
Hide file tree
Showing 15 changed files with 1,169 additions and 0 deletions.
100 changes: 100 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
![Quest Logo](logo.png)

--------------------------------------------------------------------------------

# QUEST: Quality-Aware Metropolis-Hastings Sampling for Machine Translation

Paper: arxiv link goes here
<!-- toc -->

-----
## <div align="center">Documentation</div>

-----
## <div align="center">Quick Start Examples</div>

<details open>
<summary>Install</summary>

Install using pip (recommended):

```bash
pip install quest-decoding
```

</details>


<details open>
<summary>Length Reward</summary>

Example using Length Reward

```python

from langchain.prompts import PromptTemplate
from quest.model.vllm import VLLM
from quest.index import Uniform


template = PromptTemplate.from_template(
"Translate this from {source_language} to {target_language}:\n{source_language}: {source_sentence}\n{target_language}:"
) # a prompt template you define.

test_input_data = [{
"source_language": "English",
"target_language": "French",
"source_sentence": "Hello, how are you?"
}]

model = VLLM(
model_path="haoranxu/ALMA-7B",
prompt_template=template,
download_dir=os.environ["HF_HOME"],
)

reward = LengthReward() # a reward you define.

index = Uniform()

chain = Quest(
input_data=test_input_data,
model=model,
reward=reward,
dist=index,
)

chain_outputs = chain.run(
steps=10,
use_tqdm=True,
)


print(chain_outputs.samples)

```

</details>


-----

## <div align="center">Contact</div>

For bugs and feature requests please visit [GitHub Issues](https://github.com/goncalorafaria/quest-decoding/issues). For business inquiries or
professional support requests please send an [e-mail]([email protected]).

-----

## <div align="center">Citation</div>

````
@inproceedings{
questdecoding,
title={QUEST: Quality-Aware Metropolis-Hastings Sampling for Machine Translation},
author={Gonçalo Faria, Sweta Agrawal, António Farinhas, Ricardo Rei, José G. C. de Souza, Andre Martins},
booktitle={},
year={2024},
url={arxiv link goes here}
}
````
Empty file added quest/__init__.py
Empty file.
Loading

0 comments on commit 84bcd63

Please sign in to comment.