Skip to content

Commit d9f9c64

Browse files
authored
[Codegen][ORT][Static Seq Length] TextGenerationPipeline (#946)
* initial commit * coreys simplifications * finishing the second model static * ready, time for beautification * ready for review * moved the code to examples * fix eos logic * add argument num_tokens_to_generate
1 parent 20db2f8 commit d9f9c64

File tree

4 files changed

+533
-5
lines changed

4 files changed

+533
-5
lines changed

examples/codegen/README.md

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<!--
2+
Copyright (c) 2021 - present / Neuralmagic, Inc. All Rights Reserved.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing,
11+
software distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
-->
16+
17+
Example of how to run the pipeline:
18+
19+
```python
20+
from examples.codegen.text_generation import TextGenerationPipeline
21+
22+
codegen = TextGenerationPipeline(
23+
model_path="/network/damian/static-codegen-350M-multi",
24+
engine_type="onnxruntime",
25+
sequence_length=128, )
26+
27+
out = codegen(sequences=["def hello_world():", "def fibonacci(x):"])
28+
for seq in out.sequences:
29+
print(seq)
30+
```

0 commit comments

Comments
 (0)