mcamargo00 commited on
Commit
d0f548c
·
verified ·
1 Parent(s): 4fb809e

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -0
app.py CHANGED
@@ -21,6 +21,19 @@ import time
21
 
22
  DEVICE = torch.device("cuda" if torch.cuda.is_available() else "cpu")
23
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  # Set up logging
25
  logging.basicConfig(level=logging.INFO)
26
  logger = logging.getLogger(__name__)
 
21
 
22
  DEVICE = torch.device("cuda" if torch.cuda.is_available() else "cpu")
23
 
24
+ # --- compat shim for newer Phi-3/4 modeling files ---
25
+ import transformers as _tf
26
+ # Some HF model repos do: `from transformers.utils import LossKwargs`
27
+ # Older/newer lib versions may not re-export it, so we provide a fallback.
28
+ if not hasattr(_tf.utils, "LossKwargs"):
29
+ from typing import Dict, Any
30
+ class _LossKwargs(dict):
31
+ """Duck-typed placeholder; used only for type hints / Unpack at runtime."""
32
+ pass
33
+ _tf.utils.LossKwargs = _LossKwargs
34
+ # -----------------------------------------------------
35
+
36
+
37
  # Set up logging
38
  logging.basicConfig(level=logging.INFO)
39
  logger = logging.getLogger(__name__)