Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -79,6 +79,7 @@ def load_pipeline(model_name):
|
|
| 79 |
Load and cache a transformers pipeline for text generation.
|
| 80 |
Tries bfloat16, falls back to float16 or float32 if unsupported.
|
| 81 |
"""
|
|
|
|
| 82 |
|
| 83 |
if model_name in PIPELINES.keys():
|
| 84 |
return PIPELINES[model_name]
|
|
@@ -98,7 +99,6 @@ def load_pipeline(model_name):
|
|
| 98 |
device_map=device,
|
| 99 |
trust_remote_code=True,
|
| 100 |
)
|
| 101 |
-
global PIPELINES
|
| 102 |
PIPELINES[model_name] = {"tokenizer": tokenizer, "model": model}
|
| 103 |
return {"tokenizer": tokenizer, "model": model}
|
| 104 |
|
|
|
|
| 79 |
Load and cache a transformers pipeline for text generation.
|
| 80 |
Tries bfloat16, falls back to float16 or float32 if unsupported.
|
| 81 |
"""
|
| 82 |
+
global PIPELINES
|
| 83 |
|
| 84 |
if model_name in PIPELINES.keys():
|
| 85 |
return PIPELINES[model_name]
|
|
|
|
| 99 |
device_map=device,
|
| 100 |
trust_remote_code=True,
|
| 101 |
)
|
|
|
|
| 102 |
PIPELINES[model_name] = {"tokenizer": tokenizer, "model": model}
|
| 103 |
return {"tokenizer": tokenizer, "model": model}
|
| 104 |
|