mirror of
https://github.com/huggingface/transformers.git
synced 2025-08-01 02:31:11 +06:00
Fix flaky test execution caused by Thread
(#34966)
fix Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
This commit is contained in:
parent
0d99a938aa
commit
5f8b24ee12
@ -29,7 +29,7 @@ import warnings
|
|||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from functools import partial, wraps
|
from functools import partial, wraps
|
||||||
from threading import Thread
|
from multiprocessing import Process
|
||||||
from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Union
|
from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Union
|
||||||
from zipfile import is_zipfile
|
from zipfile import is_zipfile
|
||||||
|
|
||||||
@ -3839,11 +3839,11 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin, GenerationMixin, PushToHubMix
|
|||||||
**has_file_kwargs,
|
**has_file_kwargs,
|
||||||
}
|
}
|
||||||
if not has_file(pretrained_model_name_or_path, safe_weights_name, **has_file_kwargs):
|
if not has_file(pretrained_model_name_or_path, safe_weights_name, **has_file_kwargs):
|
||||||
Thread(
|
Process(
|
||||||
target=auto_conversion,
|
target=auto_conversion,
|
||||||
args=(pretrained_model_name_or_path,),
|
args=(pretrained_model_name_or_path,),
|
||||||
kwargs={"ignore_errors_during_conversion": True, **cached_file_kwargs},
|
kwargs={"ignore_errors_during_conversion": True, **cached_file_kwargs},
|
||||||
name="Thread-autoconversion",
|
name="Process-auto_conversion",
|
||||||
).start()
|
).start()
|
||||||
else:
|
else:
|
||||||
# Otherwise, no PyTorch file was found, maybe there is a TF or Flax model file.
|
# Otherwise, no PyTorch file was found, maybe there is a TF or Flax model file.
|
||||||
|
Loading…
Reference in New Issue
Block a user