Skip to main content



Allows specifying the resources the Layer backend should use to run decorated function.

Note: The fabric decorator should only ever be used alongside Layer dataset or model decorators. GPU fabrics are available for model training only and can only be used in combination with model decorator.

This decorator overrides the fabric set via layer.init. It has no impact on local execution of your functions, only on remote execution in the Layer backend.

  • Returns

    Function object.

  • Return type

    Callable[[...], Any]

import layer
from layer.decorators import dataset, fabric

# fabric below will determine resources used to run `create_my_dataset` function in Layer backend
def create_product_dataset():
data = [[1, "product1", 15], [2, "product2", 20], [3, "product3", 10]]
dataframe = pd.DataFrame(data, columns=["Id", "Product", "Price"])
return dataframe

# fabric setting will be used when running your function below