MCPcopy Create free account
hub / github.com/ZinYY/TreeLoRA / random_sample

Function random_sample

assist_scripts/extract_down_sample_datasets.py:72–76  ·  view source on GitHub ↗

Randomly sample n items from data. If data has fewer items than n, return all data

(data, n)

Source from the content-addressed store, hash-verified

70
71
72def random_sample(data, n):
73 """Randomly sample n items from data. If data has fewer items than n, return all data"""
74 if len(data) <= n:
75 return data
76 return random.sample(data, n)
77
78
79def get_task_name(file_path):

Callers 1

process_datasetFunction · 0.85

Calls 1

sampleMethod · 0.80

Tested by

no test coverage detected