1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
|
%global _empty_manifest_terminate_build 0
Name: python-pipeline-ai
Version: 0.4.6
Release: 1
Summary: Pipelines for machine learning workloads.
License: Apache-2.0
URL: https://pypi.org/project/pipeline-ai/
Source0: https://mirrors.nju.edu.cn/pypi/web/packages/22/63/04ef9534c8726905671d2cefd724301cd83bb5fe8eb2f4555dee9f80a4e9/pipeline_ai-0.4.6.tar.gz
BuildArch: noarch
Requires: python3-PyYAML
Requires: python3-cloudpickle
Requires: python3-dill
Requires: python3-httpx
Requires: python3-packaging
Requires: python3-pydantic
Requires: python3-pyhumps
Requires: python3-setuptools
Requires: python3-tabulate
Requires: python3-tqdm
%description
# [Pipeline](https://pipeline.ai) [](https://pypi.org/project/pipeline-ai)   [](https://www.apache.org/licenses/LICENSE-2.0) [](https://discord.gg/eJQRkBdEcs)
[_powered by mystic_](https://www.mystic.ai/)
# Table of Contents
- [About](#about)
- [Version roadmap](#version-roadmap)
- [v0.4.0](#v040-jan-2023)
- [v0.5.0](#v050-janfeb-2023)
- [Beyond](#beyond)
- [Quickstart](#quickstart)
- [Basic maths](#basic-maths)
- [Transformers (GPT-Neo 125M)](#transformers-gpt-neo-125m)
- [Installation instructions](#installation-instructions)
- [Linux, Mac (intel)](#linux--mac--intel-)
- [Mac (arm/M1)](#mac--arm-m1-)
- [Development](#development)
- [License](#license)
# About
Pipeline is a python library that provides a simple way to construct computational graphs for AI/ML. The library is suitable for both development and production environments supporting inference and training/finetuning. This library is also a direct interface to [Pipeline.ai](https://pipeline.ai) which provides a compute engine to run pipelines at scale and on enterprise GPUs.
The syntax used for defining AI/ML pipelines shares some similarities in syntax to sessions in [Tensorflow v1](https://www.tensorflow.org/api_docs/python/tf/compat/v1/InteractiveSession), and Flows found in [Prefect](https://github.com/PrefectHQ/prefect). In future releases we will be moving away from this syntax to a C based graph compiler which interprets python directly (and other languages) allowing users of the API to compose graphs in a more native way to the chosen language.
# Version roadmap
## v0.4.0 (Jan 2023)
- Custom environments on PipelineCloud (remote compute services)
- Kwarg inputs to runs
- Extended IO inputs to `pipeline_function` objects
## v0.5.0 (Jan/Feb 2023)
- Pipeline chaining
- `if` statements & `while/for` loops
## Beyond
- Run log streaming
- Run progress tracking
- Resource dedication
- Pipeline scecific remote load balancer (10% of traffic to one pipeline 80% to another)
- Usage capping
- Run result streaming
- Progromatic autoscaling
- Alerts
- Events
- Different python versions on remote compute services
# Quickstart
> :warning: **Uploading pipelines to Pipeline Cloud works best in Python 3.9.** We strongly recommend you use Python 3.9 when uploading pipelines because the `pipeline-ai` library is still in beta and is known to cause opaque errors when pipelines are serialised from a non-3.9 environment.
## Basic maths
```python
from pipeline import Pipeline, Variable, pipeline_function
@pipeline_function
def square(a: float) -> float:
return a**2
@pipeline_function
def multiply(a: float, b: float) -> float:
return a * b
with Pipeline("maths") as pipeline:
flt_1 = Variable(type_class=float, is_input=True)
flt_2 = Variable(type_class=float, is_input=True)
pipeline.add_variables(flt_1, flt_2)
sq_1 = square(flt_1)
res_1 = multiply(flt_2, sq_1)
pipeline.output(res_1)
output_pipeline = Pipeline.get_pipeline("maths")
print(output_pipeline.run(5.0, 6.0))
```
## Transformers (GPT-Neo 125M)
_Note: requires `torch` and `transformers` as dependencies._
```python
from pipeline import Pipeline, Variable
from pipeline.objects.huggingface.TransformersModelForCausalLM import (
TransformersModelForCausalLM,
)
with Pipeline("hf-pipeline") as builder:
input_str = Variable(str, is_input=True)
model_kwargs = Variable(dict, is_input=True)
builder.add_variables(input_str, model_kwargs)
hf_model = TransformersModelForCausalLM(
model_path="EleutherAI/gpt-neo-125M",
tokenizer_path="EleutherAI/gpt-neo-125M",
)
hf_model.load()
output_str = hf_model.predict(input_str, model_kwargs)
builder.output(output_str)
output_pipeline = Pipeline.get_pipeline("hf-pipeline")
print(
output_pipeline.run(
"Hello my name is", {"min_length": 100, "max_length": 150, "temperature": 0.5}
)
)
```
# Installation instructions
## Linux, Mac (intel)
```shell
pip install -U pipeline-ai
```
## Mac (arm/M1)
Due to the ARM architecture of the M1 core it is necessary to take additional steps to install Pipeline, mostly due to the transformers library. We recoomend running inside of a conda environment as shown below.
1. Make sure Rosetta2 is disabled.
2. From terminal run:
```
xcode-select --install
```
3. Install Miniforge, instructions here: [https://github.com/conda-forge/miniforge](https://github.com/conda-forge/miniforge) or follow the below:
1. Download the Miniforge install script here: [https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-MacOSX-arm64.sh](https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-MacOSX-arm64.sh)
2. Make the shell executable and run
```
sudo chmod 775 Miniforge3-MacOSX-arm64.sh
./Miniforge3-MacOSX-arm64.sh
```
4. Create a conda based virtual env and activate:
```
conda create --name pipeline-env python=3.9
conda activate pipeline-env
```
5. Install tensorflow
```
conda install -c apple tensorflow-deps
python -m pip install -U pip
python -m pip install -U tensorflow-macos
python -m pip install -U tensorflow-metal
```
6. Install transformers
```
conda install -c huggingface transformers -y
```
7. Install pipeline
```
python -m pip install -U pipeline-ai
```
# Development
This project is made with poetry, [so firstly setup poetry on your machine](https://python-poetry.org/docs/#installation).
Once that is done, please run
sh setup.sh
With this you should be good to go. This sets up dependencies, pre-commit hooks and
pre-push hooks.
You can manually run pre commit hooks with
pre-commit run --all-files
To run tests manually please run
pytest
# License
Pipeline is licensed under [Apache Software License Version 2.0](https://www.apache.org/licenses/LICENSE-2.0).
%package -n python3-pipeline-ai
Summary: Pipelines for machine learning workloads.
Provides: python-pipeline-ai
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-pip
%description -n python3-pipeline-ai
# [Pipeline](https://pipeline.ai) [](https://pypi.org/project/pipeline-ai)   [](https://www.apache.org/licenses/LICENSE-2.0) [](https://discord.gg/eJQRkBdEcs)
[_powered by mystic_](https://www.mystic.ai/)
# Table of Contents
- [About](#about)
- [Version roadmap](#version-roadmap)
- [v0.4.0](#v040-jan-2023)
- [v0.5.0](#v050-janfeb-2023)
- [Beyond](#beyond)
- [Quickstart](#quickstart)
- [Basic maths](#basic-maths)
- [Transformers (GPT-Neo 125M)](#transformers-gpt-neo-125m)
- [Installation instructions](#installation-instructions)
- [Linux, Mac (intel)](#linux--mac--intel-)
- [Mac (arm/M1)](#mac--arm-m1-)
- [Development](#development)
- [License](#license)
# About
Pipeline is a python library that provides a simple way to construct computational graphs for AI/ML. The library is suitable for both development and production environments supporting inference and training/finetuning. This library is also a direct interface to [Pipeline.ai](https://pipeline.ai) which provides a compute engine to run pipelines at scale and on enterprise GPUs.
The syntax used for defining AI/ML pipelines shares some similarities in syntax to sessions in [Tensorflow v1](https://www.tensorflow.org/api_docs/python/tf/compat/v1/InteractiveSession), and Flows found in [Prefect](https://github.com/PrefectHQ/prefect). In future releases we will be moving away from this syntax to a C based graph compiler which interprets python directly (and other languages) allowing users of the API to compose graphs in a more native way to the chosen language.
# Version roadmap
## v0.4.0 (Jan 2023)
- Custom environments on PipelineCloud (remote compute services)
- Kwarg inputs to runs
- Extended IO inputs to `pipeline_function` objects
## v0.5.0 (Jan/Feb 2023)
- Pipeline chaining
- `if` statements & `while/for` loops
## Beyond
- Run log streaming
- Run progress tracking
- Resource dedication
- Pipeline scecific remote load balancer (10% of traffic to one pipeline 80% to another)
- Usage capping
- Run result streaming
- Progromatic autoscaling
- Alerts
- Events
- Different python versions on remote compute services
# Quickstart
> :warning: **Uploading pipelines to Pipeline Cloud works best in Python 3.9.** We strongly recommend you use Python 3.9 when uploading pipelines because the `pipeline-ai` library is still in beta and is known to cause opaque errors when pipelines are serialised from a non-3.9 environment.
## Basic maths
```python
from pipeline import Pipeline, Variable, pipeline_function
@pipeline_function
def square(a: float) -> float:
return a**2
@pipeline_function
def multiply(a: float, b: float) -> float:
return a * b
with Pipeline("maths") as pipeline:
flt_1 = Variable(type_class=float, is_input=True)
flt_2 = Variable(type_class=float, is_input=True)
pipeline.add_variables(flt_1, flt_2)
sq_1 = square(flt_1)
res_1 = multiply(flt_2, sq_1)
pipeline.output(res_1)
output_pipeline = Pipeline.get_pipeline("maths")
print(output_pipeline.run(5.0, 6.0))
```
## Transformers (GPT-Neo 125M)
_Note: requires `torch` and `transformers` as dependencies._
```python
from pipeline import Pipeline, Variable
from pipeline.objects.huggingface.TransformersModelForCausalLM import (
TransformersModelForCausalLM,
)
with Pipeline("hf-pipeline") as builder:
input_str = Variable(str, is_input=True)
model_kwargs = Variable(dict, is_input=True)
builder.add_variables(input_str, model_kwargs)
hf_model = TransformersModelForCausalLM(
model_path="EleutherAI/gpt-neo-125M",
tokenizer_path="EleutherAI/gpt-neo-125M",
)
hf_model.load()
output_str = hf_model.predict(input_str, model_kwargs)
builder.output(output_str)
output_pipeline = Pipeline.get_pipeline("hf-pipeline")
print(
output_pipeline.run(
"Hello my name is", {"min_length": 100, "max_length": 150, "temperature": 0.5}
)
)
```
# Installation instructions
## Linux, Mac (intel)
```shell
pip install -U pipeline-ai
```
## Mac (arm/M1)
Due to the ARM architecture of the M1 core it is necessary to take additional steps to install Pipeline, mostly due to the transformers library. We recoomend running inside of a conda environment as shown below.
1. Make sure Rosetta2 is disabled.
2. From terminal run:
```
xcode-select --install
```
3. Install Miniforge, instructions here: [https://github.com/conda-forge/miniforge](https://github.com/conda-forge/miniforge) or follow the below:
1. Download the Miniforge install script here: [https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-MacOSX-arm64.sh](https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-MacOSX-arm64.sh)
2. Make the shell executable and run
```
sudo chmod 775 Miniforge3-MacOSX-arm64.sh
./Miniforge3-MacOSX-arm64.sh
```
4. Create a conda based virtual env and activate:
```
conda create --name pipeline-env python=3.9
conda activate pipeline-env
```
5. Install tensorflow
```
conda install -c apple tensorflow-deps
python -m pip install -U pip
python -m pip install -U tensorflow-macos
python -m pip install -U tensorflow-metal
```
6. Install transformers
```
conda install -c huggingface transformers -y
```
7. Install pipeline
```
python -m pip install -U pipeline-ai
```
# Development
This project is made with poetry, [so firstly setup poetry on your machine](https://python-poetry.org/docs/#installation).
Once that is done, please run
sh setup.sh
With this you should be good to go. This sets up dependencies, pre-commit hooks and
pre-push hooks.
You can manually run pre commit hooks with
pre-commit run --all-files
To run tests manually please run
pytest
# License
Pipeline is licensed under [Apache Software License Version 2.0](https://www.apache.org/licenses/LICENSE-2.0).
%package help
Summary: Development documents and examples for pipeline-ai
Provides: python3-pipeline-ai-doc
%description help
# [Pipeline](https://pipeline.ai) [](https://pypi.org/project/pipeline-ai)   [](https://www.apache.org/licenses/LICENSE-2.0) [](https://discord.gg/eJQRkBdEcs)
[_powered by mystic_](https://www.mystic.ai/)
# Table of Contents
- [About](#about)
- [Version roadmap](#version-roadmap)
- [v0.4.0](#v040-jan-2023)
- [v0.5.0](#v050-janfeb-2023)
- [Beyond](#beyond)
- [Quickstart](#quickstart)
- [Basic maths](#basic-maths)
- [Transformers (GPT-Neo 125M)](#transformers-gpt-neo-125m)
- [Installation instructions](#installation-instructions)
- [Linux, Mac (intel)](#linux--mac--intel-)
- [Mac (arm/M1)](#mac--arm-m1-)
- [Development](#development)
- [License](#license)
# About
Pipeline is a python library that provides a simple way to construct computational graphs for AI/ML. The library is suitable for both development and production environments supporting inference and training/finetuning. This library is also a direct interface to [Pipeline.ai](https://pipeline.ai) which provides a compute engine to run pipelines at scale and on enterprise GPUs.
The syntax used for defining AI/ML pipelines shares some similarities in syntax to sessions in [Tensorflow v1](https://www.tensorflow.org/api_docs/python/tf/compat/v1/InteractiveSession), and Flows found in [Prefect](https://github.com/PrefectHQ/prefect). In future releases we will be moving away from this syntax to a C based graph compiler which interprets python directly (and other languages) allowing users of the API to compose graphs in a more native way to the chosen language.
# Version roadmap
## v0.4.0 (Jan 2023)
- Custom environments on PipelineCloud (remote compute services)
- Kwarg inputs to runs
- Extended IO inputs to `pipeline_function` objects
## v0.5.0 (Jan/Feb 2023)
- Pipeline chaining
- `if` statements & `while/for` loops
## Beyond
- Run log streaming
- Run progress tracking
- Resource dedication
- Pipeline scecific remote load balancer (10% of traffic to one pipeline 80% to another)
- Usage capping
- Run result streaming
- Progromatic autoscaling
- Alerts
- Events
- Different python versions on remote compute services
# Quickstart
> :warning: **Uploading pipelines to Pipeline Cloud works best in Python 3.9.** We strongly recommend you use Python 3.9 when uploading pipelines because the `pipeline-ai` library is still in beta and is known to cause opaque errors when pipelines are serialised from a non-3.9 environment.
## Basic maths
```python
from pipeline import Pipeline, Variable, pipeline_function
@pipeline_function
def square(a: float) -> float:
return a**2
@pipeline_function
def multiply(a: float, b: float) -> float:
return a * b
with Pipeline("maths") as pipeline:
flt_1 = Variable(type_class=float, is_input=True)
flt_2 = Variable(type_class=float, is_input=True)
pipeline.add_variables(flt_1, flt_2)
sq_1 = square(flt_1)
res_1 = multiply(flt_2, sq_1)
pipeline.output(res_1)
output_pipeline = Pipeline.get_pipeline("maths")
print(output_pipeline.run(5.0, 6.0))
```
## Transformers (GPT-Neo 125M)
_Note: requires `torch` and `transformers` as dependencies._
```python
from pipeline import Pipeline, Variable
from pipeline.objects.huggingface.TransformersModelForCausalLM import (
TransformersModelForCausalLM,
)
with Pipeline("hf-pipeline") as builder:
input_str = Variable(str, is_input=True)
model_kwargs = Variable(dict, is_input=True)
builder.add_variables(input_str, model_kwargs)
hf_model = TransformersModelForCausalLM(
model_path="EleutherAI/gpt-neo-125M",
tokenizer_path="EleutherAI/gpt-neo-125M",
)
hf_model.load()
output_str = hf_model.predict(input_str, model_kwargs)
builder.output(output_str)
output_pipeline = Pipeline.get_pipeline("hf-pipeline")
print(
output_pipeline.run(
"Hello my name is", {"min_length": 100, "max_length": 150, "temperature": 0.5}
)
)
```
# Installation instructions
## Linux, Mac (intel)
```shell
pip install -U pipeline-ai
```
## Mac (arm/M1)
Due to the ARM architecture of the M1 core it is necessary to take additional steps to install Pipeline, mostly due to the transformers library. We recoomend running inside of a conda environment as shown below.
1. Make sure Rosetta2 is disabled.
2. From terminal run:
```
xcode-select --install
```
3. Install Miniforge, instructions here: [https://github.com/conda-forge/miniforge](https://github.com/conda-forge/miniforge) or follow the below:
1. Download the Miniforge install script here: [https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-MacOSX-arm64.sh](https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-MacOSX-arm64.sh)
2. Make the shell executable and run
```
sudo chmod 775 Miniforge3-MacOSX-arm64.sh
./Miniforge3-MacOSX-arm64.sh
```
4. Create a conda based virtual env and activate:
```
conda create --name pipeline-env python=3.9
conda activate pipeline-env
```
5. Install tensorflow
```
conda install -c apple tensorflow-deps
python -m pip install -U pip
python -m pip install -U tensorflow-macos
python -m pip install -U tensorflow-metal
```
6. Install transformers
```
conda install -c huggingface transformers -y
```
7. Install pipeline
```
python -m pip install -U pipeline-ai
```
# Development
This project is made with poetry, [so firstly setup poetry on your machine](https://python-poetry.org/docs/#installation).
Once that is done, please run
sh setup.sh
With this you should be good to go. This sets up dependencies, pre-commit hooks and
pre-push hooks.
You can manually run pre commit hooks with
pre-commit run --all-files
To run tests manually please run
pytest
# License
Pipeline is licensed under [Apache Software License Version 2.0](https://www.apache.org/licenses/LICENSE-2.0).
%prep
%autosetup -n pipeline-ai-0.4.6
%build
%py3_build
%install
%py3_install
install -d -m755 %{buildroot}/%{_pkgdocdir}
if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
pushd %{buildroot}
if [ -d usr/lib ]; then
find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/lib64 ]; then
find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/bin ]; then
find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/sbin ]; then
find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
fi
touch doclist.lst
if [ -d usr/share/man ]; then
find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
fi
popd
mv %{buildroot}/filelist.lst .
mv %{buildroot}/doclist.lst .
%files -n python3-pipeline-ai -f filelist.lst
%dir %{python3_sitelib}/*
%files help -f doclist.lst
%{_docdir}/*
%changelog
* Mon May 15 2023 Python_Bot <Python_Bot@openeuler.org> - 0.4.6-1
- Package Spec generated
|