Elaborare i dati di ML utilizzando Dataflow e Cloud Storage FUSE
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Questa pagina descrive come utilizzare
Cloud Storage FUSE con Dataflow
per elaborare set di dati per attività di machine learning (ML).
Quando si lavora con attività di ML, Dataflow può essere utilizzato per l'elaborazione di set di dati di grandi dimensioni. Tuttavia, alcune librerie software comuni utilizzate per il machine learning, come OpenCV, hanno
requisiti per i file di input. Spesso richiedono l'accesso ai file come se fossero archiviati sul disco rigido di un computer locale, anziché da uno spazio di archiviazione basato sul cloud. Questo requisito crea difficoltà e ritardi. Come soluzione, le pipeline possono utilizzare connettori I/O speciali per l'input o scaricare i file sulle macchine virtuali (VM) Dataflow prima dell'elaborazione. Queste soluzioni
sono spesso inefficienti.
Cloud Storage FUSE offre un modo per evitare queste soluzioni inefficienti.
Cloud Storage FUSE ti consente di montare i bucket Cloud Storage sulle VM Dataflow. In questo modo, i file in Cloud Storage vengono visualizzati come se fossero file locali. Di conseguenza, il software ML può accedervi direttamente senza
doverli scaricare in anticipo.
Vantaggi
L'utilizzo di Cloud Storage FUSE per le attività di ML offre i seguenti vantaggi:
È possibile accedere ai file di input ospitati su Cloud Storage nella VM Dataflow utilizzando la semantica del file system locale.
Poiché i dati vengono consultati su richiesta, i file di input non devono essere scaricati in anticipo.
Supporto e limitazioni
Per utilizzare Cloud Storage FUSE con Dataflow, devi configurare le VM worker con indirizzi IP esterni in modo che soddisfino i requisiti di accesso a internet.
Specifica i bucket da utilizzare con Cloud Storage FUSE
Per specificare un bucket Cloud Storage da montare su una VM, utilizza il flag
--experiments. Per specificare
più bucket, utilizza un punto e virgola (;) come delimitatore tra i nomi dei bucket.
Il formato è il seguente:
--experiments="gcsfuse_buckets=CONFIG"
Sostituisci quanto segue:
CONFIG: un elenco delimitato da punto e virgola di voci di Cloud Storage, in cui ogni voce è una delle seguenti:
BUCKET_NAME: il nome di un bucket Cloud Storage.
Ad esempio, dataflow-samples. Se ometti la modalità bucket, il bucket
viene trattato come di sola lettura.
BUCKET_NAME:MODE: il nome di un bucket Cloud Storage e la relativa modalità associata, dove MODE è
ro (sola lettura) o rw (lettura/scrittura).
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-04 UTC."],[],[],null,["# Process ML data using Dataflow and Cloud Storage FUSE\n\nThis page describes how to use\n[Cloud Storage FUSE](/storage/docs/cloud-storage-fuse/overview) with Dataflow\nto process datasets for machine learning (ML) tasks.\n\nWhen working with ML tasks, Dataflow can be used for processing large\ndatasets. However, some common software libraries used for ML, like OpenCV, have\ninput file requirements. They frequently require files to be accessed as if they\nare stored on a local computer's hard drive, rather than from cloud-based\nstorage. This requirement creates difficulties and delays. As a solution,\npipelines can either use special I/O connectors for input or download files onto\nthe Dataflow virtual machines (VMs) before processing. These solutions\nare frequently inefficient.\n\nCloud Storage FUSE provides a way to avoid these inefficient solutions.\nCloud Storage FUSE lets you mount your Cloud Storage buckets onto the\nDataflow VMs. This makes the files in Cloud Storage appear as if they\nare local files. As a result, the ML software can access them directly without\nneeding to download them beforehand.\n\nBenefits\n--------\n\nUsing Cloud Storage FUSE for ML tasks offers the following benefits:\n\n- Input files hosted on Cloud Storage can be accessed in the Dataflow VM using local file system semantics.\n- Because the data is accessed on-demand, the input files don't have to be downloaded beforehand.\n\nSupport and limitations\n-----------------------\n\n- To use Cloud Storage FUSE with Dataflow, you must configure worker VMs with [external IP addresses](/dataflow/docs/guides/routes-firewall#internet_access_for) so that they meet the internet access requirements.\n\nSpecify buckets to use with Cloud Storage FUSE\n----------------------------------------------\n\nTo specify a Cloud Storage bucket to mount to a VM, use the\n[`--experiments`](/dataflow/docs/reference/pipeline-options) flag. To specify\nmultiple buckets, use a semicolon delimiter (`;`) between bucket names.\n\nThe format is as follows: \n\n --experiments=\"gcsfuse_buckets=\u003cvar translate=\"no\"\u003eCONFIG\u003c/var\u003e\"\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eCONFIG\u003c/var\u003e: a semicolon-delimited list of\n Cloud Storage entries, where each entry is one of the following:\n\n 1. \u003cvar translate=\"no\"\u003eBUCKET_NAME\u003c/var\u003e: A Cloud Storage bucket name.\n For example, `dataflow-samples`. If you omit the bucket mode, the bucket\n is treated as read-only.\n\n 2. \u003cvar translate=\"no\"\u003eBUCKET_NAME\u003c/var\u003e`:`\u003cvar translate=\"no\"\u003eMODE\u003c/var\u003e: A\n Cloud Storage bucket name and its associated mode, where `MODE` is\n either `ro` (read-only) or `rw` (read-write).\n\n For example: \n\n --experiments=\"gcsfuse_buckets=read-bucket1;read-bucket2:ro;write-bucket1:rw\"\n\n In this example, specifying the mode assures the following:\n - `gs://read-bucket1` is mounted in read-only mode.\n - `gs://read-bucket2` is mounted in read-only mode.\n - `gs://write-bucket1` is mounted in read-write mode.\n\n Beam pipeline code can access these buckets at\n `/var/opt/google/gcs/`\u003cvar translate=\"no\"\u003eBUCKET_NAME\u003c/var\u003e."]]