-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cleaned up formatting so that it displays well on the hosted website.…
… This mostly involved adding carriage returns, changing indenting, and fixing headers.
- Loading branch information
1 parent
d51e572
commit cd21072
Showing
2 changed files
with
68 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,47 +26,57 @@ This library supports an automated build using [GNU Make](https://www.gnu.org/so | |
|
||
### Steps | ||
|
||
1. Clone this repository: | ||
```bash | ||
git clone [email protected]:probcomp/genparse.git | ||
cd genparse | ||
``` | ||
#### 1. Clone this repository: | ||
|
||
```bash | ||
git clone [email protected]:probcomp/genparse.git | ||
cd genparse | ||
``` | ||
|
||
2. Create and activate a virtual environment. Using Conda (recommended): | ||
```bash | ||
conda create -n genparse python=3.10 | ||
conda activate genparse | ||
``` | ||
Using Python's `venv` module: | ||
```bash | ||
python -m venv genparse | ||
source genparse/bin/activate # On Windows, use `genparse\Scripts\activate` | ||
``` | ||
#### 2. Create and activate a virtual environment. Using Conda (recommended): | ||
|
||
3. Install package in editable mode with pre-commit hooks | ||
```bash | ||
make env | ||
``` | ||
GenParse optionally depends on Rust for faster parsing. If you do not have Rust installed, you will prompted to do so. However, if you do not want to install Rust, you can also install the library without the Rust dependency via: | ||
```bash | ||
make env-no-rust | ||
``` | ||
```bash | ||
conda create -n genparse python=3.10 | ||
conda activate genparse | ||
``` | ||
|
||
4. You can test your installation by running the following example: | ||
```python | ||
>>> from genparse import InferenceSetup | ||
>>> grammar = 'start: "Sequential Monte Carlo is " ( "good" | "bad" )' | ||
>>> m = InferenceSetup('gpt2', grammar, proposal_name='character') | ||
>>> m(' ', n_particles=15) | ||
{ | ||
'Sequential Monte Carlo is good▪': 0.7770842914205952, | ||
'Sequential Monte Carlo is bad▪': 0.22291570857940482, | ||
} | ||
``` | ||
Using Python's `venv` module: | ||
|
||
```bash | ||
python -m venv genparse | ||
source genparse/bin/activate | ||
``` | ||
> **💡Tip**: On Windows, use `genparse\Scripts\activate` | ||
#### 3. Install package in editable mode with pre-commit hooks | ||
|
||
```bash | ||
make env | ||
``` | ||
|
||
GenParse optionally depends on Rust for faster parsing. If you do not have Rust installed, you will prompted to do so. However, if you do not want to install Rust, you can also install the library without the Rust dependency via: | ||
|
||
```bash | ||
make env-no-rust | ||
``` | ||
|
||
#### 4. You can test your installation by running the following example: | ||
|
||
```python | ||
>>> from genparse import InferenceSetup | ||
>>> grammar = 'start: "Sequential Monte Carlo is " ( "good" | "bad" )' | ||
>>> m = InferenceSetup('gpt2', grammar, proposal_name='character') | ||
>>> m(' ', n_particles=15) | ||
{ | ||
'Sequential Monte Carlo is good▪': 0.7770842914205952, | ||
'Sequential Monte Carlo is bad▪': 0.22291570857940482, | ||
} | ||
``` | ||
|
||
Or simply by running: | ||
|
||
Or simply by running: | ||
```bash | ||
python genparse_tiny_example.py | ||
```bash | ||
python genparse_tiny_example.py | ||
``` | ||
|
||
|
||
|
@@ -106,10 +116,10 @@ This project is licensed under the MIT License - see the LICENSE file for detail | |
|
||
## Acknowledgments | ||
|
||
- Thanks to VLLM, Lark, Hugging Face and all of the teams we have dependencies on. | ||
Thanks to VLLM, Lark, Hugging Face and all of the teams we have dependencies on. | ||
## Licensing | ||
|
||
This project makes use of several open-source dependencies, which are distributed under the following licenses: | ||
This project makes use of several open-source dependencies. We have done our best to represent this correctly, but please do your own due diligence: | ||
|
||
- **Arsenal**: GNU General Public License v3.0 | ||
- **FrozenDict**: MIT License | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters