Skip to content

Commit

Permalink
Remove logits processors
Browse files Browse the repository at this point in the history
  • Loading branch information
rlouf committed Aug 15, 2024
1 parent 82fea26 commit 00b3d33
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 668 deletions.
108 changes: 0 additions & 108 deletions benchmarks/bench_processors.py

This file was deleted.

1 change: 0 additions & 1 deletion outlines/integrations/__init__.py

This file was deleted.

159 changes: 0 additions & 159 deletions outlines/integrations/transformers.py

This file was deleted.

64 changes: 1 addition & 63 deletions outlines/integrations/utils.py
Original file line number Diff line number Diff line change
@@ -1,34 +1,5 @@
"""Utility functions used in integrations with other packages.
from typing import Union

_______________________________
/ Don't want to self-host? \
\\ Try .json at http://dottxt.co /
-------------------------------
\\ ^__^
\\ (oo)\\_______
(__)\\ )\\/\
||----w |
|| ||
Copyright 2024- the Outlines developers
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""

import json
from typing import Type, Union

from pydantic import BaseModel
from transformers import SPIECE_UNDERLINE, PreTrainedTokenizerBase


Expand Down Expand Up @@ -68,36 +39,3 @@ def convert_token_to_string(token: Union[str, bytes]) -> str:
tokenizer.convert_token_to_string = convert_token_to_string

return tokenizer


def convert_json_schema_to_str(json_schema: Union[dict, str, Type[BaseModel]]) -> str:
"""Convert a JSON schema to a string.
Parameters
----------
json_schema
The JSON schema.
Returns
-------
str
The JSON schema converted to a string.
Raises
------
ValueError
If the schema is not a dictionary, a string or a Pydantic class.
"""
if isinstance(json_schema, dict):
schema_str = json.dumps(json_schema)
elif isinstance(json_schema, str):
schema_str = json_schema
elif issubclass(json_schema, BaseModel):
schema_str = json.dumps(json_schema.model_json_schema())
else:
raise ValueError(
f"Cannot parse schema {json_schema}. The schema must be either "
+ "a Pydantic class, a dictionary or a string that contains the JSON "
+ "schema specification"
)
return schema_str
7 changes: 0 additions & 7 deletions outlines/processors/__init__.py

This file was deleted.

Loading

0 comments on commit 00b3d33

Please sign in to comment.