Skip to content

Commit

Permalink
fix conditional import
Browse files Browse the repository at this point in the history
  • Loading branch information
bmosaicml committed Sep 15, 2023
1 parent 57b684f commit 29da49d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
17 changes: 15 additions & 2 deletions llmfoundry/models/inference_api_wrapper/openai_causal_lm.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,21 @@
from time import sleep
from typing import Any, Dict, List, Optional, Union

import openai
import tiktoken
from composer.utils.import_helpers import MissingConditionalImportError

try:
import openai
except ImportError as e:
raise MissingConditionalImportError(extra_deps_group='openai',
conda_package='openai',
conda_channel='conda-forge') from e
try:
import tiktoken
except ImportError as e:
raise MissingConditionalImportError(extra_deps_group='openai',
conda_package='tiktoken',
conda_channel='conda-forge') from e

import torch
from composer.core.types import Batch
from openai.error import RateLimitError
Expand Down
5 changes: 4 additions & 1 deletion scripts/eval/eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,10 @@ def main(cfg: DictConfig):
device_eval_batch_size: int = pop_config(cfg,
'device_eval_batch_size',
must_exist=True)
precision: str = pop_config(cfg, 'precision', must_exist=False, default_value=None)
precision: str = pop_config(cfg,
'precision',
must_exist=False,
default_value=None)
python_log_level: Optional[str] = pop_config(cfg,
'python_log_level',
must_exist=False,
Expand Down

0 comments on commit 29da49d

Please sign in to comment.