()
| 195 | return subprocess.check_output(cmd).decode() |
| 196 | |
| 197 | def 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 | |
| 222 | def pip_install_robust(package): |
| 223 | import sys |
no outgoing calls
no test coverage detected