nerfbaselines.backends¶
- class nerfbaselines.backends.ApptainerBackend(spec: ApptainerBackendSpec)[source]¶
Bases:
RemoteProcessRPCBackend
- name = 'apptainer'¶
- class nerfbaselines.backends.ApptainerBackendSpec[source]¶
Bases:
TypedDict
- conda_spec: CondaBackendSpec | None¶
- environment_name: Required[str]¶
- home_path: str¶
- image: str | None¶
- python_path: str¶
- class nerfbaselines.backends.CondaBackend(spec: CondaBackendSpec)[source]¶
Bases:
RemoteProcessRPCBackend
- name = 'conda'¶
- class nerfbaselines.backends.CondaBackendSpec[source]¶
Bases:
TypedDict
- environment_name: Required[str]¶
- install_script: str | None¶
- python_version: str | None¶
- class nerfbaselines.backends.DockerBackend(spec: DockerBackendSpec)[source]¶
Bases:
RemoteProcessRPCBackend
- name = 'docker'¶
- class nerfbaselines.backends.DockerBackendSpec[source]¶
Bases:
TypedDict
- build_script: str¶
- conda_spec: CondaBackendSpec¶
- environment_name: Required[str]¶
- home_path: str¶
- image: str | None¶
- python_path: str¶
- replace_user: bool¶
- nerfbaselines.backends.backend_allocate(size: int) Tuple[int, memoryview] | None [source]¶
Allocates a memory block in the shared memory block valid for the next call to the backend. The function is only valid on the worker side handling request. Everywhere else it will return None.
- Parameters:
size – The size of the memory block to allocate.
- Returns:
- If the memory block
was allocated, the function returns a tuple of id and memory view. Otherwise, it returns None.
- Return type:
Optional[Tuple[int, memoryview]]
- nerfbaselines.backends.get_backend(method_spec: MethodSpec, backend: str | None) Backend [source]¶
- nerfbaselines.backends.get_implemented_backends(method_spec: MethodSpec) Sequence[Literal['conda', 'docker', 'apptainer', 'python']] [source]¶
- nerfbaselines.backends.zero_copy(zero_copy: bool = True)[source]¶
A context manager that enables zero-copy for the current thread. Zero-copy is used for all subsequent calls for all backends. A zero-copy mode instructs the backend to reuse the shared memory used for data transfer. This is useful when the data is large and speed is important. However, it is important to only use results of backend calls inside the context manager. The data will be overwritten by subsequent calls.
- Parameters:
zero_copy – If True, zero-copy is enabled for the current thread. If False, zero-copy is disabled.