code: def compute_scenario_file_contamination(
      training_file_path: str,
      file_format: str,
      ngram_index: NgramIndex,
      all_contamination_stats: AllContaminationStats,
      tokenizer: LightTokenizer,
      ngram_counter: Optional[NgramCounter] = None,
      max_contaminated_ngrams: int = 0,
  ):
      """
      Given an input file, compute a contamination stats for each n and each scenario by calling
      `compute_scenario_document_contamination()` for each document in the file. The function writes
      to the contamination stats directly and does not return anything.
  
      ngram_index: The ngram index that maps from ngrams to contamination stats
  
      all_contamination_stats: The contamination stats for each scenario and n. The variable to write to.
  
      tokenizer: The tokenizer used to break documents in the file into tokens
  
      ngram_counter: The ngrams that are overlapped between the training file and the scenario data
      and their counts.
      The outer dict maps from n to the inner dict, which maps from ngram to count.
      """
      document_iterator = get_document_iterator(
          file_path=training_file_path, file_format=file_format
      )
      document_index: int = 0
      for document in document_iterator:
          document_index += 1
          compute_scenario_document_contamination(
              document=document,
              ngram_index=ngram_index,
              all_contamination_stats=all_contamination_stats,
              tokenizer=tokenizer,
              ngram_counter=ngram_counter,
              max_contaminated_ngrams=max_contaminated_ngrams,
          )
  
imports: import json
  import argparse
  import os
  import glob
  from typing import List, Tuple, Set, Any, Optional
  from nltk import ngrams
  from typing import Dict
  from tqdm import tqdm
  from dataclasses import dataclass
  from helm.benchmark.contamination.light_scenario import LightInstance, LightScenario, LightScenarioKey
  from helm.benchmark.contamination.light_tokenizer import LightTokenizer, DefaultTokenizer
  from helm.benchmark.contamination.load_documents import get_document_iterator
  from helm.benchmark.contamination.contamination_stats import ContaminationStats, ContaminationStatsKey, PART_INPUT, PART_REF
  from helm.common.hierarchical_logger import hlog, htrack_block
  from helm.common.general import asdict_without_nones, write
  from helm.benchmark.scenarios.scenario import ScenarioSpec
label_desc: Use image node_id 4 for calling a global function with example usage: compute_scenario_file_contamination(training_file_path, file_format, ngram_index, all_contamination_stats, tokenizer, ngram_counter, max_contaminated_ngrams) without return types