Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/Open-Bee/DataStudio
/ functions
Functions
1,367 in github.com/Open-Bee/DataStudio
⨍
Functions
1,367
◇
Types & classes
308
↳
Endpoints
27
↓ 3 callers
Method
__init__
(self, **kwargs)
tests/pipelines/test_sub_pipeline.py:87
↓ 3 callers
Method
_get_key
Get LMDB key for an image path.
datastudio/utils/database.py:236
↓ 3 callers
Method
_get_length
Get text length (character or token count).
datastudio/operators/filters/length_anomaly.py:62
↓ 3 callers
Method
_get_shard_id
Get shard ID for an image path.
datastudio/utils/database.py:191
↓ 3 callers
Method
_get_shard_id_and_key
Get shard ID and LMDB key in one MD5 call (avoid double hashing). Args: image_path: Image path string. Returns:
datastudio/utils/database.py:240
↓ 3 callers
Method
_is_anomaly
Check if length is out of bounds.
datastudio/operators/filters/length_anomaly.py:71
↓ 3 callers
Method
_load_images_for_batch
Load images for a batch from LMDB cache or disk. When ``use_lmdb_cache=True``, images are cached to LMDB first and then read back. W
datastudio/datasets/data_loader.py:194
↓ 3 callers
Method
_pre_encode_images
Pre-encode all PIL images to base64 strings in parallel. Encodes images before multi-threaded API calls to avoid PIL thread-safety is
datastudio/models/base.py:429
↓ 3 callers
Method
_save
Save checkpoint to file.
datastudio/utils/checkpoint.py:48
↓ 3 callers
Method
add_keep_record
Add a keep record (for kept items with reason).
datastudio/operators/core/data_item.py:256
↓ 3 callers
Method
build_requests
Build all requests for a DataItem. Args: item: DataItem to build requests for. batch_qa: If True, combine al
datastudio/operators/mllm/request.py:154
↓ 3 callers
Method
create_config
Create a standard configuration from file paths. Args: file_paths: List of data file paths. sources: Optional mapping
datastudio/datasets/config/config.py:203
↓ 3 callers
Function
denormalize_data
Convenience function to denormalize data. Args: data: List of normalized items. Returns: List of items in their original sch
datastudio/datasets/formatters/schema_converter.py:284
↓ 3 callers
Function
encode_image_to_base64
Encode PIL Image to base64 data URL string. Args: img: PIL Image object. target_size: Maximum dimension for thumbnail (-1 to skip
datastudio/utils/vision.py:19
↓ 3 callers
Method
export_json
Export statistics to JSON file. Args: output_path: Output file path (default: work_dir/stats.json) Returns:
datastudio/utils/statistics.py:465
↓ 3 callers
Method
get
Read image data from cache. Args: image_path: Image path to read. Returns: bytes: Image data, or None if not
datastudio/utils/database.py:291
↓ 3 callers
Method
get_sources_map
Get file_path to source mapping. Returns: dict: Mapping from file_path to source name.
datastudio/datasets/config/config.py:123
↓ 3 callers
Function
has_meaningful_content
Check if string contains sufficient proportion of alphanumeric characters. Args: text: Text to check. threshold: Minimum rat
datastudio/utils/repetition.py:6
↓ 3 callers
Function
is_mixed_language
Check if question and answer are in different languages. Useful for detecting cases where question is English but answer is Chinese. Ar
datastudio/utils/language.py:32
↓ 3 callers
Method
log_metrics
Log metrics for tracking (to file and wandb). Args: metrics: Dictionary of metric name -> value step: Option
datastudio/utils/logging.py:275
↓ 3 callers
Method
mark_kept
Mark this item as not rejected (kept).
datastudio/operators/core/data_item.py:242
↓ 3 callers
Function
normalize_data
Convenience function to normalize data. Args: data: List of data items in any supported schema. Returns: List of items in st
datastudio/datasets/formatters/schema_converter.py:272
↓ 3 callers
Method
prepare_inputs
Prepare message format for API interface. Args: inputs: Input message list. Returns: tuple: (formatted_messa
datastudio/models/base.py:200
↓ 3 callers
Method
register
Register a format handler (decorator). Args: format_class: Format class to register. Returns: The registered
datastudio/datasets/formatters/__init__.py:32
↓ 3 callers
Method
register_module
Register a module class. Can be used as a decorator or called directly: @REGISTRY.register_module() class MyClass: pa
datastudio/utils/registry.py:29
↓ 3 callers
Method
run
Execute the runner in the configured mode.
run.py:85
↓ 3 callers
Method
save
Save data to file. Args: data: List of data dictionaries. file_path: Output file path. **kwargs: Format-s
datastudio/datasets/formatters/base.py:46
↓ 3 callers
Method
save_yaml
Save YAML config and statistics.
datastudio/datasets/data_saver.py:195
↓ 3 callers
Function
unwrap_data_items
Extract raw dicts from DataItems.
datastudio/operators/core/data_item.py:424
↓ 2 callers
Method
_build_model_kwargs
Build kwargs dict to reconstruct OpenAIAPI in worker processes. Returns: Dict of constructor arguments for OpenAIAPI.
datastudio/models/mp_openai_api.py:217
↓ 2 callers
Method
_build_openai_headers
Build HTTP headers using instance API key. Overrides BaseAPI._build_openai_headers to use self.key directly. Returns: He
datastudio/models/openai_api.py:128
↓ 2 callers
Method
_clear_message_buffers
Clear all message buffers to release memory. Args: messages: List of message objects to clear.
datastudio/models/base.py:98
↓ 2 callers
Method
_collect_memory
Run garbage collection and optionally trim glibc malloc arenas. Args: trim: If True, call malloc_trim(0) to return freed memory t
datastudio/models/base.py:87
↓ 2 callers
Method
_extract_conversations
Extract conversations at specified QA indices.
datastudio/operators/core/data_item.py:349
↓ 2 callers
Method
_generate_async
Run async generation over all messages. Creates a shared :class:`aiohttp.ClientSession` with connection pooling and fires all request
datastudio/models/openai_api.py:379
↓ 2 callers
Method
_get_shard_path
Get path to shard directory.
datastudio/utils/database.py:187
↓ 2 callers
Method
_load_prompt
Load prompt from file or return as-is.
datastudio/operators/mllm/request.py:113
↓ 2 callers
Method
_load_stats
Load statistics from processed file. Args: file_path: Path to processed file. source: Source name. Returns:
datastudio/datasets/saver/processed_checker.py:104
↓ 2 callers
Method
_parse_qa_index
Parse QA index from various key formats (int, '0', 'qa_pair_0', etc.).
datastudio/operators/core/data_item.py:360
↓ 2 callers
Method
_reindex_metadata
Re-index per-QA metadata fields based on new indices.
datastudio/operators/core/data_item.py:372
↓ 2 callers
Method
_save_original
Save original content before rewriting. Args: qa_idx: QA pair index. field: 'answer' or 'question'.
datastudio/operators/core/data_item.py:179
↓ 2 callers
Method
_save_yaml
Save YAML configuration file. Args: data_files: List of data file paths. yaml_path: Output YAML file path.
datastudio/datasets/saver/yaml_generator.py:75
↓ 2 callers
Method
_update_stats
Update dataset-level statistics.
datastudio/datasets/data_saver.py:177
↓ 2 callers
Method
add_rewrite_record
Add a rewrite record.
datastudio/operators/core/data_item.py:266
↓ 2 callers
Method
build_requests_selective
Build requests for specific QA indices only. Used by SelectiveMLLMRewriter for conditional rewriting. Args: ite
datastudio/operators/mllm/request.py:179
↓ 2 callers
Method
clean
Clear data buffers.
datastudio/datasets/data_saver.py:219
↓ 2 callers
Method
clean_item
Clean a single data item by removing temporary fields. Args: item: Data item dictionary. Returns: dict: Clea
datastudio/datasets/saver/simple_saver.py:56
↓ 2 callers
Method
close_all
Close all shards.
datastudio/utils/database.py:446
↓ 2 callers
Method
denormalize
Denormalize a list of items back to original schema. Args: data: List of normalized items. Returns: List of
datastudio/datasets/formatters/schema_converter.py:142
↓ 2 callers
Method
end_operator
Record operator execution statistics. Args: name: Operator name (uses current if not specified) input_count:
datastudio/utils/statistics.py:142
↓ 2 callers
Method
extensions
(self)
tests/datasets/test_formatters.py:52
↓ 2 callers
Method
format_all_qa
Format all QA pairs for prompt.
datastudio/operators/core/data_item.py:221
↓ 2 callers
Method
format_content
Format request content. Args: item: DataItem to format. qa_idx: QA pair index (-1 for all QA). Retu
datastudio/operators/mllm/request.py:205
↓ 2 callers
Method
generate
Generate YAML configuration files. Args: dataset_stats: Dataset statistics {path: {"json_size": N, "source": S}}. cnt
datastudio/datasets/saver/yaml_generator.py:47
↓ 2 callers
Method
generate_inner
Generate response for given inputs. Must be implemented by subclasses.
datastudio/models/base.py:110
↓ 2 callers
Method
get_source_from_path
Get source name from file path. Args: file_path: Path to data file. Returns: Source name or None if not foun
datastudio/datasets/saver/processed_checker.py:38
↓ 2 callers
Method
group_by_source
Group data by source file. Args: data_list: List of data items. Returns: dict: Mapping from source file path
datastudio/datasets/saver/simple_saver.py:78
↓ 2 callers
Method
has_processed
Check if dataset has already been processed.
datastudio/datasets/data_saver.py:89
↓ 2 callers
Method
init_from_config
Initialize logger from config dict. Args: cfg: Logger configuration dict work_dir: Working directory for log
datastudio/utils/logging.py:172
↓ 2 callers
Function
init_sharded_lmdb
Initialize a single LMDB shard environment. Args: shard_path: Path to shard directory. map_size: Maximum database size in bytes.
datastudio/utils/database.py:56
↓ 2 callers
Method
load
Load YAML configuration file. Args: yaml_path: Path to YAML file. Returns: StandardConfig instance.
datastudio/datasets/config/config.py:145
↓ 2 callers
Method
load_file_paths
Load config and return all data file paths. Args: yaml_path: Path to YAML config file. data_root: Optional root direc
datastudio/datasets/config/config.py:171
↓ 2 callers
Method
log_stats
Log statistics summary. Args: title: Title for the stats section stats: Dictionary of stat name -> value
datastudio/utils/logging.py:297
↓ 2 callers
Method
normalize
Normalize a list of items to standard schema. Args: data: List of data items. Returns: List of normalized it
datastudio/datasets/formatters/schema_converter.py:130
↓ 2 callers
Function
print_cfg
Print current config in YAML format.
datastudio/utils/config.py:319
↓ 2 callers
Method
print_summary
Print formatted statistics summary.
datastudio/utils/statistics.py:353
↓ 2 callers
Method
process
Check if conversation length is within bounds. This is an item-level filter, so we override process() directly.
datastudio/operators/filters/conv_length.py:50
↓ 2 callers
Method
process_batch
Process a batch of items. Flow: 1. Build requests using RequestBuilder 2. Execute model 3. Parse responses a
datastudio/operators/mllm/base.py:60
↓ 2 callers
Method
process_single_message
Process a single message with retry logic. Args: message: Single processed message. all_kwargs: Arguments passed to g
datastudio/models/base.py:343
↓ 2 callers
Method
rewrite
Remove think tags from an answer.
datastudio/operators/rewriters/remove_think.py:44
↓ 2 callers
Method
save
Save data to files. Args: data_list: List of data items. is_rejected: Whether this is rejected data. appe
datastudio/datasets/saver/simple_saver.py:101
↓ 2 callers
Function
save_cfg
Save current config to YAML file. Args: save_file: Output file path.
datastudio/utils/config.py:309
↓ 2 callers
Method
start_operator
Mark operator start.
datastudio/utils/statistics.py:137
↓ 2 callers
Method
supported_extensions
Get all supported file extensions. Returns: list: List of supported extensions.
datastudio/datasets/formatters/__init__.py:130
↓ 2 callers
Method
update_checkpoint
Update checkpoint with current progress.
datastudio/datasets/data_loader.py:393
↓ 1 callers
Method
__init__
( self, name: str = "datastudio", level: Union[str, int] = "INFO", log_file: O
datastudio/utils/logging.py:79
↓ 1 callers
Method
__init__
Initialize the MLLM rewriter. Args: model: MLLM model instance. request_builder: RequestBuilder config dict.
datastudio/operators/mllm/rewriter.py:30
↓ 1 callers
Method
__init__
(self, should_reject=False, **kwargs)
tests/operators/test_operator.py:115
↓ 1 callers
Method
__init__
(self, **kwargs)
tests/models/test_base_api.py:22
↓ 1 callers
Method
_add_timestamp_to_filename
Add timestamp to filename before extension. Example: logs/run.log -> logs/run_20251003123456.log
datastudio/utils/logging.py:133
↓ 1 callers
Method
_apply_filters
Apply filter decisions. Returns: - (item, None): Keep everything - (None, item): Reject everything
datastudio/operators/core/result.py:134
↓ 1 callers
Method
_apply_rewrites
Apply rewrite decisions to modify item content.
datastudio/operators/core/result.py:124
↓ 1 callers
Method
_build_payload
Build payload for model.generate().
datastudio/operators/mllm/request.py:246
↓ 1 callers
Method
_build_requests
Build all requests for all items.
datastudio/operators/mllm/base.py:119
↓ 1 callers
Method
_build_sub_pipeline
Build a sub-pipeline from config. Args: cfg: Sub-pipeline config dict. name: Name of the sub-pipeline.
datastudio/pipelines/pipeline.py:86
↓ 1 callers
Method
_calculate_retry_delay
Calculate exponential backoff delay with full jitter. Delegates to base class with default max_delay of 2.0 seconds. Args:
datastudio/models/openai_api.py:241
↓ 1 callers
Method
_cleanup_requests
(all_requests: List[Dict], payloads: List[Any])
datastudio/operators/mllm/base.py:137
↓ 1 callers
Function
_clear_shared_data
Clear module-level globals after workers finish.
datastudio/models/mp_openai_api.py:44
↓ 1 callers
Method
_count_image_tags
Count <image> tags in text.
datastudio/operators/rewriters/norm_image_tag.py:43
↓ 1 callers
Method
_count_images_in_item
Count actual images in item.
datastudio/operators/rewriters/norm_image_tag.py:47
↓ 1 callers
Method
_detect_patterns
Detect hint patterns and their positions. Returns: List of (start_pos, end_pos) tuples for found patterns, sorted by
datastudio/operators/rewriters/norm_prompt.py:116
↓ 1 callers
Method
_ensure_lmdb_initialized
Ensure LMDB manager is initialized (lazy initialization).
datastudio/datasets/data_loader.py:127
↓ 1 callers
Method
_execute_operator
Execute a single operator and apply results. Returns: List of DataItems (both kept and rejected).
datastudio/pipelines/sub_pipeline.py:86
↓ 1 callers
Method
_extract_single_turn
Extract a single turn from multi-turn data.
datastudio/operators/rewriters/split.py:72
↓ 1 callers
Method
_find_configs_root
Find the configs root directory by looking for 'configs' folder. Args: start_path: Starting path to search from. Returns
datastudio/utils/config.py:105
↓ 1 callers
Method
_fix_hint_format
Fix hint formatting by adding proper newlines. Returns: Tuple of (fixed_text, was_fixed).
datastudio/operators/rewriters/norm_prompt.py:149
↓ 1 callers
Method
_has_patterns
Check if text contains instruction patterns.
datastudio/operators/rewriters/norm_multi_turn_prompt.py:46
↓ 1 callers
Method
_has_tags_in_response
Check if answer contains image/video/audio tags.
datastudio/operators/filters/response_tag.py:35
↓ 1 callers
Function
_init_shared_data
Set module-level globals before forking workers. Must be called in the main process before Pool creation. Args: messages: The full p
datastudio/models/mp_openai_api.py:30
↓ 1 callers
Method
_init_wandb
Initialize wandb logging.
datastudio/utils/logging.py:142
← previous
next →
101–200 of 1,367, ranked by callers