Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exllamav2 Integration #1010

Closed
wants to merge 33 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
8191d21
Exllamav2_filter
isamu-isozaki Jun 29, 2024
42978c4
Fix comment
isamu-isozaki Jun 29, 2024
d271fff
Fixed precommit issues
isamu-isozaki Jun 29, 2024
1bdcd4e
Removed text
isamu-isozaki Jul 10, 2024
ecf1d3c
Merge branch 'main' of https://github.com/outlines-dev/outlines into …
isamu-isozaki Jul 10, 2024
1a193a5
Merge branch 'main' of https://github.com/outlines-dev/outlines into …
isamu-isozaki Jul 21, 2024
37d2471
Basic draft done
isamu-isozaki Aug 1, 2024
a68ddd7
Passed local test
isamu-isozaki Aug 6, 2024
197718f
Fixed tests+precommit
isamu-isozaki Aug 13, 2024
df4bd6a
Revert change for pyairports
isamu-isozaki Aug 13, 2024
4ffdf34
Fixed precommit
isamu-isozaki Aug 13, 2024
39ecf7d
Wrap up
isamu-isozaki Aug 13, 2024
ab731bd
Remove | for union
isamu-isozaki Aug 13, 2024
4cda254
Attempt changing to List
isamu-isozaki Aug 13, 2024
f402f33
Fixed for 3.8
isamu-isozaki Aug 13, 2024
e014a63
Adding exllamav2 to optional dependency
isamu-isozaki Aug 19, 2024
06e9b64
Fixed model
isamu-isozaki Aug 19, 2024
f43e4d2
Changed to fork
isamu-isozaki Aug 19, 2024
7b29e8c
Fix format
isamu-isozaki Aug 19, 2024
8d1fca6
Changed order
isamu-isozaki Aug 19, 2024
09e4843
Skip exllamav2 tests
isamu-isozaki Aug 20, 2024
511591a
Merge branch 'main' into exllamav2_filter
isamu-isozaki Aug 20, 2024
785d7de
Attempt fixing coverage
isamu-isozaki Aug 30, 2024
91c3e7a
Merge branch 'main' of https://github.com/outlines-dev/outlines into …
isamu-isozaki Aug 30, 2024
faadf5b
Attempt fix coverage
isamu-isozaki Aug 30, 2024
2a909af
Merge branch 'exllamav2_filter' of https://github.com/isamu-isozaki/o…
isamu-isozaki Aug 30, 2024
7ca151c
Remove flash-attn requirement
isamu-isozaki Aug 30, 2024
2c241ff
Fixed fixture tests
isamu-isozaki Aug 30, 2024
a289b5a
Removed lora
isamu-isozaki Aug 30, 2024
c3681a8
Passed coverage
isamu-isozaki Aug 30, 2024
e6b3af6
Added back transformers install
isamu-isozaki Sep 20, 2024
5508c92
Fixed per review
isamu-isozaki Sep 20, 2024
b7e92a1
Made coverage 100%
isamu-isozaki Sep 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 1 addition & 12 deletions outlines/generate/fsm.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@

from outlines.fsm.guide import RegexGuide
from outlines.generate.api import (
SequenceGenerator,
SequenceGeneratorAdapter,
VisionSequenceGeneratorAdapter,
)
from outlines.models import ExLlamaV2Model, TransformersVision
from outlines.models import TransformersVision
from outlines.samplers import Sampler, multinomial


Expand All @@ -30,13 +29,3 @@ def fsm_vision(model, fsm: interegular.fsm.FSM, sampler: Sampler = multinomial()
fsm = RegexGuide.from_interegular_fsm(fsm, model.tokenizer)
logits_processor = FSMLogitsProcessor(tokenizer=model.tokenizer, fsm=fsm)
return VisionSequenceGeneratorAdapter(model, logits_processor, sampler)


@fsm.register(ExLlamaV2Model)
def fsm_exllamav2(
model, fsm: interegular.fsm.FSM, sampler: Sampler = multinomial()
) -> SequenceGenerator:
fsm = RegexGuide.from_interegular_fsm(fsm, model.tokenizer)
device = model.device
generator = SequenceGenerator(fsm, model, sampler, device)
return generator
18 changes: 1 addition & 17 deletions outlines/generate/regex.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
from functools import singledispatch

from outlines.fsm.guide import RegexGuide
from outlines.generate.api import (
SequenceGenerator,
SequenceGeneratorAdapter,
VisionSequenceGeneratorAdapter,
)
from outlines.models import ExLlamaV2Model, OpenAI, TransformersVision
from outlines.models import OpenAI, TransformersVision
from outlines.samplers import Sampler, multinomial


Expand Down Expand Up @@ -49,20 +47,6 @@ def regex_vision(
return VisionSequenceGeneratorAdapter(model, logits_processor, sampler)


@regex.register(ExLlamaV2Model)
def regex_exllamav2(
model,
regex_str: str,
sampler: Sampler = multinomial(),
) -> SequenceGenerator:
fsm = RegexGuide(regex_str, model.tokenizer)

device = model.device
generator = SequenceGenerator(fsm, model, sampler, device)

return generator


@regex.register(OpenAI)
def regex_openai(
model: OpenAI,
Expand Down
11 changes: 1 addition & 10 deletions outlines/generate/text.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
from functools import singledispatch

from outlines.fsm.guide import StopAtEOSGuide
from outlines.generate.api import (
SequenceGenerator,
SequenceGeneratorAdapter,
VisionSequenceGeneratorAdapter,
)
from outlines.models import ExLlamaV2Model, OpenAI, TransformersVision
from outlines.models import OpenAI, TransformersVision
from outlines.samplers import Sampler, multinomial


Expand Down Expand Up @@ -36,13 +34,6 @@ def text(model, sampler: Sampler = multinomial()) -> SequenceGeneratorAdapter:
return SequenceGeneratorAdapter(model, None, sampler)


@text.register(ExLlamaV2Model)
def text_exllamav2(model, sampler: Sampler = multinomial()) -> SequenceGenerator:
fsm = StopAtEOSGuide(model.tokenizer)
device = model.device
return SequenceGenerator(fsm, model, sampler, device)


@text.register(TransformersVision)
def text_vision(model, sampler: Sampler = multinomial()):
return VisionSequenceGeneratorAdapter(model, None, sampler)
Expand Down
Loading
Loading