truefoundry 0.5.7rc1__py3-none-any.whl → 0.5.8__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of truefoundry might be problematic. Click here for more details.
- truefoundry/cli/__main__.py +2 -2
- truefoundry/common/credential_provider.py +1 -1
- truefoundry/common/entities.py +15 -15
- truefoundry/common/servicefoundry_client.py +7 -2
- truefoundry/common/session.py +1 -2
- truefoundry/common/types.py +7 -0
- truefoundry/common/utils.py +1 -1
- truefoundry/deploy/auto_gen/models.py +11 -3
- truefoundry/deploy/builder/docker_service.py +1 -1
- truefoundry/deploy/cli/commands/delete_command.py +40 -8
- truefoundry/deploy/cli/commands/deploy_command.py +3 -5
- truefoundry/deploy/lib/clients/servicefoundry_client.py +14 -7
- truefoundry/deploy/lib/dao/delete.py +88 -0
- truefoundry/deploy/lib/messages.py +1 -0
- truefoundry/deploy/lib/model/entity.py +5 -0
- truefoundry/deploy/lib/session.py +2 -5
- truefoundry/deploy/python_deploy_codegen.py +1 -1
- truefoundry/deploy/v2/lib/deploy.py +5 -5
- truefoundry/deploy/v2/lib/deploy_workflow.py +8 -5
- truefoundry/deploy/v2/lib/deployable_patched_models.py +13 -9
- truefoundry/deploy/v2/lib/models.py +1 -1
- truefoundry/deploy/v2/lib/patched_models.py +1 -1
- truefoundry/deploy/v2/lib/source.py +2 -1
- truefoundry/ml/autogen/client/api/health_api.py +1 -2
- truefoundry/ml/autogen/client/exceptions.py +1 -1
- truefoundry/ml/autogen/models/schema.py +1 -1
- truefoundry/ml/log_types/plot.py +2 -2
- truefoundry/ml/mlfoundry_run.py +1 -1
- truefoundry/ml/session.py +1 -2
- truefoundry-0.5.8.dist-info/METADATA +72 -0
- {truefoundry-0.5.7rc1.dist-info → truefoundry-0.5.8.dist-info}/RECORD +67 -70
- {truefoundry-0.5.7rc1.dist-info → truefoundry-0.5.8.dist-info}/WHEEL +1 -1
- truefoundry-0.5.8.dist-info/entry_points.txt +3 -0
- truefoundry/workflow/example/deploy.sh +0 -1
- truefoundry/workflow/example/hello_world_package/workflow.py +0 -20
- truefoundry/workflow/example/package/test_workflow.py +0 -151
- truefoundry/workflow/example/truefoundry.yaml +0 -9
- truefoundry/workflow/example/workflow.yaml +0 -116
- truefoundry-0.5.7rc1.dist-info/METADATA +0 -79
- truefoundry-0.5.7rc1.dist-info/entry_points.txt +0 -4
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
from functools import partial
|
|
3
|
-
from pathlib import Path
|
|
4
|
-
from typing import List, Optional, Tuple
|
|
5
|
-
|
|
6
|
-
from truefoundry.deploy import Image, NvidiaGPU, Resources
|
|
7
|
-
from truefoundry.workflow import (
|
|
8
|
-
ContainerTask,
|
|
9
|
-
ContainerTaskConfig,
|
|
10
|
-
FlyteDirectory,
|
|
11
|
-
PythonTaskConfig,
|
|
12
|
-
TaskPythonBuild,
|
|
13
|
-
conditional,
|
|
14
|
-
map_task,
|
|
15
|
-
task,
|
|
16
|
-
workflow,
|
|
17
|
-
)
|
|
18
|
-
|
|
19
|
-
cpu_task_config = PythonTaskConfig(
|
|
20
|
-
image=TaskPythonBuild(
|
|
21
|
-
python_version="3.9",
|
|
22
|
-
pip_packages=["truefoundry[workflow]==0.4.1"],
|
|
23
|
-
),
|
|
24
|
-
resources=Resources(cpu_request=0.45),
|
|
25
|
-
service_account="tfy-workflows-sa",
|
|
26
|
-
)
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
# figure out naming
|
|
30
|
-
@task(task_config=cpu_task_config)
|
|
31
|
-
def should_train_tokenizer(tokenizer: str) -> bool:
|
|
32
|
-
print("Should train tokenizer")
|
|
33
|
-
return not bool(tokenizer)
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
@task(
|
|
37
|
-
task_config=cpu_task_config,
|
|
38
|
-
# currently we will not support the caching, but keeping here for now
|
|
39
|
-
# cache=True,
|
|
40
|
-
# cache_version="1.0",
|
|
41
|
-
)
|
|
42
|
-
def train_tokenizer() -> str:
|
|
43
|
-
print("Training tokenizer")
|
|
44
|
-
return "trained_tokenizer"
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
@task(
|
|
48
|
-
task_config=PythonTaskConfig(
|
|
49
|
-
image=TaskPythonBuild(
|
|
50
|
-
python_version="3.9",
|
|
51
|
-
pip_packages=["truefoundry[workflow]==0.4.1", "pynvml==11.5.0"],
|
|
52
|
-
cuda_version="11.5-cudnn8",
|
|
53
|
-
),
|
|
54
|
-
env={
|
|
55
|
-
"NVIDIA_DRIVER_CAPABILITIES": "compute,utility",
|
|
56
|
-
"NVIDIA_VISIBLE_DEVICES": "all",
|
|
57
|
-
},
|
|
58
|
-
resources=Resources(cpu_request=0.45, devices=[NvidiaGPU(name="T4", count=1)]),
|
|
59
|
-
service_account="tfy-workflows-sa",
|
|
60
|
-
),
|
|
61
|
-
)
|
|
62
|
-
def train_model(tokenizer: str) -> Tuple[FlyteDirectory, str]:
|
|
63
|
-
print("Training model")
|
|
64
|
-
import flytekit
|
|
65
|
-
# from pynvml import nvmlDeviceGetCount, nvmlInit
|
|
66
|
-
|
|
67
|
-
# nvmlInit()
|
|
68
|
-
# assert nvmlDeviceGetCount() > 0
|
|
69
|
-
|
|
70
|
-
working_dir = flytekit.current_context().working_directory
|
|
71
|
-
local_dir = Path(os.path.join(working_dir, "csv_files"))
|
|
72
|
-
local_dir.mkdir(exist_ok=True)
|
|
73
|
-
|
|
74
|
-
with open(os.path.join(local_dir, "model"), "w", encoding="utf-8") as f:
|
|
75
|
-
f.write(tokenizer)
|
|
76
|
-
|
|
77
|
-
return FlyteDirectory(path=str(local_dir)), "hello"
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
@task(task_config=cpu_task_config)
|
|
81
|
-
def get_validation_data() -> List[str]:
|
|
82
|
-
print("Getting validation data")
|
|
83
|
-
return ["foo", "bar", "baz"]
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
@task(task_config=cpu_task_config)
|
|
87
|
-
def validate_model(model: FlyteDirectory, tokenizer: str, validation_data: str) -> bool:
|
|
88
|
-
print(validation_data)
|
|
89
|
-
model_path = os.path.join(model, "model")
|
|
90
|
-
with open(model_path, "r", encoding="utf-8") as f:
|
|
91
|
-
return f.read() == tokenizer
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
@task(task_config=cpu_task_config)
|
|
95
|
-
def all_good(validations: List[bool]) -> bool:
|
|
96
|
-
print("Validations", validations)
|
|
97
|
-
return all(validations)
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
echo = ContainerTask(
|
|
101
|
-
name="echo",
|
|
102
|
-
task_config=ContainerTaskConfig(
|
|
103
|
-
image=Image(
|
|
104
|
-
image_uri="docker.io/bash:4.1",
|
|
105
|
-
command=["echo", "hello"],
|
|
106
|
-
),
|
|
107
|
-
service_account="tfy-workflows-sa",
|
|
108
|
-
),
|
|
109
|
-
)
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
@task(task_config=cpu_task_config)
|
|
113
|
-
def random(tokenizer: str) -> Tuple[FlyteDirectory, str]:
|
|
114
|
-
print(tokenizer)
|
|
115
|
-
return FlyteDirectory(path=""), "random"
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
@workflow(
|
|
119
|
-
# execution_configs=[
|
|
120
|
-
# ExecutionConfig(
|
|
121
|
-
# schedule="*/10 * * * *",
|
|
122
|
-
# )
|
|
123
|
-
# ]
|
|
124
|
-
)
|
|
125
|
-
def train(
|
|
126
|
-
tokenizer: str = "",
|
|
127
|
-
test_v2: str = "",
|
|
128
|
-
optional_var: Optional[str] = "",
|
|
129
|
-
default_v: Optional[str] = "hello1",
|
|
130
|
-
default_v2: str = "hello2",
|
|
131
|
-
) -> bool:
|
|
132
|
-
stt = should_train_tokenizer(tokenizer=tokenizer)
|
|
133
|
-
model, t = (
|
|
134
|
-
conditional("train_tokenizer")
|
|
135
|
-
.if_(stt.is_true())
|
|
136
|
-
.then(train_model(tokenizer=tokenizer))
|
|
137
|
-
.else_()
|
|
138
|
-
.then(random(tokenizer=tokenizer))
|
|
139
|
-
)
|
|
140
|
-
validation_task = partial(validate_model, model=model, tokenizer=t)
|
|
141
|
-
validation_data = get_validation_data()
|
|
142
|
-
validations = map_task(
|
|
143
|
-
validation_task,
|
|
144
|
-
concurrency=2,
|
|
145
|
-
)(validation_data=validation_data)
|
|
146
|
-
echo()
|
|
147
|
-
return all_good(validations=validations)
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
if __name__ == "__main__":
|
|
151
|
-
train()
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
type: workflow
|
|
2
|
-
name: my-test-workflow5
|
|
3
|
-
source:
|
|
4
|
-
type: remote
|
|
5
|
-
remote_uri: s3://tfy-mlfoundry-tfy-ctl-euwe1-devtest20221012173221749100000002/tfy-ctl-euwe1-devtest:nikhil-ws/my-test-workflow5/clyhb79w4013l01oyfq1iawd5/package.tar.gz
|
|
6
|
-
workflow_file_path: hello_world_package/workflow.py
|
|
7
|
-
docker_registry: docker.io/nikp-test
|
|
8
|
-
flyte_entities:
|
|
9
|
-
- template:
|
|
10
|
-
id:
|
|
11
|
-
resourceType: TASK
|
|
12
|
-
name: hello_world_package.workflow.say_hello
|
|
13
|
-
type: python-task
|
|
14
|
-
metadata:
|
|
15
|
-
runtime:
|
|
16
|
-
type: FLYTE_SDK
|
|
17
|
-
version: 1.12.2
|
|
18
|
-
flavor: python
|
|
19
|
-
retries: {}
|
|
20
|
-
interface:
|
|
21
|
-
inputs: {}
|
|
22
|
-
outputs:
|
|
23
|
-
variables:
|
|
24
|
-
o0:
|
|
25
|
-
type:
|
|
26
|
-
simple: STRING
|
|
27
|
-
description: o0
|
|
28
|
-
custom:
|
|
29
|
-
truefoundry:
|
|
30
|
-
type: python-task-config
|
|
31
|
-
image:
|
|
32
|
-
type: task-python-build
|
|
33
|
-
python_version: '3.9'
|
|
34
|
-
pip_packages:
|
|
35
|
-
- flytekit==1.10.3
|
|
36
|
-
resources:
|
|
37
|
-
cpu_request: 0.2
|
|
38
|
-
cpu_limit: 0.5
|
|
39
|
-
memory_request: 200
|
|
40
|
-
memory_limit: 500
|
|
41
|
-
ephemeral_storage_request: 1000
|
|
42
|
-
ephemeral_storage_limit: 2000
|
|
43
|
-
container:
|
|
44
|
-
image: ':'
|
|
45
|
-
args:
|
|
46
|
-
- pyflyte-execute
|
|
47
|
-
- --inputs
|
|
48
|
-
- '{{.input}}'
|
|
49
|
-
- --output-prefix
|
|
50
|
-
- '{{.outputPrefix}}'
|
|
51
|
-
- --raw-output-data-prefix
|
|
52
|
-
- '{{.rawOutputDataPrefix}}'
|
|
53
|
-
- --checkpoint-path
|
|
54
|
-
- '{{.checkpointOutputPrefix}}'
|
|
55
|
-
- --prev-checkpoint
|
|
56
|
-
- '{{.prevCheckpointPrefix}}'
|
|
57
|
-
- --resolver
|
|
58
|
-
- flytekit.core.python_auto_container.default_task_resolver
|
|
59
|
-
- --
|
|
60
|
-
- task-module
|
|
61
|
-
- hello_world_package.workflow
|
|
62
|
-
- task-name
|
|
63
|
-
- say_hello
|
|
64
|
-
resources: {}
|
|
65
|
-
description:
|
|
66
|
-
longDescription:
|
|
67
|
-
format: DESCRIPTION_FORMAT_RST
|
|
68
|
-
- template:
|
|
69
|
-
id:
|
|
70
|
-
resourceType: WORKFLOW
|
|
71
|
-
name: hello_world_package.workflow.hello_world_wf
|
|
72
|
-
metadata: {}
|
|
73
|
-
interface:
|
|
74
|
-
inputs: {}
|
|
75
|
-
outputs:
|
|
76
|
-
variables:
|
|
77
|
-
o0:
|
|
78
|
-
type:
|
|
79
|
-
simple: STRING
|
|
80
|
-
description: o0
|
|
81
|
-
nodes:
|
|
82
|
-
- id: n0
|
|
83
|
-
metadata:
|
|
84
|
-
name: say_hello
|
|
85
|
-
retries: {}
|
|
86
|
-
taskNode:
|
|
87
|
-
referenceId:
|
|
88
|
-
resourceType: TASK
|
|
89
|
-
name: hello_world_package.workflow.say_hello
|
|
90
|
-
overrides: {}
|
|
91
|
-
outputs:
|
|
92
|
-
- var: o0
|
|
93
|
-
binding:
|
|
94
|
-
promise:
|
|
95
|
-
nodeId: n0
|
|
96
|
-
var: o0
|
|
97
|
-
metadataDefaults: {}
|
|
98
|
-
description:
|
|
99
|
-
longDescription:
|
|
100
|
-
format: DESCRIPTION_FORMAT_RST
|
|
101
|
-
- id:
|
|
102
|
-
resourceType: LAUNCH_PLAN
|
|
103
|
-
name: hello_world_package.workflow.hello_world_wf
|
|
104
|
-
spec:
|
|
105
|
-
workflowId:
|
|
106
|
-
resourceType: WORKFLOW
|
|
107
|
-
name: hello_world_package.workflow.hello_world_wf
|
|
108
|
-
entityMetadata: {}
|
|
109
|
-
defaultInputs: {}
|
|
110
|
-
fixedInputs: {}
|
|
111
|
-
labels: {}
|
|
112
|
-
annotations: {}
|
|
113
|
-
rawOutputDataConfig: {}
|
|
114
|
-
closure:
|
|
115
|
-
expectedInputs: {}
|
|
116
|
-
expectedOutputs: {}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.3
|
|
2
|
-
Name: truefoundry
|
|
3
|
-
Version: 0.5.7rc1
|
|
4
|
-
Summary: TrueFoundry CLI
|
|
5
|
-
Author: Abhishek Choudhary
|
|
6
|
-
Author-email: abhishek@truefoundry.com
|
|
7
|
-
Requires-Python: >=3.8.1,<3.13
|
|
8
|
-
Classifier: Programming Language :: Python :: 3
|
|
9
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
10
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
11
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
-
Provides-Extra: workflow
|
|
14
|
-
Requires-Dist: GitPython (>=3.1.43,<4.0.0)
|
|
15
|
-
Requires-Dist: Mako (>=1.1.6,<2.0.0)
|
|
16
|
-
Requires-Dist: PyJWT (>=2.0.0,<3.0.0)
|
|
17
|
-
Requires-Dist: PyYAML (>=6.0.0,<7.0.0)
|
|
18
|
-
Requires-Dist: aenum (>=3.0.0,<4.0.0)
|
|
19
|
-
Requires-Dist: click (>=7.0.0,<9.0.0)
|
|
20
|
-
Requires-Dist: coolname (>=1.1.0,<2.0.0)
|
|
21
|
-
Requires-Dist: docker (>=6.1.2,<8.0.0)
|
|
22
|
-
Requires-Dist: filelock (>=3.8.0,<4.0.0)
|
|
23
|
-
Requires-Dist: flytekit (==1.13.13) ; extra == "workflow"
|
|
24
|
-
Requires-Dist: gitignorefile (>=1.1.2,<2.0.0)
|
|
25
|
-
Requires-Dist: importlib-metadata (>=4.11.3,<9.0.0)
|
|
26
|
-
Requires-Dist: importlib-resources (>=5.2.0,<7.0.0)
|
|
27
|
-
Requires-Dist: numpy (>=1.23.0,<2.0.0) ; python_version < "3.12"
|
|
28
|
-
Requires-Dist: numpy (>=1.26.0,<2.0.0) ; python_version >= "3.12"
|
|
29
|
-
Requires-Dist: openai (>=1.16.2,<2.0.0)
|
|
30
|
-
Requires-Dist: packaging (>=20.0,<25.0)
|
|
31
|
-
Requires-Dist: pydantic (>=1.8.2,<3.0.0)
|
|
32
|
-
Requires-Dist: pygments (>=2.12.0,<3.0.0)
|
|
33
|
-
Requires-Dist: python-dateutil (>=2.8.2,<3.0.0)
|
|
34
|
-
Requires-Dist: python-dotenv (>=1.0.1,<2.0.0)
|
|
35
|
-
Requires-Dist: python-socketio[client] (>=5.5.2,<6.0.0)
|
|
36
|
-
Requires-Dist: questionary (>=1.10.0,<2.0.0)
|
|
37
|
-
Requires-Dist: requests (>=2.18.0,<3.0.0)
|
|
38
|
-
Requires-Dist: requirements-parser (>=0.11.0,<0.12.0)
|
|
39
|
-
Requires-Dist: rich (>=13.7.1,<14.0.0)
|
|
40
|
-
Requires-Dist: rich-click (>=1.2.1,<2.0.0)
|
|
41
|
-
Requires-Dist: scipy (>=1.12.0,<2.0.0) ; python_version >= "3.12"
|
|
42
|
-
Requires-Dist: scipy (>=1.5.0,<2.0.0) ; python_version < "3.12"
|
|
43
|
-
Requires-Dist: tqdm (>=4.0.0,<5.0.0)
|
|
44
|
-
Requires-Dist: typing-extensions (>=4.0)
|
|
45
|
-
Requires-Dist: urllib3 (>=1.26.18,<3)
|
|
46
|
-
Requires-Dist: yq (>=3.1.0,<4.0.0)
|
|
47
|
-
Description-Content-Type: text/markdown
|
|
48
|
-
|
|
49
|
-
# TrueFoundry
|
|
50
|
-
|
|
51
|
-
TrueFoundry library to help you interact with the platform programmatically by
|
|
52
|
-
|
|
53
|
-
- Interacting with the deployments side of TrueFoundry, enabling you to manage workspaces, deployments, applications, and view logs.
|
|
54
|
-
- Providing experiment tracking capabilities, allowing you to track ML experiments and interact with ML repositories within TrueFoundry.
|
|
55
|
-
|
|
56
|
-
You can access the health of your service, monitoring links, deployed endpoints and track metadata and artifacts by logging on to TrueFoundry's dashboard.
|
|
57
|
-
|
|
58
|
-
## Installation
|
|
59
|
-
|
|
60
|
-
To install the `TrueFoundry CLI`, you can use pip:
|
|
61
|
-
|
|
62
|
-
```bash
|
|
63
|
-
pip install truefoundry
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
To install the `TrueFoundry CLI` with Workflow deployment features, you can use pip:
|
|
67
|
-
|
|
68
|
-
```bash
|
|
69
|
-
pip install truefoundry[workflow]
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
## Examples
|
|
73
|
-
|
|
74
|
-
https://github.com/truefoundry/getting-started-examples
|
|
75
|
-
|
|
76
|
-
## Documentation
|
|
77
|
-
|
|
78
|
-
https://docs.truefoundry.com/
|
|
79
|
-
|