MCPcopy Create free account
hub / github.com/cosdata/cosdata / main

Function main

tests/modal_remote_vllm/remote_cache_dense.py:497–560  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

495# Entry point
496# ------------------------------------------------------------------
497def main():
498 # Declare globals at the top of the function
499 global EMB_BATCH, CONCURRENT_BATCHES
500
501 parser = argparse.ArgumentParser()
502 parser.add_argument(
503 "--dataset",
504 choices=DATASETS,
505 help="Run for a single dataset (optional). Default: all.",
506 )
507 parser.add_argument(
508 "--use-chunking",
509 action="store_true",
510 help="Use text chunking instead of simple clipping for long documents",
511 )
512 parser.add_argument(
513 "--batch-size",
514 type=int,
515 default=256,
516 help="Batch size for embedding generation (default: 256)",
517 )
518 parser.add_argument(
519 "--concurrent-batches",
520 type=int,
521 default=8,
522 help="Number of concurrent API calls (default: 8)",
523 )
524 args = parser.parse_args()
525
526 # Update globals based on arguments
527 EMB_BATCH = args.batch_size
528 CONCURRENT_BATCHES = args.concurrent_batches
529
530 base_url = os.getenv(
531 "REMOTE_BASE_URL", "https://rycerzes--arctic-embeddings-serve.modal.run/v1"
532 )
533
534 print(f"Using remote embedding server: {base_url}")
535 print(
536 f"Configuration: batch_size={EMB_BATCH}, concurrent_batches={CONCURRENT_BATCHES}"
537 )
538
539 # quick health-check
540 try:
541 print("Checking server health...")
542 requests.get(base_url.replace("/v1", "/health"), timeout=5).raise_for_status()
543 print("Server is healthy ✓")
544 except Exception as e:
545 parser.error(f"Remote server not reachable: {e}")
546
547 print("Initializing tokenizer...")
548 # Force tokenizer loading here to show progress
549 _ = get_tokenizer().encode("test", add_special_tokens=True)
550 print("Tokenizer ready ✓")
551
552 embedder = RemoteEmbeddings(base_url, max_concurrent=CONCURRENT_BATCHES)
553
554 todo = [args.dataset] if args.dataset else DATASETS

Callers 1

Calls 5

get_tokenizerFunction · 0.85
RemoteEmbeddingsClass · 0.85
cache_datasetFunction · 0.85
errorMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected