File tree Expand file tree Collapse file tree
tests/functional_tests/utils Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1313# limitations under the License.
1414
1515import argparse
16+ from unittest .mock import MagicMock
17+
18+ import datasets
1619
1720from nemo .collections import llm
1821from nemo .collections .llm .modelopt import ExportConfig , QuantizationConfig
@@ -66,6 +69,10 @@ def get_args():
6669
6770def main ():
6871 """Example NeMo 2.0 Post Training Quantization workflow."""
72+ # Mock FileLock to avoid writing to the read-only test directory
73+ # HF Datasets library will always write a lock file even if reading from cache
74+ datasets .builder .FileLock = MagicMock ()
75+
6976 args = get_args ()
7077
7178 quantization_config = QuantizationConfig (
Original file line number Diff line number Diff line change 1515import argparse
1616import os
1717from functools import partial
18+ from unittest .mock import MagicMock
1819
20+ import datasets
1921import tensorrt as trt
2022import torch
2123from nemo .collections .llm .gpt .model .hf_llama_embedding import (
@@ -95,6 +97,10 @@ def get_args():
9597
9698
9799def export_onnx_trt (args ):
100+ # Mock FileLock to avoid writing to the read-only test directory
101+ # HF Datasets library will always write a lock file even if reading from cache
102+ datasets .builder .FileLock = MagicMock ()
103+
98104 # Base Llama model needs to be adapted to turn it into an embedding model.
99105 model , tokenizer = get_llama_bidirectional_hf_model (
100106 model_name_or_path = args .hf_model_path ,
You can’t perform that action at this time.
0 commit comments