MCPcopy Create free account
hub / github.com/TextGeneratorio/text-generator.io / setup

Method setup

tests/benchmark_inference.py:118–137  ·  view source on GitHub ↗

Initialize model cache and load models.

(self)

Source from the content-addressed store, hash-verified

116 self.results: List[BenchmarkResult] = []
117
118 def setup(self):
119 """Initialize model cache and load models."""
120 print("Setting up benchmark environment...")
121
122 # Import here to avoid loading at import time
123 from questions.inference_server.model_cache import ModelCache
124
125 self.model_cache = ModelCache()
126
127 # Force garbage collection
128 gc.collect()
129 if torch.cuda.is_available():
130 torch.cuda.empty_cache()
131 torch.cuda.synchronize()
132
133 print(f" Device: {'CUDA' if torch.cuda.is_available() else 'CPU'}")
134 if torch.cuda.is_available():
135 print(f" GPU: {torch.cuda.get_device_name(0)}")
136 print(f" GPU Memory: {torch.cuda.get_device_properties(0).total_memory / 1e9:.1f} GB")
137 print()
138
139 def get_memory_usage(self) -> float:
140 """Get current GPU memory usage in MB."""

Callers 7

mainFunction · 0.95
setup_packageFunction · 0.45
gameon.jsFile · 0.45
KFunction · 0.45
SoundManagerFunction · 0.45
SoundManagerFunction · 0.45
wFunction · 0.45

Calls 2

ModelCacheClass · 0.90
printFunction · 0.50

Tested by

no test coverage detected