mirror of
https://github.com/huggingface/text-generation-inference.git
synced 2025-09-10 20:04:52 +00:00
improve error handling
This commit is contained in:
parent
7338e0097f
commit
74c31ee890
@ -21,7 +21,7 @@ install-torch:
|
|||||||
install: gen-server install-torch
|
install: gen-server install-torch
|
||||||
pip install pip --upgrade
|
pip install pip --upgrade
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
pip install -e ".[bnb, accelerate]"
|
pip install -e ".[bnb, accelerate, ct2]"
|
||||||
|
|
||||||
run-dev:
|
run-dev:
|
||||||
SAFETENSORS_FAST_GPU=1 python -m torch.distributed.run --nproc_per_node=2 text_generation_server/cli.py serve bigscience/bloom-560m --sharded
|
SAFETENSORS_FAST_GPU=1 python -m torch.distributed.run --nproc_per_node=2 text_generation_server/cli.py serve bigscience/bloom-560m --sharded
|
||||||
|
@ -79,8 +79,8 @@ class CT2CausalLM(Model):
|
|||||||
# Start CT2 - conversion
|
# Start CT2 - conversion
|
||||||
out_dir = Path(HUGGINGFACE_HUB_CACHE) / \
|
out_dir = Path(HUGGINGFACE_HUB_CACHE) / \
|
||||||
f"ct2models-{model_id.replace('/','--')}--{ct2_compute_type}"
|
f"ct2models-{model_id.replace('/','--')}--{ct2_compute_type}"
|
||||||
|
|
||||||
if not os.path.exists(out_dir / "model.bin"):
|
if not os.path.exists(out_dir / "model.bin"):
|
||||||
ex = ""
|
|
||||||
try:
|
try:
|
||||||
converter = ctranslate2.converters.TransformersConverter(
|
converter = ctranslate2.converters.TransformersConverter(
|
||||||
model_id,
|
model_id,
|
||||||
@ -97,15 +97,17 @@ class CT2CausalLM(Model):
|
|||||||
force=True,
|
force=True,
|
||||||
)
|
)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
pass
|
|
||||||
if not os.path.exists(out_dir / "model.bin") or ex:
|
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
f"conversion with ctranslate2 for {model_id} failed : Error {ex}"
|
f"conversion with ctranslate2 for {model_id} failed : Error {ex}"
|
||||||
)
|
)
|
||||||
|
if not os.path.exists(out_dir / "model.bin"):
|
||||||
|
raise ValueError(
|
||||||
|
f"no ctranslate2 for {model_id} found after conversion in {out_dir}"
|
||||||
|
)
|
||||||
|
|
||||||
# Start CT2
|
# Start CT2
|
||||||
self.ct2_model = ctranslate2.Generator(
|
self.ct2_model = ctranslate2.Generator(
|
||||||
out_dir, device=self.ct2_device, compute_type=ct2_compute_type
|
str(out_dir), device=self.ct2_device, compute_type=ct2_compute_type
|
||||||
)
|
)
|
||||||
|
|
||||||
class DummyModel(torch.nn.Module):
|
class DummyModel(torch.nn.Module):
|
||||||
|
Loading…
Reference in New Issue
Block a user