Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

support for falcon #676

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

Merged
merged 1 commit into from
Jun 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions 1 pgml-extension/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ tqdm==4.65.0
transformers==4.29.2
xgboost==1.7.5
langchain==0.0.180
einops==0.6.1
4 changes: 4 additions & 0 deletions 4 pgml-extension/src/bindings/transformers.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ def transform(task, args, inputs):
ensure_device(task)
convert_dtype(task)

model = task.get("model", None)
if model and "tokenizer" not in task:
task["tokenizer"] = AutoTokenizer.from_pretrained(model)

if key not in __cache_transform_pipeline_by_task:
__cache_transform_pipeline_by_task[key] = transformers.pipeline(**task)
pipe = __cache_transform_pipeline_by_task[key]
Expand Down
17 changes: 12 additions & 5 deletions 17 pgml-extension/src/bindings/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,24 @@ pub fn transform(
let results = Python::with_gil(|py| -> String {
let transform: Py<PyAny> = PY_MODULE.getattr(py, "transform").unwrap().into();

transform
let result = transform
.call1(
py,
PyTuple::new(
py,
&[task.into_py(py), args.into_py(py), inputs.into_py(py)],
),
)
.unwrap()
.extract(py)
.unwrap()
);

let result = match result {
Err(e) => {
let traceback = e.traceback(py).unwrap().format().unwrap();
error!("{traceback} {e}")
}
Ok(o) => o.extract(py).unwrap(),
};

result
});
serde_json::from_str(&results).unwrap()
}
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.