<commit_before>from . import prop, log
from multiprocessing import Lock, cpu_count
import os, traceback

def fork( func, nice=19 ):
  'fork and run (return value is lost)'

  def wrapped( *args, **kwargs ):
    pid = os.fork()
    if pid:
      return pid
    os.nice( nice )
    try:
      func( *args, **kwargs )
    except KeyboardInterrupt:
      pass
    except:
      log.exception()
    os._exit( 0 )
  return wrapped

def shzeros( shape, dtype=float ):
  'create zero-initialized array in shared memory'

  from multiprocessing import RawArray
  from numpy import frombuffer, product, array

  try:
    shape = map(int,shape)
  except TypeError:<commit_msg>fixed windows fork issue<commit_after>from . import prop, log
from multiprocessing import Lock, cpu_count
import os, traceback

def fork( func, nice=19 ):
  'fork and run (return value is lost)'

  if not hasattr( os, 'fork' ):
    log.warning( 'fork does not exist on this platform; running %s in serial' % func.__name__ )
    return func

  def wrapped( *args, **kwargs ):
    pid = os.fork()
    if pid:
      return pid
    os.nice( nice )
    try:
      func( *args, **kwargs )
    except KeyboardInterrupt:
      pass
    except:
      log.exception()
    os._exit( 0 )
  return wrapped

def shzeros( shape, dtype=float ):
  'create zero-initialized array in shared memory'

  from multiprocessing import RawArray
  from numpy import frombuffer, product, array

  try:
    shape = map(int,shape)
  except TypeError:
{'fraction_non_alphanumeric': 0.09353970390309556, 'fraction_numerical': 0.004037685060565276, 'mean_word_length': 3.0407608695652173, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5846149', 'n_tokens_mistral': 473, 'n_tokens_neox': 457, 'n_words': 168}