modal 1.0.6.dev36__tar.gz → 1.0.6.dev37__tar.gz
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 modal might be problematic. Click here for more details.
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/PKG-INFO +1 -1
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/__init__.py +0 -2
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/_functions.py +2 -29
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/_partial_function.py +1 -56
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/client.pyi +2 -2
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/functions.pyi +6 -6
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/image.py +0 -94
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/image.pyi +0 -132
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/partial_function.py +0 -2
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/partial_function.pyi +0 -29
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal.egg-info/PKG-INFO +1 -1
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal_version/__init__.py +1 -1
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/LICENSE +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/README.md +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/__main__.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/_clustered_functions.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/_clustered_functions.pyi +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/_container_entrypoint.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/_ipython.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/_location.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/_object.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/_output.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/_pty.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/_resolver.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/_resources.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/_runtime/__init__.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/_runtime/asgi.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/_runtime/container_io_manager.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/_runtime/container_io_manager.pyi +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/_runtime/execution_context.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/_runtime/execution_context.pyi +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/_runtime/gpu_memory_snapshot.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/_runtime/telemetry.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/_runtime/user_code_imports.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/_serialization.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/_traceback.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/_tunnel.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/_tunnel.pyi +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/_type_manager.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/_utils/__init__.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/_utils/app_utils.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/_utils/async_utils.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/_utils/auth_token_manager.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/_utils/blob_utils.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/_utils/bytes_io_segment_payload.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/_utils/deprecation.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/_utils/docker_utils.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/_utils/function_utils.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/_utils/git_utils.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/_utils/grpc_testing.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/_utils/grpc_utils.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/_utils/hash_utils.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/_utils/http_utils.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/_utils/jwt_utils.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/_utils/logger.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/_utils/mount_utils.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/_utils/name_utils.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/_utils/package_utils.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/_utils/pattern_utils.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/_utils/rand_pb_testing.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/_utils/shell_utils.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/_utils/time_utils.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/_vendor/__init__.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/_vendor/a2wsgi_wsgi.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/_vendor/cloudpickle.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/_vendor/tblib.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/_watcher.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/app.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/app.pyi +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/call_graph.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/cli/__init__.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/cli/_download.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/cli/_traceback.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/cli/app.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/cli/cluster.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/cli/config.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/cli/container.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/cli/dict.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/cli/entry_point.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/cli/environment.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/cli/import_refs.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/cli/launch.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/cli/network_file_system.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/cli/profile.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/cli/programs/__init__.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/cli/programs/run_jupyter.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/cli/programs/vscode.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/cli/queues.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/cli/run.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/cli/secret.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/cli/token.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/cli/utils.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/cli/volume.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/client.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/cloud_bucket_mount.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/cloud_bucket_mount.pyi +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/cls.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/cls.pyi +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/config.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/container_process.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/container_process.pyi +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/dict.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/dict.pyi +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/environments.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/environments.pyi +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/exception.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/experimental/__init__.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/experimental/ipython.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/file_io.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/file_io.pyi +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/file_pattern_matcher.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/functions.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/gpu.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/io_streams.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/io_streams.pyi +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/mount.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/mount.pyi +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/network_file_system.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/network_file_system.pyi +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/object.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/object.pyi +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/output.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/parallel_map.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/parallel_map.pyi +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/proxy.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/proxy.pyi +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/py.typed +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/queue.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/queue.pyi +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/requirements/2023.12.312.txt +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/requirements/2023.12.txt +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/requirements/2024.04.txt +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/requirements/2024.10.txt +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/requirements/2025.06.txt +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/requirements/PREVIEW.txt +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/requirements/README.md +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/requirements/base-images.json +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/retries.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/runner.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/runner.pyi +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/running_app.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/sandbox.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/sandbox.pyi +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/schedule.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/scheduler_placement.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/secret.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/secret.pyi +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/serving.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/serving.pyi +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/snapshot.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/snapshot.pyi +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/stream_type.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/token_flow.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/token_flow.pyi +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/volume.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal/volume.pyi +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal.egg-info/SOURCES.txt +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal.egg-info/dependency_links.txt +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal.egg-info/entry_points.txt +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal.egg-info/requires.txt +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal.egg-info/top_level.txt +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal_docs/__init__.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal_docs/gen_cli_docs.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal_docs/gen_reference_docs.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal_docs/mdmd/__init__.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal_docs/mdmd/mdmd.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal_docs/mdmd/signatures.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal_proto/__init__.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal_proto/api.proto +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal_proto/api_grpc.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal_proto/api_pb2.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal_proto/api_pb2.pyi +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal_proto/api_pb2_grpc.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal_proto/api_pb2_grpc.pyi +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal_proto/modal_api_grpc.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal_proto/modal_options_grpc.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal_proto/options.proto +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal_proto/options_grpc.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal_proto/options_pb2.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal_proto/options_pb2.pyi +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal_proto/options_pb2_grpc.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal_proto/options_pb2_grpc.pyi +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal_proto/py.typed +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/modal_version/__main__.py +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/pyproject.toml +0 -0
- {modal-1.0.6.dev36 → modal-1.0.6.dev37}/setup.cfg +0 -0
|
@@ -25,7 +25,6 @@ try:
|
|
|
25
25
|
from .partial_function import (
|
|
26
26
|
asgi_app,
|
|
27
27
|
batched,
|
|
28
|
-
build,
|
|
29
28
|
concurrent,
|
|
30
29
|
enter,
|
|
31
30
|
exit,
|
|
@@ -80,7 +79,6 @@ __all__ = [
|
|
|
80
79
|
"Volume",
|
|
81
80
|
"asgi_app",
|
|
82
81
|
"batched",
|
|
83
|
-
"build",
|
|
84
82
|
"concurrent",
|
|
85
83
|
"current_function_call_id",
|
|
86
84
|
"current_input_id",
|
|
@@ -460,6 +460,7 @@ class _InputPlaneInvocation:
|
|
|
460
460
|
token = await client._auth_token_manager.get_token()
|
|
461
461
|
return [("x-modal-input-plane-region", input_plane_region), ("x-modal-auth-token", token)]
|
|
462
462
|
|
|
463
|
+
|
|
463
464
|
# Wrapper type for api_pb2.FunctionStats
|
|
464
465
|
@dataclass(frozen=True)
|
|
465
466
|
class FunctionStats:
|
|
@@ -659,34 +660,6 @@ class _Function(typing.Generic[P, ReturnType, OriginalReturnType], _Object, type
|
|
|
659
660
|
proxy=proxy,
|
|
660
661
|
)
|
|
661
662
|
|
|
662
|
-
if info.user_cls and not is_auto_snapshot:
|
|
663
|
-
build_functions = _find_partial_methods_for_user_cls(info.user_cls, _PartialFunctionFlags.BUILD).items()
|
|
664
|
-
for k, pf in build_functions:
|
|
665
|
-
build_function = pf.raw_f
|
|
666
|
-
snapshot_info = FunctionInfo(build_function, user_cls=info.user_cls)
|
|
667
|
-
snapshot_function = _Function.from_local(
|
|
668
|
-
snapshot_info,
|
|
669
|
-
app=None,
|
|
670
|
-
image=image,
|
|
671
|
-
secrets=secrets,
|
|
672
|
-
gpu=gpu,
|
|
673
|
-
network_file_systems=network_file_systems,
|
|
674
|
-
volumes=volumes,
|
|
675
|
-
memory=memory,
|
|
676
|
-
timeout=pf.params.build_timeout,
|
|
677
|
-
cpu=cpu,
|
|
678
|
-
ephemeral_disk=ephemeral_disk,
|
|
679
|
-
is_builder_function=True,
|
|
680
|
-
is_auto_snapshot=True,
|
|
681
|
-
scheduler_placement=scheduler_placement,
|
|
682
|
-
include_source=include_source,
|
|
683
|
-
)
|
|
684
|
-
image = _Image._from_args(
|
|
685
|
-
base_images={"base": image},
|
|
686
|
-
build_function=snapshot_function,
|
|
687
|
-
force_build=image.force_build or bool(pf.params.force_build),
|
|
688
|
-
)
|
|
689
|
-
|
|
690
663
|
# Note that we also do these checks in FunctionCreate; could drop them here
|
|
691
664
|
if min_containers is not None and not isinstance(min_containers, int):
|
|
692
665
|
raise InvalidError(f"`min_containers` must be an int, not {type(min_containers).__name__}")
|
|
@@ -746,7 +719,7 @@ class _Function(typing.Generic[P, ReturnType, OriginalReturnType], _Object, type
|
|
|
746
719
|
validated_network_file_systems = validate_network_file_systems(network_file_systems)
|
|
747
720
|
|
|
748
721
|
# Validate image
|
|
749
|
-
if image is not None and not isinstance(image, _Image):
|
|
722
|
+
if image is not None and not isinstance(image, _Image): # type: ignore[unreachable]
|
|
750
723
|
raise InvalidError(f"Expected modal.Image object. Got {type(image)}.")
|
|
751
724
|
|
|
752
725
|
method_definitions: Optional[dict[str, api_pb2.MethodDefinition]] = None
|
|
@@ -31,7 +31,6 @@ if typing.TYPE_CHECKING:
|
|
|
31
31
|
|
|
32
32
|
class _PartialFunctionFlags(enum.IntFlag):
|
|
33
33
|
# Lifecycle method flags
|
|
34
|
-
BUILD = 1 # Deprecated, will be removed
|
|
35
34
|
ENTER_PRE_SNAPSHOT = 2
|
|
36
35
|
ENTER_POST_SNAPSHOT = 4
|
|
37
36
|
EXIT = 8
|
|
@@ -55,8 +54,7 @@ class _PartialFunctionFlags(enum.IntFlag):
|
|
|
55
54
|
@staticmethod
|
|
56
55
|
def lifecycle_flags() -> int:
|
|
57
56
|
return (
|
|
58
|
-
_PartialFunctionFlags.
|
|
59
|
-
| _PartialFunctionFlags.ENTER_PRE_SNAPSHOT
|
|
57
|
+
_PartialFunctionFlags.ENTER_PRE_SNAPSHOT
|
|
60
58
|
| _PartialFunctionFlags.ENTER_POST_SNAPSHOT
|
|
61
59
|
| _PartialFunctionFlags.EXIT
|
|
62
60
|
)
|
|
@@ -646,59 +644,6 @@ def _web_server(
|
|
|
646
644
|
return wrapper
|
|
647
645
|
|
|
648
646
|
|
|
649
|
-
def _build(
|
|
650
|
-
_warn_parentheses_missing=None, *, force: bool = False, timeout: int = 86400
|
|
651
|
-
) -> Callable[[Union[_PartialFunction, NullaryMethod]], _PartialFunction]:
|
|
652
|
-
"""mdmd:hidden
|
|
653
|
-
Decorator for methods that execute at _build time_ to create a new Image layer.
|
|
654
|
-
|
|
655
|
-
**Deprecated**: This function is deprecated. We recommend using `modal.Volume`
|
|
656
|
-
to store large assets (such as model weights) instead of writing them to the
|
|
657
|
-
Image during the build process. For other use cases, you can replace this
|
|
658
|
-
decorator with the `Image.run_function` method.
|
|
659
|
-
|
|
660
|
-
**Usage**
|
|
661
|
-
|
|
662
|
-
```python notest
|
|
663
|
-
@app.cls(gpu="A10G")
|
|
664
|
-
class AlpacaLoRAModel:
|
|
665
|
-
@build()
|
|
666
|
-
def download_models(self):
|
|
667
|
-
model = LlamaForCausalLM.from_pretrained(
|
|
668
|
-
base_model,
|
|
669
|
-
)
|
|
670
|
-
PeftModel.from_pretrained(model, lora_weights)
|
|
671
|
-
LlamaTokenizer.from_pretrained(base_model)
|
|
672
|
-
```
|
|
673
|
-
"""
|
|
674
|
-
if _warn_parentheses_missing is not None:
|
|
675
|
-
raise InvalidError(
|
|
676
|
-
"Positional arguments are not allowed. Did you forget parentheses? Suggestion: `@modal.build()`."
|
|
677
|
-
)
|
|
678
|
-
|
|
679
|
-
deprecation_warning(
|
|
680
|
-
(2025, 1, 15),
|
|
681
|
-
"The `@modal.build` decorator is deprecated and will be removed in a future release."
|
|
682
|
-
"\n\nWe now recommend storing large assets (such as model weights) using a `modal.Volume`"
|
|
683
|
-
" instead of writing them directly into the `modal.Image` filesystem."
|
|
684
|
-
" For other use cases we recommend using `Image.run_function` instead."
|
|
685
|
-
"\n\nSee https://modal.com/docs/guide/modal-1-0-migration for more information.",
|
|
686
|
-
)
|
|
687
|
-
|
|
688
|
-
flags = _PartialFunctionFlags.BUILD
|
|
689
|
-
params = _PartialFunctionParams(force_build=force, build_timeout=timeout)
|
|
690
|
-
|
|
691
|
-
def wrapper(obj: Union[_PartialFunction, NullaryMethod]) -> _PartialFunction:
|
|
692
|
-
if isinstance(obj, _PartialFunction):
|
|
693
|
-
pf = obj.stack(flags, params)
|
|
694
|
-
else:
|
|
695
|
-
pf = _PartialFunction(obj, flags, params)
|
|
696
|
-
pf.validate_obj_compatibility("build")
|
|
697
|
-
return pf
|
|
698
|
-
|
|
699
|
-
return wrapper
|
|
700
|
-
|
|
701
|
-
|
|
702
647
|
def _enter(
|
|
703
648
|
_warn_parentheses_missing=None,
|
|
704
649
|
*,
|
|
@@ -33,7 +33,7 @@ class _Client:
|
|
|
33
33
|
server_url: str,
|
|
34
34
|
client_type: int,
|
|
35
35
|
credentials: typing.Optional[tuple[str, str]],
|
|
36
|
-
version: str = "1.0.6.
|
|
36
|
+
version: str = "1.0.6.dev37",
|
|
37
37
|
):
|
|
38
38
|
"""mdmd:hidden
|
|
39
39
|
The Modal client object is not intended to be instantiated directly by users.
|
|
@@ -163,7 +163,7 @@ class Client:
|
|
|
163
163
|
server_url: str,
|
|
164
164
|
client_type: int,
|
|
165
165
|
credentials: typing.Optional[tuple[str, str]],
|
|
166
|
-
version: str = "1.0.6.
|
|
166
|
+
version: str = "1.0.6.dev37",
|
|
167
167
|
):
|
|
168
168
|
"""mdmd:hidden
|
|
169
169
|
The Modal client object is not intended to be instantiated directly by users.
|
|
@@ -428,7 +428,7 @@ class Function(
|
|
|
428
428
|
|
|
429
429
|
_call_generator: ___call_generator_spec[typing_extensions.Self]
|
|
430
430
|
|
|
431
|
-
class __remote_spec(typing_extensions.Protocol[
|
|
431
|
+
class __remote_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER, SUPERSELF]):
|
|
432
432
|
def __call__(self, /, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> ReturnType_INNER:
|
|
433
433
|
"""Calls the function remotely, executing it with the given arguments and returning the execution's result."""
|
|
434
434
|
...
|
|
@@ -437,7 +437,7 @@ class Function(
|
|
|
437
437
|
"""Calls the function remotely, executing it with the given arguments and returning the execution's result."""
|
|
438
438
|
...
|
|
439
439
|
|
|
440
|
-
remote: __remote_spec[modal._functions.
|
|
440
|
+
remote: __remote_spec[modal._functions.ReturnType, modal._functions.P, typing_extensions.Self]
|
|
441
441
|
|
|
442
442
|
class __remote_gen_spec(typing_extensions.Protocol[SUPERSELF]):
|
|
443
443
|
def __call__(self, /, *args, **kwargs) -> typing.Generator[typing.Any, None, None]:
|
|
@@ -464,7 +464,7 @@ class Function(
|
|
|
464
464
|
"""
|
|
465
465
|
...
|
|
466
466
|
|
|
467
|
-
class ___experimental_spawn_spec(typing_extensions.Protocol[
|
|
467
|
+
class ___experimental_spawn_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER, SUPERSELF]):
|
|
468
468
|
def __call__(self, /, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]:
|
|
469
469
|
"""[Experimental] Calls the function with the given arguments, without waiting for the results.
|
|
470
470
|
|
|
@@ -488,7 +488,7 @@ class Function(
|
|
|
488
488
|
...
|
|
489
489
|
|
|
490
490
|
_experimental_spawn: ___experimental_spawn_spec[
|
|
491
|
-
modal._functions.
|
|
491
|
+
modal._functions.ReturnType, modal._functions.P, typing_extensions.Self
|
|
492
492
|
]
|
|
493
493
|
|
|
494
494
|
class ___spawn_map_inner_spec(typing_extensions.Protocol[P_INNER, SUPERSELF]):
|
|
@@ -497,7 +497,7 @@ class Function(
|
|
|
497
497
|
|
|
498
498
|
_spawn_map_inner: ___spawn_map_inner_spec[modal._functions.P, typing_extensions.Self]
|
|
499
499
|
|
|
500
|
-
class __spawn_spec(typing_extensions.Protocol[
|
|
500
|
+
class __spawn_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER, SUPERSELF]):
|
|
501
501
|
def __call__(self, /, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]:
|
|
502
502
|
"""Calls the function with the given arguments, without waiting for the results.
|
|
503
503
|
|
|
@@ -518,7 +518,7 @@ class Function(
|
|
|
518
518
|
"""
|
|
519
519
|
...
|
|
520
520
|
|
|
521
|
-
spawn: __spawn_spec[modal._functions.
|
|
521
|
+
spawn: __spawn_spec[modal._functions.ReturnType, modal._functions.P, typing_extensions.Self]
|
|
522
522
|
|
|
523
523
|
def get_raw_f(self) -> collections.abc.Callable[..., typing.Any]:
|
|
524
524
|
"""Return the inner Python object wrapped by this Modal Function."""
|
|
@@ -799,28 +799,6 @@ class _Image(_Object, type_prefix="im"):
|
|
|
799
799
|
mount = _Mount._add_local_dir(Path(local_path), PurePosixPath(remote_path), ignore=_ignore_fn(ignore))
|
|
800
800
|
return self._add_mount_layer_or_copy(mount, copy=copy)
|
|
801
801
|
|
|
802
|
-
def copy_local_file(self, local_path: Union[str, Path], remote_path: Union[str, Path] = "./") -> "_Image":
|
|
803
|
-
"""mdmd:hidden
|
|
804
|
-
Copy a file into the image as a part of building it.
|
|
805
|
-
|
|
806
|
-
This works in a similar way to [`COPY`](https://docs.docker.com/engine/reference/builder/#copy)
|
|
807
|
-
works in a `Dockerfile`.
|
|
808
|
-
"""
|
|
809
|
-
deprecation_warning(
|
|
810
|
-
(2025, 1, 13),
|
|
811
|
-
COPY_DEPRECATION_MESSAGE_PATTERN.format(replacement="image.add_local_file"),
|
|
812
|
-
)
|
|
813
|
-
basename = str(Path(local_path).name)
|
|
814
|
-
|
|
815
|
-
def build_dockerfile(version: ImageBuilderVersion) -> DockerfileSpec:
|
|
816
|
-
return DockerfileSpec(commands=["FROM base", f"COPY {basename} {remote_path}"], context_files={})
|
|
817
|
-
|
|
818
|
-
return _Image._from_args(
|
|
819
|
-
base_images={"base": self},
|
|
820
|
-
dockerfile_function=build_dockerfile,
|
|
821
|
-
context_mount_function=lambda: _Mount._from_local_file(local_path, remote_path=f"/{basename}"),
|
|
822
|
-
)
|
|
823
|
-
|
|
824
802
|
def add_local_python_source(
|
|
825
803
|
self, *modules: str, copy: bool = False, ignore: Union[Sequence[str], Callable[[Path], bool]] = NON_PYTHON_FILES
|
|
826
804
|
) -> "_Image":
|
|
@@ -865,78 +843,6 @@ class _Image(_Object, type_prefix="im"):
|
|
|
865
843
|
img._added_python_source_set |= set(modules)
|
|
866
844
|
return img
|
|
867
845
|
|
|
868
|
-
def copy_local_dir(
|
|
869
|
-
self,
|
|
870
|
-
local_path: Union[str, Path],
|
|
871
|
-
remote_path: Union[str, Path] = ".",
|
|
872
|
-
# Predicate filter function for file exclusion, which should accept a filepath and return `True` for exclusion.
|
|
873
|
-
# Defaults to excluding no files. If a Sequence is provided, it will be converted to a FilePatternMatcher.
|
|
874
|
-
# Which follows dockerignore syntax.
|
|
875
|
-
ignore: Union[Sequence[str], Callable[[Path], bool]] = [],
|
|
876
|
-
) -> "_Image":
|
|
877
|
-
"""mdmd:hidden
|
|
878
|
-
**Deprecated**: Use image.add_local_dir instead
|
|
879
|
-
|
|
880
|
-
Copy a directory into the image as a part of building the image.
|
|
881
|
-
|
|
882
|
-
This works in a similar way to [`COPY`](https://docs.docker.com/engine/reference/builder/#copy)
|
|
883
|
-
works in a `Dockerfile`.
|
|
884
|
-
|
|
885
|
-
**Usage:**
|
|
886
|
-
|
|
887
|
-
```python notest
|
|
888
|
-
from pathlib import Path
|
|
889
|
-
from modal import FilePatternMatcher
|
|
890
|
-
|
|
891
|
-
image = modal.Image.debian_slim().copy_local_dir(
|
|
892
|
-
"~/assets",
|
|
893
|
-
remote_path="/assets",
|
|
894
|
-
ignore=["**/*.venv"],
|
|
895
|
-
)
|
|
896
|
-
|
|
897
|
-
image = modal.Image.debian_slim().copy_local_dir(
|
|
898
|
-
"~/assets",
|
|
899
|
-
remote_path="/assets",
|
|
900
|
-
ignore=lambda p: p.is_relative_to(".venv"),
|
|
901
|
-
)
|
|
902
|
-
|
|
903
|
-
image = modal.Image.debian_slim().copy_local_dir(
|
|
904
|
-
"~/assets",
|
|
905
|
-
remote_path="/assets",
|
|
906
|
-
ignore=FilePatternMatcher("**/*.txt"),
|
|
907
|
-
)
|
|
908
|
-
|
|
909
|
-
# When including files is simpler than excluding them, you can use the `~` operator to invert the matcher.
|
|
910
|
-
image = modal.Image.debian_slim().copy_local_dir(
|
|
911
|
-
"~/assets",
|
|
912
|
-
remote_path="/assets",
|
|
913
|
-
ignore=~FilePatternMatcher("**/*.py"),
|
|
914
|
-
)
|
|
915
|
-
|
|
916
|
-
# You can also read ignore patterns from a file.
|
|
917
|
-
image = modal.Image.debian_slim().copy_local_dir(
|
|
918
|
-
"~/assets",
|
|
919
|
-
remote_path="/assets",
|
|
920
|
-
ignore=FilePatternMatcher.from_file("/path/to/ignorefile"),
|
|
921
|
-
)
|
|
922
|
-
```
|
|
923
|
-
"""
|
|
924
|
-
deprecation_warning(
|
|
925
|
-
(2025, 1, 13),
|
|
926
|
-
COPY_DEPRECATION_MESSAGE_PATTERN.format(replacement="image.add_local_dir"),
|
|
927
|
-
)
|
|
928
|
-
|
|
929
|
-
def build_dockerfile(version: ImageBuilderVersion) -> DockerfileSpec:
|
|
930
|
-
return DockerfileSpec(commands=["FROM base", f"COPY . {remote_path}"], context_files={})
|
|
931
|
-
|
|
932
|
-
return _Image._from_args(
|
|
933
|
-
base_images={"base": self},
|
|
934
|
-
dockerfile_function=build_dockerfile,
|
|
935
|
-
context_mount_function=lambda: _Mount._add_local_dir(
|
|
936
|
-
Path(local_path), PurePosixPath("/"), ignore=_ignore_fn(ignore)
|
|
937
|
-
),
|
|
938
|
-
)
|
|
939
|
-
|
|
940
846
|
@staticmethod
|
|
941
847
|
async def from_id(image_id: str, client: Optional[_Client] = None) -> "_Image":
|
|
942
848
|
"""Construct an Image from an id and look up the Image result.
|
|
@@ -266,17 +266,6 @@ class _Image(modal._object._Object):
|
|
|
266
266
|
"""
|
|
267
267
|
...
|
|
268
268
|
|
|
269
|
-
def copy_local_file(
|
|
270
|
-
self, local_path: typing.Union[str, pathlib.Path], remote_path: typing.Union[str, pathlib.Path] = "./"
|
|
271
|
-
) -> _Image:
|
|
272
|
-
"""mdmd:hidden
|
|
273
|
-
Copy a file into the image as a part of building it.
|
|
274
|
-
|
|
275
|
-
This works in a similar way to [`COPY`](https://docs.docker.com/engine/reference/builder/#copy)
|
|
276
|
-
works in a `Dockerfile`.
|
|
277
|
-
"""
|
|
278
|
-
...
|
|
279
|
-
|
|
280
269
|
def add_local_python_source(
|
|
281
270
|
self,
|
|
282
271
|
*module_names: str,
|
|
@@ -321,61 +310,6 @@ class _Image(modal._object._Object):
|
|
|
321
310
|
"""
|
|
322
311
|
...
|
|
323
312
|
|
|
324
|
-
def copy_local_dir(
|
|
325
|
-
self,
|
|
326
|
-
local_path: typing.Union[str, pathlib.Path],
|
|
327
|
-
remote_path: typing.Union[str, pathlib.Path] = ".",
|
|
328
|
-
ignore: typing.Union[collections.abc.Sequence[str], collections.abc.Callable[[pathlib.Path], bool]] = [],
|
|
329
|
-
) -> _Image:
|
|
330
|
-
"""mdmd:hidden
|
|
331
|
-
**Deprecated**: Use image.add_local_dir instead
|
|
332
|
-
|
|
333
|
-
Copy a directory into the image as a part of building the image.
|
|
334
|
-
|
|
335
|
-
This works in a similar way to [`COPY`](https://docs.docker.com/engine/reference/builder/#copy)
|
|
336
|
-
works in a `Dockerfile`.
|
|
337
|
-
|
|
338
|
-
**Usage:**
|
|
339
|
-
|
|
340
|
-
```python notest
|
|
341
|
-
from pathlib import Path
|
|
342
|
-
from modal import FilePatternMatcher
|
|
343
|
-
|
|
344
|
-
image = modal.Image.debian_slim().copy_local_dir(
|
|
345
|
-
"~/assets",
|
|
346
|
-
remote_path="/assets",
|
|
347
|
-
ignore=["**/*.venv"],
|
|
348
|
-
)
|
|
349
|
-
|
|
350
|
-
image = modal.Image.debian_slim().copy_local_dir(
|
|
351
|
-
"~/assets",
|
|
352
|
-
remote_path="/assets",
|
|
353
|
-
ignore=lambda p: p.is_relative_to(".venv"),
|
|
354
|
-
)
|
|
355
|
-
|
|
356
|
-
image = modal.Image.debian_slim().copy_local_dir(
|
|
357
|
-
"~/assets",
|
|
358
|
-
remote_path="/assets",
|
|
359
|
-
ignore=FilePatternMatcher("**/*.txt"),
|
|
360
|
-
)
|
|
361
|
-
|
|
362
|
-
# When including files is simpler than excluding them, you can use the `~` operator to invert the matcher.
|
|
363
|
-
image = modal.Image.debian_slim().copy_local_dir(
|
|
364
|
-
"~/assets",
|
|
365
|
-
remote_path="/assets",
|
|
366
|
-
ignore=~FilePatternMatcher("**/*.py"),
|
|
367
|
-
)
|
|
368
|
-
|
|
369
|
-
# You can also read ignore patterns from a file.
|
|
370
|
-
image = modal.Image.debian_slim().copy_local_dir(
|
|
371
|
-
"~/assets",
|
|
372
|
-
remote_path="/assets",
|
|
373
|
-
ignore=FilePatternMatcher.from_file("/path/to/ignorefile"),
|
|
374
|
-
)
|
|
375
|
-
```
|
|
376
|
-
"""
|
|
377
|
-
...
|
|
378
|
-
|
|
379
313
|
@staticmethod
|
|
380
314
|
async def from_id(image_id: str, client: typing.Optional[modal.client._Client] = None) -> _Image:
|
|
381
315
|
"""Construct an Image from an id and look up the Image result.
|
|
@@ -1154,17 +1088,6 @@ class Image(modal.object.Object):
|
|
|
1154
1088
|
"""
|
|
1155
1089
|
...
|
|
1156
1090
|
|
|
1157
|
-
def copy_local_file(
|
|
1158
|
-
self, local_path: typing.Union[str, pathlib.Path], remote_path: typing.Union[str, pathlib.Path] = "./"
|
|
1159
|
-
) -> Image:
|
|
1160
|
-
"""mdmd:hidden
|
|
1161
|
-
Copy a file into the image as a part of building it.
|
|
1162
|
-
|
|
1163
|
-
This works in a similar way to [`COPY`](https://docs.docker.com/engine/reference/builder/#copy)
|
|
1164
|
-
works in a `Dockerfile`.
|
|
1165
|
-
"""
|
|
1166
|
-
...
|
|
1167
|
-
|
|
1168
1091
|
def add_local_python_source(
|
|
1169
1092
|
self,
|
|
1170
1093
|
*module_names: str,
|
|
@@ -1209,61 +1132,6 @@ class Image(modal.object.Object):
|
|
|
1209
1132
|
"""
|
|
1210
1133
|
...
|
|
1211
1134
|
|
|
1212
|
-
def copy_local_dir(
|
|
1213
|
-
self,
|
|
1214
|
-
local_path: typing.Union[str, pathlib.Path],
|
|
1215
|
-
remote_path: typing.Union[str, pathlib.Path] = ".",
|
|
1216
|
-
ignore: typing.Union[collections.abc.Sequence[str], collections.abc.Callable[[pathlib.Path], bool]] = [],
|
|
1217
|
-
) -> Image:
|
|
1218
|
-
"""mdmd:hidden
|
|
1219
|
-
**Deprecated**: Use image.add_local_dir instead
|
|
1220
|
-
|
|
1221
|
-
Copy a directory into the image as a part of building the image.
|
|
1222
|
-
|
|
1223
|
-
This works in a similar way to [`COPY`](https://docs.docker.com/engine/reference/builder/#copy)
|
|
1224
|
-
works in a `Dockerfile`.
|
|
1225
|
-
|
|
1226
|
-
**Usage:**
|
|
1227
|
-
|
|
1228
|
-
```python notest
|
|
1229
|
-
from pathlib import Path
|
|
1230
|
-
from modal import FilePatternMatcher
|
|
1231
|
-
|
|
1232
|
-
image = modal.Image.debian_slim().copy_local_dir(
|
|
1233
|
-
"~/assets",
|
|
1234
|
-
remote_path="/assets",
|
|
1235
|
-
ignore=["**/*.venv"],
|
|
1236
|
-
)
|
|
1237
|
-
|
|
1238
|
-
image = modal.Image.debian_slim().copy_local_dir(
|
|
1239
|
-
"~/assets",
|
|
1240
|
-
remote_path="/assets",
|
|
1241
|
-
ignore=lambda p: p.is_relative_to(".venv"),
|
|
1242
|
-
)
|
|
1243
|
-
|
|
1244
|
-
image = modal.Image.debian_slim().copy_local_dir(
|
|
1245
|
-
"~/assets",
|
|
1246
|
-
remote_path="/assets",
|
|
1247
|
-
ignore=FilePatternMatcher("**/*.txt"),
|
|
1248
|
-
)
|
|
1249
|
-
|
|
1250
|
-
# When including files is simpler than excluding them, you can use the `~` operator to invert the matcher.
|
|
1251
|
-
image = modal.Image.debian_slim().copy_local_dir(
|
|
1252
|
-
"~/assets",
|
|
1253
|
-
remote_path="/assets",
|
|
1254
|
-
ignore=~FilePatternMatcher("**/*.py"),
|
|
1255
|
-
)
|
|
1256
|
-
|
|
1257
|
-
# You can also read ignore patterns from a file.
|
|
1258
|
-
image = modal.Image.debian_slim().copy_local_dir(
|
|
1259
|
-
"~/assets",
|
|
1260
|
-
remote_path="/assets",
|
|
1261
|
-
ignore=FilePatternMatcher.from_file("/path/to/ignorefile"),
|
|
1262
|
-
)
|
|
1263
|
-
```
|
|
1264
|
-
"""
|
|
1265
|
-
...
|
|
1266
|
-
|
|
1267
1135
|
class __from_id_spec(typing_extensions.Protocol):
|
|
1268
1136
|
def __call__(self, /, image_id: str, client: typing.Optional[modal.client.Client] = None) -> Image:
|
|
1269
1137
|
"""Construct an Image from an id and look up the Image result.
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
from ._partial_function import (
|
|
4
4
|
_asgi_app,
|
|
5
5
|
_batched,
|
|
6
|
-
_build,
|
|
7
6
|
_concurrent,
|
|
8
7
|
_enter,
|
|
9
8
|
_exit,
|
|
@@ -25,7 +24,6 @@ fastapi_endpoint = synchronize_api(_fastapi_endpoint, target_module=__name__)
|
|
|
25
24
|
asgi_app = synchronize_api(_asgi_app, target_module=__name__)
|
|
26
25
|
wsgi_app = synchronize_api(_wsgi_app, target_module=__name__)
|
|
27
26
|
web_server = synchronize_api(_web_server, target_module=__name__)
|
|
28
|
-
build = synchronize_api(_build, target_module=__name__)
|
|
29
27
|
enter = synchronize_api(_enter, target_module=__name__)
|
|
30
28
|
exit = synchronize_api(_exit, target_module=__name__)
|
|
31
29
|
batched = synchronize_api(_batched, target_module=__name__)
|
|
@@ -269,35 +269,6 @@ def web_server(
|
|
|
269
269
|
"""
|
|
270
270
|
...
|
|
271
271
|
|
|
272
|
-
def build(
|
|
273
|
-
_warn_parentheses_missing=None, *, force: bool = False, timeout: int = 86400
|
|
274
|
-
) -> collections.abc.Callable[
|
|
275
|
-
[typing.Union[PartialFunction, collections.abc.Callable[[typing.Any], typing.Any]]], PartialFunction
|
|
276
|
-
]:
|
|
277
|
-
"""mdmd:hidden
|
|
278
|
-
Decorator for methods that execute at _build time_ to create a new Image layer.
|
|
279
|
-
|
|
280
|
-
**Deprecated**: This function is deprecated. We recommend using `modal.Volume`
|
|
281
|
-
to store large assets (such as model weights) instead of writing them to the
|
|
282
|
-
Image during the build process. For other use cases, you can replace this
|
|
283
|
-
decorator with the `Image.run_function` method.
|
|
284
|
-
|
|
285
|
-
**Usage**
|
|
286
|
-
|
|
287
|
-
```python notest
|
|
288
|
-
@app.cls(gpu="A10G")
|
|
289
|
-
class AlpacaLoRAModel:
|
|
290
|
-
@build()
|
|
291
|
-
def download_models(self):
|
|
292
|
-
model = LlamaForCausalLM.from_pretrained(
|
|
293
|
-
base_model,
|
|
294
|
-
)
|
|
295
|
-
PeftModel.from_pretrained(model, lora_weights)
|
|
296
|
-
LlamaTokenizer.from_pretrained(base_model)
|
|
297
|
-
```
|
|
298
|
-
"""
|
|
299
|
-
...
|
|
300
|
-
|
|
301
272
|
def enter(
|
|
302
273
|
_warn_parentheses_missing=None, *, snap: bool = False
|
|
303
274
|
) -> collections.abc.Callable[
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|