MCPcopy
hub / github.com/open-compass/VLMEvalKit / load_env

Function load_env

vlmeval/smp/misc.py:197–220  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

195 return subprocess.check_output(cmd).decode()
196
197def load_env():
198 import logging
199 logging.basicConfig(
200 format='[%(asctime)s] %(levelname)s - %(filename)s: %(funcName)s - %(lineno)d: %(message)s',
201 datefmt='%Y-%m-%d %H:%M:%S')
202
203 try:
204 import vlmeval
205 except ImportError:
206 logging.error('VLMEval is not installed. Failed to import environment variables from .env file. ')
207 return
208 pth = osp.realpath(vlmeval.__path__[0])
209 pth = osp.join(pth, '../.env')
210 pth = osp.realpath(pth)
211 if not osp.exists(pth):
212 logging.error(f'Did not detect the .env file at {pth}, failed to load. ')
213 return
214
215 from dotenv import dotenv_values
216 values = dotenv_values(pth)
217 for k, v in values.items():
218 if v is not None and len(v):
219 os.environ[k] = v
220 logging.info(f'API Keys successfully loaded from {pth}')
221
222def pip_install_robust(package):
223 import sys

Callers 4

run.pyFile · 0.85
__init__.pyFile · 0.85
get_envFunction · 0.85
build_judgeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected