outlines 0.1.dev0__tar.gz → 0.1.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- outlines-0.1.1/.github/ISSUE_TEMPLATE/bug_report.yml +87 -0
- outlines-0.1.1/.github/ISSUE_TEMPLATE/config.yml +4 -0
- outlines-0.1.1/.github/ISSUE_TEMPLATE/doc_request.md +21 -0
- outlines-0.1.1/.github/ISSUE_TEMPLATE/feature_request.md +27 -0
- outlines-0.1.1/.github/ISSUE_TEMPLATE/improvement.yml +34 -0
- outlines-0.1.1/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md +23 -0
- outlines-0.1.1/.github/scripts/build_sdist_and_wheel.sh +22 -0
- outlines-0.1.1/.github/workflows/asv_benchmark_pr.yml +68 -0
- outlines-0.1.1/.github/workflows/build_documentation.yml +23 -0
- outlines-0.1.1/.github/workflows/publish_documentation.yml +53 -0
- outlines-0.1.1/.github/workflows/release_docker.yml +36 -0
- outlines-0.1.1/.github/workflows/release_pypi.yaml +27 -0
- outlines-0.1.1/.github/workflows/tests.yml +109 -0
- outlines-0.1.1/.gitignore +13 -0
- outlines-0.1.1/.pre-commit-config.yaml +33 -0
- outlines-0.1.1/.readthedocs.yaml +15 -0
- outlines-0.1.1/Dockerfile +17 -0
- outlines-0.1.1/LICENSE +201 -0
- outlines-0.1.1/PKG-INFO +428 -0
- outlines-0.1.1/README.md +365 -0
- outlines-0.1.1/benchmarks/asv.conf.json +20 -0
- outlines-0.1.1/benchmarks/bench_cfg_guide.py +64 -0
- outlines-0.1.1/benchmarks/bench_json_schema.py +80 -0
- outlines-0.1.1/benchmarks/bench_processors.py +108 -0
- outlines-0.1.1/benchmarks/bench_regex_guide.py +40 -0
- outlines-0.1.1/benchmarks/common.py +8 -0
- outlines-0.1.1/docs/api/guide.md +1 -0
- outlines-0.1.1/docs/api/index.md +1 -0
- outlines-0.1.1/docs/api/json_schema.md +1 -0
- outlines-0.1.1/docs/api/models.md +3 -0
- outlines-0.1.1/docs/api/parsing.md +1 -0
- outlines-0.1.1/docs/api/prompts.md +1 -0
- outlines-0.1.1/docs/api/regex.md +1 -0
- outlines-0.1.1/docs/api/samplers.md +1 -0
- outlines-0.1.1/docs/assets/images/dottxt.png +0 -0
- outlines-0.1.1/docs/assets/images/logits_processing_diagram.svg +157 -0
- outlines-0.1.1/docs/assets/images/logo-simple.png +0 -0
- outlines-0.1.1/docs/assets/images/logo-square.png +0 -0
- outlines-0.1.1/docs/assets/images/logo-square.svg +124 -0
- outlines-0.1.1/docs/assets/images/logo.png +0 -0
- outlines-0.1.1/docs/assets/images/logo.svg +134 -0
- outlines-0.1.1/docs/assets/images/normal_computing.jpg +0 -0
- outlines-0.1.1/docs/blog/.authors.yml +5 -0
- outlines-0.1.1/docs/blog/assets/4000_stars.png +0 -0
- outlines-0.1.1/docs/blog/index.md +1 -0
- outlines-0.1.1/docs/blog/posts/roadmap-2024.md +91 -0
- outlines-0.1.1/docs/community/belonging.png +0 -0
- outlines-0.1.1/docs/community/contribute.md +132 -0
- outlines-0.1.1/docs/community/examples.md +19 -0
- outlines-0.1.1/docs/community/feedback.md +81 -0
- outlines-0.1.1/docs/community/index.md +12 -0
- outlines-0.1.1/docs/community/versioning.md +26 -0
- outlines-0.1.1/docs/cookbook/chain_of_density.md +125 -0
- outlines-0.1.1/docs/cookbook/chain_of_thought.md +138 -0
- outlines-0.1.1/docs/cookbook/classification.md +103 -0
- outlines-0.1.1/docs/cookbook/dating_profiles.md +229 -0
- outlines-0.1.1/docs/cookbook/deploy-using-bentoml.md +224 -0
- outlines-0.1.1/docs/cookbook/deploy-using-cerebrium.md +121 -0
- outlines-0.1.1/docs/cookbook/deploy-using-modal.md +198 -0
- outlines-0.1.1/docs/cookbook/extraction.md +87 -0
- outlines-0.1.1/docs/cookbook/images/chain_of_density.png +0 -0
- outlines-0.1.1/docs/cookbook/images/coding_structure_diagram.png +0 -0
- outlines-0.1.1/docs/cookbook/images/knowledge-graph-extraction.png +0 -0
- outlines-0.1.1/docs/cookbook/images/simtom.png +0 -0
- outlines-0.1.1/docs/cookbook/index.md +14 -0
- outlines-0.1.1/docs/cookbook/knowledge_graph_extraction.md +155 -0
- outlines-0.1.1/docs/cookbook/models_playing_chess.md +88 -0
- outlines-0.1.1/docs/cookbook/qa-with-citations.md +255 -0
- outlines-0.1.1/docs/cookbook/react_agent.md +273 -0
- outlines-0.1.1/docs/cookbook/simtom.md +129 -0
- outlines-0.1.1/docs/cookbook/structured_generation_workflow.md +215 -0
- outlines-0.1.1/docs/index.md +8 -0
- outlines-0.1.1/docs/installation.md +38 -0
- outlines-0.1.1/docs/licence.md +34 -0
- outlines-0.1.1/docs/logos/amazon.png +0 -0
- outlines-0.1.1/docs/logos/apple.png +0 -0
- outlines-0.1.1/docs/logos/best_buy.png +0 -0
- outlines-0.1.1/docs/logos/canoe.png +0 -0
- outlines-0.1.1/docs/logos/cisco.png +0 -0
- outlines-0.1.1/docs/logos/dassault_systems.png +0 -0
- outlines-0.1.1/docs/logos/databricks.png +0 -0
- outlines-0.1.1/docs/logos/datadog.png +0 -0
- outlines-0.1.1/docs/logos/dbt_labs.png +0 -0
- outlines-0.1.1/docs/logos/gladia.jpg +0 -0
- outlines-0.1.1/docs/logos/harvard.png +0 -0
- outlines-0.1.1/docs/logos/hf.png +0 -0
- outlines-0.1.1/docs/logos/johns_hopkins.png +0 -0
- outlines-0.1.1/docs/logos/meta.png +0 -0
- outlines-0.1.1/docs/logos/mit.png +0 -0
- outlines-0.1.1/docs/logos/mount_sinai.png +0 -0
- outlines-0.1.1/docs/logos/nvidia.png +0 -0
- outlines-0.1.1/docs/logos/nyu.png +0 -0
- outlines-0.1.1/docs/logos/safran.png +0 -0
- outlines-0.1.1/docs/logos/salesforce.png +0 -0
- outlines-0.1.1/docs/logos/shopify.png +0 -0
- outlines-0.1.1/docs/logos/smithsonian.png +0 -0
- outlines-0.1.1/docs/logos/tinder.png +0 -0
- outlines-0.1.1/docs/logos/upenn.png +0 -0
- outlines-0.1.1/docs/overrides/home.html +120 -0
- outlines-0.1.1/docs/overrides/main.html +1 -0
- outlines-0.1.1/docs/quickstart.md +228 -0
- outlines-0.1.1/docs/reference/functions.md +1 -0
- outlines-0.1.1/docs/reference/generation/cfg.md +154 -0
- outlines-0.1.1/docs/reference/generation/choices.md +16 -0
- outlines-0.1.1/docs/reference/generation/creating_grammars.md +99 -0
- outlines-0.1.1/docs/reference/generation/custom_fsm_ops.md +37 -0
- outlines-0.1.1/docs/reference/generation/format.md +23 -0
- outlines-0.1.1/docs/reference/generation/generation.md +216 -0
- outlines-0.1.1/docs/reference/generation/json.md +105 -0
- outlines-0.1.1/docs/reference/generation/regex.md +27 -0
- outlines-0.1.1/docs/reference/generation/structured_generation_explanation.md +54 -0
- outlines-0.1.1/docs/reference/generation/types.md +83 -0
- outlines-0.1.1/docs/reference/index.md +15 -0
- outlines-0.1.1/docs/reference/models/exllamav2.md +15 -0
- outlines-0.1.1/docs/reference/models/llamacpp.md +226 -0
- outlines-0.1.1/docs/reference/models/mlxlm.md +89 -0
- outlines-0.1.1/docs/reference/models/models.md +57 -0
- outlines-0.1.1/docs/reference/models/openai.md +200 -0
- outlines-0.1.1/docs/reference/models/tgi.md +3 -0
- outlines-0.1.1/docs/reference/models/transformers.md +148 -0
- outlines-0.1.1/docs/reference/models/transformers_vision.md +115 -0
- outlines-0.1.1/docs/reference/models/vllm.md +231 -0
- outlines-0.1.1/docs/reference/prompting.md +403 -0
- outlines-0.1.1/docs/reference/samplers.md +178 -0
- outlines-0.1.1/docs/reference/serve/lmstudio.md +89 -0
- outlines-0.1.1/docs/reference/serve/vllm.md +73 -0
- outlines-0.1.1/docs/reference/text.md +86 -0
- outlines-0.1.1/docs/stylesheets/extra.css +146 -0
- outlines-0.1.1/docs/welcome.md +183 -0
- outlines-0.1.1/environment.yml +23 -0
- outlines-0.1.1/examples/babyagi.py +167 -0
- outlines-0.1.1/examples/bentoml/.bentoignore +5 -0
- outlines-0.1.1/examples/bentoml/bentofile.yaml +9 -0
- outlines-0.1.1/examples/bentoml/import_model.py +24 -0
- outlines-0.1.1/examples/bentoml/requirements.txt +5 -0
- outlines-0.1.1/examples/bentoml/service.py +78 -0
- outlines-0.1.1/examples/cerebrium/cerebrium.toml +26 -0
- outlines-0.1.1/examples/cerebrium/main.py +43 -0
- outlines-0.1.1/examples/cfg.py +89 -0
- outlines-0.1.1/examples/dating_profile.py +176 -0
- outlines-0.1.1/examples/llamacpp_example.py +44 -0
- outlines-0.1.1/examples/llamacpp_processor.py +50 -0
- outlines-0.1.1/examples/math_generate_code.py +41 -0
- outlines-0.1.1/examples/meta_prompting.py +168 -0
- outlines-0.1.1/examples/modal_example.py +81 -0
- outlines-0.1.1/examples/parsing.py +106 -0
- outlines-0.1.1/examples/pick_odd_one_out.py +43 -0
- outlines-0.1.1/examples/react.py +77 -0
- outlines-0.1.1/examples/sampling.ipynb +401 -0
- outlines-0.1.1/examples/self_consistency.py +82 -0
- outlines-0.1.1/examples/simulation_based_inference.ipynb +370 -0
- outlines-0.1.1/examples/transformers_integration.py +25 -0
- outlines-0.1.1/examples/vllm_integration.py +24 -0
- outlines-0.1.1/mkdocs.yml +174 -0
- outlines-0.1.1/outlines/__init__.py +20 -0
- outlines-0.1.1/outlines/_version.py +16 -0
- outlines-0.1.1/outlines/base.py +288 -0
- outlines-0.1.1/outlines/caching.py +179 -0
- outlines-0.1.1/outlines/fsm/__init__.py +0 -0
- outlines-0.1.1/outlines/fsm/guide.py +278 -0
- outlines-0.1.1/outlines/fsm/json_schema.py +552 -0
- outlines-0.1.1/outlines/fsm/parsing.py +1127 -0
- outlines-0.1.1/outlines/fsm/types.py +81 -0
- outlines-0.1.1/outlines/function.py +117 -0
- outlines-0.1.1/outlines/generate/__init__.py +8 -0
- outlines-0.1.1/outlines/generate/api.py +623 -0
- outlines-0.1.1/outlines/generate/cfg.py +54 -0
- outlines-0.1.1/outlines/generate/choice.py +47 -0
- outlines-0.1.1/outlines/generate/format.py +47 -0
- outlines-0.1.1/outlines/generate/fsm.py +31 -0
- outlines-0.1.1/outlines/generate/generator.py +312 -0
- outlines-0.1.1/outlines/generate/json.py +108 -0
- outlines-0.1.1/outlines/generate/regex.py +59 -0
- outlines-0.1.1/outlines/generate/text.py +50 -0
- outlines-0.1.1/outlines/grammars/arithmetic.lark +18 -0
- outlines-0.1.1/outlines/grammars/common.lark +83 -0
- outlines-0.1.1/outlines/grammars/json.lark +19 -0
- outlines-0.1.1/outlines/grammars.py +14 -0
- outlines-0.1.1/outlines/models/__init__.py +19 -0
- outlines-0.1.1/outlines/models/exllamav2.py +357 -0
- outlines-0.1.1/outlines/models/llamacpp.py +407 -0
- outlines-0.1.1/outlines/models/mlxlm.py +247 -0
- outlines-0.1.1/outlines/models/openai.py +297 -0
- outlines-0.1.1/outlines/models/tokenizer.py +31 -0
- outlines-0.1.1/outlines/models/transformers.py +458 -0
- outlines-0.1.1/outlines/models/transformers_vision.py +138 -0
- outlines-0.1.1/outlines/models/vllm.py +226 -0
- outlines-0.1.1/outlines/processors/__init__.py +7 -0
- outlines-0.1.1/outlines/processors/base_logits_processor.py +135 -0
- outlines-0.1.1/outlines/processors/structured.py +246 -0
- outlines-0.1.1/outlines/prompts.py +343 -0
- outlines-0.1.1/outlines/py.typed +0 -0
- outlines-0.1.1/outlines/samplers.py +324 -0
- outlines-0.1.1/outlines/serve/__init__.py +0 -0
- outlines-0.1.1/outlines/serve/serve.py +139 -0
- outlines-0.1.1/outlines/types/__init__.py +4 -0
- outlines-0.1.1/outlines/types/airports.py +11 -0
- outlines-0.1.1/outlines/types/countries.py +19 -0
- outlines-0.1.1/outlines/types/email.py +11 -0
- outlines-0.1.1/outlines/types/isbn.py +12 -0
- outlines-0.1.1/outlines/types/locales.py +21 -0
- outlines-0.1.1/outlines/types/phone_numbers.py +16 -0
- outlines-0.1.1/outlines/types/zip_codes.py +13 -0
- outlines-0.1.1/outlines.egg-info/PKG-INFO +428 -0
- outlines-0.1.1/outlines.egg-info/SOURCES.txt +243 -0
- outlines-0.1.1/outlines.egg-info/requires.txt +48 -0
- outlines-0.1.1/pyproject.toml +164 -0
- outlines-0.1.1/requirements-doc.txt +9 -0
- outlines-0.1.1/setup.cfg +13 -0
- outlines-0.1.1/tests/__init__.py +0 -0
- outlines-0.1.1/tests/cfg_samples/arithmetic/lots_of_ops.arithmetic.test +1 -0
- outlines-0.1.1/tests/cfg_samples/arithmetic/simple_math.arithmetic.test +1 -0
- outlines-0.1.1/tests/cfg_samples/json/outlines.generate.samplers.mypy.json.test +372 -0
- outlines-0.1.1/tests/cfg_samples/json/simple_fruit.json.test +20 -0
- outlines-0.1.1/tests/cfg_samples/json/simple_fruit_no_indent.json.test +1 -0
- outlines-0.1.1/tests/fsm/partial_python.lark +314 -0
- outlines-0.1.1/tests/fsm/test_cfg_guide.py +457 -0
- outlines-0.1.1/tests/fsm/test_guide.py +476 -0
- outlines-0.1.1/tests/fsm/test_json_schema.py +1041 -0
- outlines-0.1.1/tests/fsm/test_parsing.py +307 -0
- outlines-0.1.1/tests/fsm/test_types.py +29 -0
- outlines-0.1.1/tests/generate/__init__.py +0 -0
- outlines-0.1.1/tests/generate/conftest.py +66 -0
- outlines-0.1.1/tests/generate/test_api.py +33 -0
- outlines-0.1.1/tests/generate/test_generate.py +398 -0
- outlines-0.1.1/tests/generate/test_generator.py +497 -0
- outlines-0.1.1/tests/generate/test_integration_exllamav2.py +363 -0
- outlines-0.1.1/tests/generate/test_integration_llamacpp.py +373 -0
- outlines-0.1.1/tests/generate/test_integration_transformers.py +544 -0
- outlines-0.1.1/tests/generate/test_integration_transformers_vision.py +116 -0
- outlines-0.1.1/tests/generate/test_integration_vllm.py +239 -0
- outlines-0.1.1/tests/models/test_openai.py +125 -0
- outlines-0.1.1/tests/models/test_tokenizer.py +8 -0
- outlines-0.1.1/tests/models/test_transformers.py +117 -0
- outlines-0.1.1/tests/test_base.py +275 -0
- outlines-0.1.1/tests/test_cache.py +190 -0
- outlines-0.1.1/tests/test_function.py +133 -0
- outlines-0.1.1/tests/test_grammars.py +31 -0
- outlines-0.1.1/tests/test_prompts.py +314 -0
- outlines-0.1.1/tests/test_samplers.py +254 -0
- outlines-0.1.1/tests/test_types.py +103 -0
- outlines-0.1.dev0/PKG-INFO +0 -14
- outlines-0.1.dev0/outlines/_version.py +0 -4
- outlines-0.1.dev0/outlines.egg-info/PKG-INFO +0 -14
- outlines-0.1.dev0/outlines.egg-info/SOURCES.txt +0 -7
- outlines-0.1.dev0/pyproject.toml +0 -31
- outlines-0.1.dev0/setup.cfg +0 -4
- {outlines-0.1.dev0/outlines → outlines-0.1.1/benchmarks}/__init__.py +0 -0
- {outlines-0.1.dev0 → outlines-0.1.1}/outlines.egg-info/dependency_links.txt +0 -0
- {outlines-0.1.dev0 → outlines-0.1.1}/outlines.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Issue template inspired by NumPy's excellent template:
|
|
2
|
+
# https://github.com/numpy/numpy/edit/main/.github/ISSUE_TEMPLATE/bug-report.yml
|
|
3
|
+
name: 🐞 Bug report
|
|
4
|
+
description: Create a bug report to help us reproduce and fix it.
|
|
5
|
+
title: "<Please write a descriptive title>"
|
|
6
|
+
labels: ["bug"]
|
|
7
|
+
|
|
8
|
+
body:
|
|
9
|
+
- type: markdown
|
|
10
|
+
attributes:
|
|
11
|
+
value: >-
|
|
12
|
+
Thank you for taking the time to file a bug report. First, carefully read
|
|
13
|
+
the following before everything else:
|
|
14
|
+
|
|
15
|
+
- Does your issue only arise in a library that uses Outlines? If so,
|
|
16
|
+
submit your issue to this library's issue tracker.
|
|
17
|
+
- Did you check the issue tracker for open and closed issues that may be
|
|
18
|
+
related to your bug?
|
|
19
|
+
|
|
20
|
+
- type: textarea
|
|
21
|
+
attributes:
|
|
22
|
+
label: "Describe the issue as clearly as possible:"
|
|
23
|
+
validations:
|
|
24
|
+
required: true
|
|
25
|
+
|
|
26
|
+
- type: textarea
|
|
27
|
+
attributes:
|
|
28
|
+
label: "Steps/code to reproduce the bug:"
|
|
29
|
+
description: >
|
|
30
|
+
A short code example that reproduces the problem/missing feature. It
|
|
31
|
+
should be self-contained, i.e., can be copy-pasted into the Python
|
|
32
|
+
interpreter or run as-is via `python myproblem.py`.
|
|
33
|
+
placeholder: |
|
|
34
|
+
import outlines
|
|
35
|
+
|
|
36
|
+
<< your code here >>
|
|
37
|
+
render: python
|
|
38
|
+
validations:
|
|
39
|
+
required: true
|
|
40
|
+
|
|
41
|
+
- type: textarea
|
|
42
|
+
attributes:
|
|
43
|
+
label: "Expected result:"
|
|
44
|
+
description: >
|
|
45
|
+
Please describe what you expect the above example to output.
|
|
46
|
+
placeholder: |
|
|
47
|
+
<< the expected result here >>
|
|
48
|
+
render: shell
|
|
49
|
+
validations:
|
|
50
|
+
required: true
|
|
51
|
+
|
|
52
|
+
- type: textarea
|
|
53
|
+
attributes:
|
|
54
|
+
label: "Error message:"
|
|
55
|
+
description: >
|
|
56
|
+
Please include the full error message, if any.
|
|
57
|
+
placeholder: |
|
|
58
|
+
<< Full traceback starting from `Traceback: ...` >>
|
|
59
|
+
render: shell
|
|
60
|
+
|
|
61
|
+
- type: textarea
|
|
62
|
+
attributes:
|
|
63
|
+
label: "Outlines/Python version information:"
|
|
64
|
+
description: |
|
|
65
|
+
Please run the following code and paste the output here.
|
|
66
|
+
python -c "from outlines import _version; print(_version.__version__)"
|
|
67
|
+
python -c "import sys; print('Python', sys.version)"
|
|
68
|
+
pip freeze
|
|
69
|
+
value: |
|
|
70
|
+
Version information
|
|
71
|
+
<details>
|
|
72
|
+
```
|
|
73
|
+
(command output here)
|
|
74
|
+
```
|
|
75
|
+
</details>
|
|
76
|
+
validations:
|
|
77
|
+
required: true
|
|
78
|
+
|
|
79
|
+
- type: textarea
|
|
80
|
+
attributes:
|
|
81
|
+
label: "Context for the issue:"
|
|
82
|
+
description: |
|
|
83
|
+
Please explain how this issue affects your work or why it should be prioritized.
|
|
84
|
+
placeholder: |
|
|
85
|
+
<< your explanation here >>
|
|
86
|
+
validations:
|
|
87
|
+
required: false
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: 📚 Documentation
|
|
3
|
+
about: Help with documentation improvements.
|
|
4
|
+
title: ''
|
|
5
|
+
labels: ''
|
|
6
|
+
assignees: ''
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
### Documentation request
|
|
10
|
+
|
|
11
|
+
Documentation is a high priority for outlines. If you would like to see something added to the documentation, please help us out by:
|
|
12
|
+
|
|
13
|
+
- Checking to see if the documentation does not already exist.
|
|
14
|
+
- Providing a detailed explanation of what you'd like to understand better.
|
|
15
|
+
- Highlighting any specific difficulties you ran into.
|
|
16
|
+
|
|
17
|
+
### Are you willing to open a PR?
|
|
18
|
+
|
|
19
|
+
Tell us whether you are willing to submit a PR for this yourself, we'd greatly appreciate it!
|
|
20
|
+
|
|
21
|
+
Thanks for contributing!
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: 🚀 New feature
|
|
3
|
+
about: Request a new feature.
|
|
4
|
+
title: ''
|
|
5
|
+
labels: ''
|
|
6
|
+
assignees: ''
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
Before suggesting a new feature, please make sure this hasn't already been suggested by searching through the past issues and the PR tracker.
|
|
10
|
+
|
|
11
|
+
### Presentation of the new feature
|
|
12
|
+
|
|
13
|
+
Assume that we know nothing about this feature. Please give us as much information as possible so we can judge it fairly. That includes (but is not limited to):
|
|
14
|
+
- Academic article
|
|
15
|
+
- Blog posts
|
|
16
|
+
- Implementations
|
|
17
|
+
- Personnal experience with the feature
|
|
18
|
+
|
|
19
|
+
### Where does it fit in Outlines?
|
|
20
|
+
|
|
21
|
+
Please explain to us why you are suggesting this feature for integration in Outlines.
|
|
22
|
+
|
|
23
|
+
### Are you willing to open a PR?
|
|
24
|
+
|
|
25
|
+
Tell us whether you are willing to add the feature yourself, and if so if you can share a design plan. **You may be challenged.**
|
|
26
|
+
|
|
27
|
+
Thanks for contributing!
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
name: ✨ Improvement
|
|
2
|
+
description: Propose an improvement to Outlines.
|
|
3
|
+
title: "<Description of the proposed change>"
|
|
4
|
+
labels: "enhancement"
|
|
5
|
+
|
|
6
|
+
body:
|
|
7
|
+
- type: markdown
|
|
8
|
+
attributes:
|
|
9
|
+
value: >-
|
|
10
|
+
Before suggesting an improvement, please make sure this hasn't already been suggested by searching through the past issues and the PR tracker.
|
|
11
|
+
|
|
12
|
+
## Current behavior
|
|
13
|
+
|
|
14
|
+
- type: textarea
|
|
15
|
+
attributes:
|
|
16
|
+
label: "What behavior of the library made you think about the improvement?"
|
|
17
|
+
placeholder: |
|
|
18
|
+
Sample code with the current behavior
|
|
19
|
+
|
|
20
|
+
- type: markdown
|
|
21
|
+
attributes:
|
|
22
|
+
value: >-
|
|
23
|
+
## Desired behavior
|
|
24
|
+
|
|
25
|
+
- type: textarea
|
|
26
|
+
attributes:
|
|
27
|
+
label: "How would you like it to behave?"
|
|
28
|
+
placeholder: |
|
|
29
|
+
Sample code with the desired behavior
|
|
30
|
+
|
|
31
|
+
- type: markdown
|
|
32
|
+
attributes:
|
|
33
|
+
value: >-
|
|
34
|
+
**Be aware that your proposal may be challenged.** Outlines has strong design principles that we are committed to stick to. If there is an alternative way to achieve what you would like, we will let you know.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# 🚧 Thank you for opening a PR!
|
|
2
|
+
|
|
3
|
+
A few important guidelines and requirements before we can merge your PR:
|
|
4
|
+
|
|
5
|
+
- [ ] We should be able to understand what the PR does from its title only;
|
|
6
|
+
- [ ] There is a high-level description of the changes;
|
|
7
|
+
- [ ] *If I add a new feature*, there is an [issue][issues] discussing it already;
|
|
8
|
+
- [ ] There are links to *all* the relevant issues, discussions and PRs;
|
|
9
|
+
- [ ] The branch is rebased on the latest `main` commit;
|
|
10
|
+
- [ ] **Commit messages** follow these [guidelines][git-guidelines];
|
|
11
|
+
- [ ] One commit per logical change;
|
|
12
|
+
- [ ] The code respects the current **naming conventions**;
|
|
13
|
+
- [ ] Docstrings follow the [numpy style guide][docstring-guidelines];
|
|
14
|
+
- [ ] `pre-commit` is installed and configured on your machine, and you ran it before opening the PR;
|
|
15
|
+
- [ ] There are tests covering the changes;
|
|
16
|
+
- [ ] The documentation is up-to-date;
|
|
17
|
+
|
|
18
|
+
Consider opening a **Draft PR** if your work is still in progress but you would
|
|
19
|
+
like some feedback from other contributors.
|
|
20
|
+
|
|
21
|
+
[issues]: https://github.com/dottxt-ai/outlines/issues
|
|
22
|
+
[git-guidelines]: https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
|
|
23
|
+
[docstring-guidelines]: https://numpydoc.readthedocs.io/en/latest/format.html
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Build sdist and wheel
|
|
4
|
+
python -m pip install -U pip
|
|
5
|
+
python -m pip install build
|
|
6
|
+
python -m build
|
|
7
|
+
|
|
8
|
+
# Check sdist install and imports
|
|
9
|
+
mkdir -p test-sdist
|
|
10
|
+
cd test-sdist
|
|
11
|
+
python -m venv venv-sdist
|
|
12
|
+
venv-sdist/bin/python -m pip install ../dist/outlines-*.tar.gz
|
|
13
|
+
venv-sdist/bin/python -c "import outlines"
|
|
14
|
+
cd ..
|
|
15
|
+
|
|
16
|
+
# Check wheel install and imports
|
|
17
|
+
mkdir -p test-wheel
|
|
18
|
+
cd test-wheel
|
|
19
|
+
python -m venv venv-wheel
|
|
20
|
+
venv-wheel/bin/python -m pip install ../dist/outlines-*.whl
|
|
21
|
+
venv-wheel/bin/python -c "import outlines"
|
|
22
|
+
cd ..
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
name: Benchmark PR
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
pull_request:
|
|
6
|
+
types: [synchronize, labeled]
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
env:
|
|
9
|
+
PYTHON_VERSION: "3.10"
|
|
10
|
+
WORKING_DIR: ${{ github.workspace }}/benchmarks
|
|
11
|
+
BENCHMARKS_OUTPUT: ${{ github.workspace }}/benchmarks_output
|
|
12
|
+
|
|
13
|
+
permissions:
|
|
14
|
+
contents: read
|
|
15
|
+
|
|
16
|
+
# Cancels all previous workflow runs for pull requests that have not completed.
|
|
17
|
+
concurrency:
|
|
18
|
+
# The concurrency group contains the workflow name and the branch name for pull requests
|
|
19
|
+
# or the commit hash for any other events.
|
|
20
|
+
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
|
|
21
|
+
cancel-in-progress: true
|
|
22
|
+
|
|
23
|
+
jobs:
|
|
24
|
+
benchmark-pr:
|
|
25
|
+
runs-on: ubuntu-latest
|
|
26
|
+
if: ${{ contains(github.event.pull_request.labels.*.name, 'run-benchmarks') || github.ref == 'refs/heads/main' }}
|
|
27
|
+
|
|
28
|
+
defaults:
|
|
29
|
+
run:
|
|
30
|
+
working-directory: ${{ env.WORKING_DIR }}
|
|
31
|
+
|
|
32
|
+
steps:
|
|
33
|
+
|
|
34
|
+
- name: Checkout repository
|
|
35
|
+
uses: actions/checkout@v3
|
|
36
|
+
with:
|
|
37
|
+
fetch-depth: 0
|
|
38
|
+
|
|
39
|
+
- name: Set up Python
|
|
40
|
+
uses: actions/setup-python@v4
|
|
41
|
+
with:
|
|
42
|
+
python-version: ${{ env.PYTHON_VERSION }}
|
|
43
|
+
|
|
44
|
+
- name: Install dependencies
|
|
45
|
+
run: |
|
|
46
|
+
python -m pip install --upgrade pip
|
|
47
|
+
pip install asv virtualenv lf-asv-formatter
|
|
48
|
+
|
|
49
|
+
- name: Create ASV machine config file
|
|
50
|
+
run: asv machine --machine gh-runner --yes
|
|
51
|
+
|
|
52
|
+
- name: Run Benchmarks - `PR HEAD` vs `main`
|
|
53
|
+
run: |
|
|
54
|
+
# prepare main branch for comparison
|
|
55
|
+
git remote add upstream https://github.com/${{ github.repository }}.git
|
|
56
|
+
git fetch upstream main
|
|
57
|
+
|
|
58
|
+
# Run benchmarks, allow errors, they will be caught in the next step
|
|
59
|
+
asv continuous upstream/main HEAD \
|
|
60
|
+
--no-stats --interleave-rounds -a repeat=3 || true
|
|
61
|
+
|
|
62
|
+
- name: BENCHMARK RESULTS
|
|
63
|
+
run: |
|
|
64
|
+
asv compare --factor=1.1 --no-stats --split upstream/main HEAD | tee ${{ env.BENCHMARKS_OUTPUT }}
|
|
65
|
+
if grep -q "Benchmarks that have got worse" "${{ env.BENCHMARKS_OUTPUT }}"; then
|
|
66
|
+
echo "Performance degradation detected!"
|
|
67
|
+
exit 1
|
|
68
|
+
fi
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
name: Build the documentation
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
branches: [main]
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
build:
|
|
10
|
+
name: Build
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v4
|
|
14
|
+
- uses: actions/setup-python@v4
|
|
15
|
+
with:
|
|
16
|
+
python-version: "3.10"
|
|
17
|
+
|
|
18
|
+
- name: Build the documentation
|
|
19
|
+
env:
|
|
20
|
+
GOOGLE_ANALYTICS_KEY: ${{ secrets.GOOGLE_ANALYTICS_KEY }}
|
|
21
|
+
run: |
|
|
22
|
+
pip install -r requirements-doc.txt
|
|
23
|
+
mkdocs build
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
name: Publish the documentation
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
push:
|
|
6
|
+
branches:
|
|
7
|
+
- main
|
|
8
|
+
release:
|
|
9
|
+
types:
|
|
10
|
+
- created
|
|
11
|
+
|
|
12
|
+
permissions:
|
|
13
|
+
contents: write
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
deploy:
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v4
|
|
20
|
+
with:
|
|
21
|
+
fetch-depth: 0
|
|
22
|
+
- uses: actions/setup-python@v4
|
|
23
|
+
with:
|
|
24
|
+
python-version: 3.x
|
|
25
|
+
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
|
|
26
|
+
- uses: actions/cache@v3
|
|
27
|
+
with:
|
|
28
|
+
key: mkdocs-material-${{ env.cache_id }}
|
|
29
|
+
path: .cache
|
|
30
|
+
restore-keys: |
|
|
31
|
+
mkdocs-material-
|
|
32
|
+
- run: pip install -r requirements-doc.txt
|
|
33
|
+
- run: mkdocs build
|
|
34
|
+
|
|
35
|
+
- name: Set up Git
|
|
36
|
+
run: |
|
|
37
|
+
git config user.name ${{ github.actor }}
|
|
38
|
+
git config user.email ${{ github.actor }}@users.noreply.github.com
|
|
39
|
+
|
|
40
|
+
- name: Publish Tag as latest
|
|
41
|
+
env:
|
|
42
|
+
GOOGLE_ANALYTICS_KEY: ${{ secrets.GOOGLE_ANALYTICS_KEY }}
|
|
43
|
+
if: github.event_name == 'release'
|
|
44
|
+
run: |
|
|
45
|
+
mike deploy --push --update-aliases ${{ github.ref_name }} latest
|
|
46
|
+
mike set-default --push latest
|
|
47
|
+
|
|
48
|
+
- name: Publish main as unstable
|
|
49
|
+
env:
|
|
50
|
+
GOOGLE_ANALYTICS_KEY: ${{ secrets.GOOGLE_ANALYTICS_KEY }}
|
|
51
|
+
if: github.event_name == 'push'
|
|
52
|
+
run: |
|
|
53
|
+
mike deploy --push --update-aliases ${{ github.ref_name }} unstable
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
name: Release Docker
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types:
|
|
6
|
+
- created
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
inputs:
|
|
9
|
+
release_tag:
|
|
10
|
+
description: 'Release Tag (for manual dispatch)'
|
|
11
|
+
required: false
|
|
12
|
+
default: 'latest'
|
|
13
|
+
jobs:
|
|
14
|
+
release-job:
|
|
15
|
+
name: Build and publish on Docker Hub
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
environment: release
|
|
18
|
+
steps:
|
|
19
|
+
- name: Checkout
|
|
20
|
+
uses: actions/checkout@v4
|
|
21
|
+
- name: Log in to Docker Hub
|
|
22
|
+
uses: docker/login-action@v3
|
|
23
|
+
with:
|
|
24
|
+
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
25
|
+
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
26
|
+
- name: Build and push Docker image
|
|
27
|
+
uses: docker/build-push-action@v5
|
|
28
|
+
with:
|
|
29
|
+
push: true
|
|
30
|
+
tags: |
|
|
31
|
+
outlinesdev/outlines:latest
|
|
32
|
+
outlinesdev/outlines:${{ github.event.release.tag_name || github.event.inputs.release_tag }}
|
|
33
|
+
build-args: |
|
|
34
|
+
BUILDKIT_CONTEXT_KEEP_GIT_DIR=true
|
|
35
|
+
- name: Clean docker cache
|
|
36
|
+
run: docker system prune --all --force
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
name: Release PyPi
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types:
|
|
6
|
+
- created
|
|
7
|
+
jobs:
|
|
8
|
+
release-job:
|
|
9
|
+
name: Build and publish on PyPi
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- name: Checkout
|
|
13
|
+
uses: actions/checkout@v2
|
|
14
|
+
- name: Set up Python
|
|
15
|
+
uses: actions/setup-python@v2
|
|
16
|
+
with:
|
|
17
|
+
python-version: "3.10"
|
|
18
|
+
- name: Build SDist and Wheel
|
|
19
|
+
run: ./.github/scripts/build_sdist_and_wheel.sh
|
|
20
|
+
- name: Check that the package version matches the Release name
|
|
21
|
+
run: |
|
|
22
|
+
grep -Rq "^Version: ${GITHUB_REF:10}$" outlines.egg-info/PKG-INFO
|
|
23
|
+
- name: Publish to PyPi
|
|
24
|
+
uses: pypa/gh-action-pypi-publish@v1.4.2
|
|
25
|
+
with:
|
|
26
|
+
user: __token__
|
|
27
|
+
password: ${{ secrets.PYPI_TOKEN }}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
name: Tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
branches: [main]
|
|
6
|
+
push:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
style:
|
|
11
|
+
name: Check the code style
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v3
|
|
15
|
+
- uses: actions/setup-python@v4
|
|
16
|
+
with:
|
|
17
|
+
python-version: "3.10"
|
|
18
|
+
- uses: pre-commit/action@v3.0.0
|
|
19
|
+
|
|
20
|
+
tests:
|
|
21
|
+
name: Run the tests
|
|
22
|
+
runs-on: ubuntu-latest
|
|
23
|
+
strategy:
|
|
24
|
+
matrix:
|
|
25
|
+
python-version: ["3.10"]
|
|
26
|
+
steps:
|
|
27
|
+
- uses: actions/checkout@v3
|
|
28
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
29
|
+
uses: actions/setup-python@v4
|
|
30
|
+
with:
|
|
31
|
+
python-version: ${{ matrix.python-version }}
|
|
32
|
+
- name: Set up test environment
|
|
33
|
+
run: |
|
|
34
|
+
python -m pip install --upgrade pip
|
|
35
|
+
pip install -e .[test]
|
|
36
|
+
- name: Create matrix id
|
|
37
|
+
id: matrix-id
|
|
38
|
+
env:
|
|
39
|
+
MATRIX_CONTEXT: ${{ toJson(matrix) }}
|
|
40
|
+
run: |
|
|
41
|
+
echo $MATRIX_CONTEXT
|
|
42
|
+
export MATRIX_ID=`echo $MATRIX_CONTEXT | md5sum | cut -c 1-32`
|
|
43
|
+
echo $MATRIX_ID
|
|
44
|
+
echo "::set-output name=id::$MATRIX_ID"
|
|
45
|
+
- name: Run tests
|
|
46
|
+
run: |
|
|
47
|
+
pytest --cov=outlines
|
|
48
|
+
env:
|
|
49
|
+
COVERAGE_FILE: .coverage.${{ steps.matrix-id.outputs.id }}
|
|
50
|
+
- name: Upload coverage data
|
|
51
|
+
uses: actions/upload-artifact@v4
|
|
52
|
+
with:
|
|
53
|
+
name: coverage-data
|
|
54
|
+
path: .coverage.*
|
|
55
|
+
if-no-files-found: ignore
|
|
56
|
+
include-hidden-files: true
|
|
57
|
+
# TODO FIXME: This is only using the last run
|
|
58
|
+
overwrite: true
|
|
59
|
+
|
|
60
|
+
coverage:
|
|
61
|
+
name: Combine & check coverage.
|
|
62
|
+
needs: tests
|
|
63
|
+
runs-on: ubuntu-latest
|
|
64
|
+
|
|
65
|
+
steps:
|
|
66
|
+
- uses: actions/checkout@v3
|
|
67
|
+
with:
|
|
68
|
+
fetch-depth: 0
|
|
69
|
+
|
|
70
|
+
- uses: actions/setup-python@v4
|
|
71
|
+
with:
|
|
72
|
+
cache: pip
|
|
73
|
+
python-version: "3.11"
|
|
74
|
+
|
|
75
|
+
- name: Set up environment
|
|
76
|
+
run: |
|
|
77
|
+
pip install --upgrade "coverage[toml]>=5.1" diff-cover
|
|
78
|
+
|
|
79
|
+
- uses: actions/download-artifact@v4
|
|
80
|
+
with:
|
|
81
|
+
name: coverage-data
|
|
82
|
+
|
|
83
|
+
- name: Fetch main for coverage diff
|
|
84
|
+
run: |
|
|
85
|
+
git fetch --no-tags --prune origin main
|
|
86
|
+
|
|
87
|
+
- name: Combine coverage & fail if it's <100%.
|
|
88
|
+
run: |
|
|
89
|
+
python -m coverage combine
|
|
90
|
+
python -m coverage html --skip-covered --skip-empty
|
|
91
|
+
python -m coverage xml
|
|
92
|
+
diff-cover coverage.xml --markdown-report=coverage.md --fail-under=100 || (cat coverage.md >> $GITHUB_STEP_SUMMARY && exit 1)
|
|
93
|
+
|
|
94
|
+
- name: Upload HTML report if check failed.
|
|
95
|
+
uses: actions/upload-artifact@v4
|
|
96
|
+
with:
|
|
97
|
+
name: html-report
|
|
98
|
+
path: htmlcov
|
|
99
|
+
# TODO FIXME: This is only using the last run
|
|
100
|
+
overwrite: true
|
|
101
|
+
if: ${{ failure() }}
|
|
102
|
+
|
|
103
|
+
build-wheel:
|
|
104
|
+
name: Build Wheel and Test SDist
|
|
105
|
+
runs-on: ubuntu-latest
|
|
106
|
+
steps:
|
|
107
|
+
- uses: actions/checkout@v3
|
|
108
|
+
- name: Build SDist and Wheel
|
|
109
|
+
run: ./.github/scripts/build_sdist_and_wheel.sh
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
3
|
+
rev: v4.4.0
|
|
4
|
+
hooks:
|
|
5
|
+
- id: check-merge-conflict
|
|
6
|
+
- id: debug-statements
|
|
7
|
+
- id: end-of-file-fixer
|
|
8
|
+
- id: trailing-whitespace
|
|
9
|
+
- repo: https://github.com/pycqa/isort
|
|
10
|
+
rev: 5.12.0
|
|
11
|
+
hooks:
|
|
12
|
+
- id: isort
|
|
13
|
+
args: [--profile, black]
|
|
14
|
+
- repo: https://github.com/asottile/pyupgrade
|
|
15
|
+
rev: v3.3.1
|
|
16
|
+
hooks:
|
|
17
|
+
- id: pyupgrade
|
|
18
|
+
args: [--py37-plus]
|
|
19
|
+
- repo: https://github.com/pycqa/flake8
|
|
20
|
+
rev: 6.0.0
|
|
21
|
+
hooks:
|
|
22
|
+
- id: flake8
|
|
23
|
+
- repo: https://github.com/psf/black
|
|
24
|
+
rev: 23.3.0
|
|
25
|
+
hooks:
|
|
26
|
+
- id: black
|
|
27
|
+
- repo: https://github.com/pre-commit/mirrors-mypy
|
|
28
|
+
rev: v1.2.0
|
|
29
|
+
hooks:
|
|
30
|
+
- id: mypy
|
|
31
|
+
args: [--allow-redefinition]
|
|
32
|
+
exclude: ^examples/
|
|
33
|
+
additional_dependencies: [types-tqdm, types-Pillow]
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
FROM python:3.10
|
|
2
|
+
|
|
3
|
+
WORKDIR /outlines
|
|
4
|
+
|
|
5
|
+
RUN pip install --upgrade pip
|
|
6
|
+
|
|
7
|
+
# Copy necessary build components
|
|
8
|
+
COPY pyproject.toml .
|
|
9
|
+
COPY outlines ./outlines
|
|
10
|
+
|
|
11
|
+
# Install outlines and outlines[serve]
|
|
12
|
+
# .git required by setuptools-scm
|
|
13
|
+
RUN --mount=source=.git,target=.git,type=bind \
|
|
14
|
+
pip install --no-cache-dir .[serve]
|
|
15
|
+
|
|
16
|
+
# https://dottxt-ai.github.io/outlines/reference/vllm/
|
|
17
|
+
ENTRYPOINT ["python3", "-m", "outlines.serve.serve"]
|