Fix compatibility with 1.12 (#17925)
* Fix compatibility with 1.12 * Remove pin from examples requirements * Update torch scatter version * Fix compatibility with 1.12 * Remove pin from examples requirements * Update torch scatter version * fix torch.onnx.symbolic_opset12 import * Reject bad version Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
This commit is contained in:
@@ -83,7 +83,7 @@ jobs:
|
||||
- run: git lfs install
|
||||
- run: pip install --upgrade pip
|
||||
- run: pip install .[sklearn,tf-cpu,torch,testing,sentencepiece,torch-speech,vision]
|
||||
- run: pip install torch-scatter -f https://pytorch-geometric.com/whl/torch-1.11.0+cpu.html
|
||||
- run: pip install torch-scatter -f https://pytorch-geometric.com/whl/torch-1.12.0+cpu.html
|
||||
- run: pip install tensorflow_probability
|
||||
- run: pip install https://github.com/kpu/kenlm/archive/master.zip
|
||||
- run: pip install git+https://github.com/huggingface/accelerate
|
||||
@@ -124,7 +124,7 @@ jobs:
|
||||
- run: git lfs install
|
||||
- run: pip install --upgrade pip
|
||||
- run: pip install .[sklearn,tf-cpu,torch,testing,sentencepiece,torch-speech,vision]
|
||||
- run: pip install torch-scatter -f https://pytorch-geometric.com/whl/torch-1.11.0+cpu.html
|
||||
- run: pip install torch-scatter -f https://pytorch-geometric.com/whl/torch-1.12.0+cpu.html
|
||||
- run: pip install tensorflow_probability
|
||||
- run: pip install https://github.com/kpu/kenlm/archive/master.zip
|
||||
- run: pip install git+https://github.com/huggingface/accelerate
|
||||
@@ -159,7 +159,7 @@ jobs:
|
||||
- run: sudo apt-get -y update && sudo apt-get install -y libsndfile1-dev espeak-ng
|
||||
- run: pip install --upgrade pip
|
||||
- run: pip install .[sklearn,flax,torch,testing,sentencepiece,torch-speech,vision]
|
||||
- run: pip install torch-scatter -f https://pytorch-geometric.com/whl/torch-1.11.0+cpu.html
|
||||
- run: pip install torch-scatter -f https://pytorch-geometric.com/whl/torch-1.12.0+cpu.html
|
||||
- run: pip install https://github.com/kpu/kenlm/archive/master.zip
|
||||
- run: pip install git+https://github.com/huggingface/accelerate
|
||||
- save_cache:
|
||||
@@ -198,7 +198,7 @@ jobs:
|
||||
- run: sudo apt-get -y update && sudo apt-get install -y libsndfile1-dev espeak-ng
|
||||
- run: pip install --upgrade pip
|
||||
- run: pip install .[sklearn,flax,torch,testing,sentencepiece,torch-speech,vision]
|
||||
- run: pip install torch-scatter -f https://pytorch-geometric.com/whl/torch-1.11.0+cpu.html
|
||||
- run: pip install torch-scatter -f https://pytorch-geometric.com/whl/torch-1.12.0+cpu.html
|
||||
- run: pip install https://github.com/kpu/kenlm/archive/master.zip
|
||||
- run: pip install git+https://github.com/huggingface/accelerate
|
||||
- save_cache:
|
||||
@@ -231,7 +231,7 @@ jobs:
|
||||
- run: sudo apt-get -y update && sudo apt-get install -y libsndfile1-dev espeak-ng time
|
||||
- run: pip install --upgrade pip
|
||||
- run: pip install .[sklearn,torch,testing,sentencepiece,torch-speech,vision,timm]
|
||||
- run: pip install torch-scatter -f https://pytorch-geometric.com/whl/torch-1.11.0+cpu.html
|
||||
- run: pip install torch-scatter -f https://pytorch-geometric.com/whl/torch-1.12.0+cpu.html
|
||||
- run: pip install https://github.com/kpu/kenlm/archive/master.zip
|
||||
- run: pip install git+https://github.com/huggingface/accelerate
|
||||
- save_cache:
|
||||
@@ -269,7 +269,7 @@ jobs:
|
||||
- run: sudo apt-get -y update && sudo apt-get install -y libsndfile1-dev espeak-ng
|
||||
- run: pip install --upgrade pip
|
||||
- run: pip install .[sklearn,torch,testing,sentencepiece,torch-speech,vision,timm]
|
||||
- run: pip install torch-scatter -f https://pytorch-geometric.com/whl/torch-1.11.0+cpu.html
|
||||
- run: pip install torch-scatter -f https://pytorch-geometric.com/whl/torch-1.12.0+cpu.html
|
||||
- run: pip install https://github.com/kpu/kenlm/archive/master.zip
|
||||
- run: pip install git+https://github.com/huggingface/accelerate
|
||||
- save_cache:
|
||||
@@ -439,7 +439,7 @@ jobs:
|
||||
- run: sudo apt-get -y update && sudo apt-get install -y libsndfile1-dev espeak-ng
|
||||
- run: pip install --upgrade pip
|
||||
- run: pip install .[sklearn,torch,testing,sentencepiece,torch-speech,vision,timm]
|
||||
- run: pip install torch-scatter -f https://pytorch-geometric.com/whl/torch-1.11.0+cpu.html
|
||||
- run: pip install torch-scatter -f https://pytorch-geometric.com/whl/torch-1.12.0+cpu.html
|
||||
- run: pip install https://github.com/kpu/kenlm/archive/master.zip
|
||||
- save_cache:
|
||||
key: v0.5-torch-{{ checksum "setup.py" }}
|
||||
@@ -477,7 +477,7 @@ jobs:
|
||||
- run: sudo apt-get -y update && sudo apt-get install -y libsndfile1-dev espeak-ng
|
||||
- run: pip install --upgrade pip
|
||||
- run: pip install .[sklearn,torch,testing,sentencepiece,torch-speech,vision,timm]
|
||||
- run: pip install torch-scatter -f https://pytorch-geometric.com/whl/torch-1.11.0+cpu.html
|
||||
- run: pip install torch-scatter -f https://pytorch-geometric.com/whl/torch-1.12.0+cpu.html
|
||||
- run: pip install https://github.com/kpu/kenlm/archive/master.zip
|
||||
- save_cache:
|
||||
key: v0.5-torch-{{ checksum "setup.py" }}
|
||||
|
||||
@@ -22,5 +22,4 @@ protobuf
|
||||
torchvision
|
||||
jiwer
|
||||
librosa
|
||||
torch < 1.12
|
||||
evaluate >= 0.2.0
|
||||
|
||||
2
setup.py
2
setup.py
@@ -162,7 +162,7 @@ _deps = [
|
||||
"timeout-decorator",
|
||||
"timm",
|
||||
"tokenizers>=0.11.1,!=0.11.3,<0.13",
|
||||
"torch>=1.0,<1.12",
|
||||
"torch>=1.0,!=0.12.0",
|
||||
"torchaudio",
|
||||
"pyctcdecode>=0.3.0",
|
||||
"tqdm>=4.27",
|
||||
|
||||
@@ -68,7 +68,7 @@ deps = {
|
||||
"timeout-decorator": "timeout-decorator",
|
||||
"timm": "timm",
|
||||
"tokenizers": "tokenizers>=0.11.1,!=0.11.3,<0.13",
|
||||
"torch": "torch>=1.0,<1.12",
|
||||
"torch": "torch>=1.0,!=0.12.0",
|
||||
"torchaudio": "torchaudio",
|
||||
"pyctcdecode": "pyctcdecode>=0.3.0",
|
||||
"tqdm": "tqdm>=4.27",
|
||||
|
||||
@@ -187,6 +187,8 @@ class XDropout(torch.autograd.Function):
|
||||
|
||||
@staticmethod
|
||||
def symbolic(g: torch._C.Graph, input: torch._C.Value, local_ctx: Union[float, DropoutContext]) -> torch._C.Value:
|
||||
from torch.onnx import symbolic_opset12
|
||||
|
||||
dropout_p = local_ctx
|
||||
if isinstance(local_ctx, DropoutContext):
|
||||
dropout_p = local_ctx.dropout
|
||||
@@ -198,7 +200,7 @@ class XDropout(torch.autograd.Function):
|
||||
# Once https://github.com/pytorch/pytorch/issues/78391 is fixed, do something like:
|
||||
# if opset_version < 12:
|
||||
# return torch.onnx.symbolic_opset9.dropout(g, input, dropout_p, train)
|
||||
return torch.onnx.symbolic_opset12.dropout(g, input, dropout_p, train)
|
||||
return symbolic_opset12.dropout(g, input, dropout_p, train)
|
||||
|
||||
|
||||
class StableDropout(nn.Module):
|
||||
|
||||
@@ -193,6 +193,8 @@ class XDropout(torch.autograd.Function):
|
||||
|
||||
@staticmethod
|
||||
def symbolic(g: torch._C.Graph, input: torch._C.Value, local_ctx: Union[float, DropoutContext]) -> torch._C.Value:
|
||||
from torch.onnx import symbolic_opset12
|
||||
|
||||
dropout_p = local_ctx
|
||||
if isinstance(local_ctx, DropoutContext):
|
||||
dropout_p = local_ctx.dropout
|
||||
@@ -204,7 +206,7 @@ class XDropout(torch.autograd.Function):
|
||||
# Once https://github.com/pytorch/pytorch/issues/78391 is fixed, do something like:
|
||||
# if opset_version < 12:
|
||||
# return torch.onnx.symbolic_opset9.dropout(g, input, dropout_p, train)
|
||||
return torch.onnx.symbolic_opset12.dropout(g, input, dropout_p, train)
|
||||
return symbolic_opset12.dropout(g, input, dropout_p, train)
|
||||
|
||||
|
||||
# Copied from transformers.models.deberta.modeling_deberta.StableDropout
|
||||
|
||||
@@ -597,6 +597,8 @@ class XDropout(torch.autograd.Function):
|
||||
|
||||
@staticmethod
|
||||
def symbolic(g: torch._C.Graph, input: torch._C.Value, local_ctx: Union[float, DropoutContext]) -> torch._C.Value:
|
||||
from torch.onnx import symbolic_opset12
|
||||
|
||||
dropout_p = local_ctx
|
||||
if isinstance(local_ctx, DropoutContext):
|
||||
dropout_p = local_ctx.dropout
|
||||
@@ -608,7 +610,7 @@ class XDropout(torch.autograd.Function):
|
||||
# Once https://github.com/pytorch/pytorch/issues/78391 is fixed, do something like:
|
||||
# if opset_version < 12:
|
||||
# return torch.onnx.symbolic_opset9.dropout(g, input, dropout_p, train)
|
||||
return torch.onnx.symbolic_opset12.dropout(g, input, dropout_p, train)
|
||||
return symbolic_opset12.dropout(g, input, dropout_p, train)
|
||||
|
||||
|
||||
# Copied from transformers.models.deberta.modeling_deberta.StableDropout
|
||||
|
||||
Reference in New Issue
Block a user