mirror of
https://github.com/huggingface/transformers.git
synced 2025-07-16 02:58:23 +06:00
Remove deprecated logic and warnings (#30743)
* Remove deprecated logic and warnings * Add back some code that seems to be important... * Let's just add all he nllb stuff back; removing it is a bit more involved * Remove kwargs * Remove more kwargs
This commit is contained in:
parent
3d7d3a87a0
commit
57c965a8f1
@ -22,7 +22,6 @@ import logging
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
import warnings
|
|
||||||
from dataclasses import asdict, dataclass, field
|
from dataclasses import asdict, dataclass, field
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from functools import partial
|
from functools import partial
|
||||||
@ -192,12 +191,6 @@ class ModelArguments:
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
use_auth_token: bool = field(
|
|
||||||
default=None,
|
|
||||||
metadata={
|
|
||||||
"help": "The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead."
|
|
||||||
},
|
|
||||||
)
|
|
||||||
trust_remote_code: bool = field(
|
trust_remote_code: bool = field(
|
||||||
default=False,
|
default=False,
|
||||||
metadata={
|
metadata={
|
||||||
@ -406,15 +399,6 @@ def main():
|
|||||||
else:
|
else:
|
||||||
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
||||||
|
|
||||||
if model_args.use_auth_token is not None:
|
|
||||||
warnings.warn(
|
|
||||||
"The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead.",
|
|
||||||
FutureWarning,
|
|
||||||
)
|
|
||||||
if model_args.token is not None:
|
|
||||||
raise ValueError("`token` and `use_auth_token` are both specified. Please set only the argument `token`.")
|
|
||||||
model_args.token = model_args.use_auth_token
|
|
||||||
|
|
||||||
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
||||||
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
||||||
send_example_telemetry("run_image_captioning", model_args, data_args, framework="flax")
|
send_example_telemetry("run_image_captioning", model_args, data_args, framework="flax")
|
||||||
|
@ -26,7 +26,6 @@ import math
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
import warnings
|
|
||||||
from dataclasses import asdict, dataclass, field
|
from dataclasses import asdict, dataclass, field
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from itertools import chain
|
from itertools import chain
|
||||||
@ -178,12 +177,6 @@ class ModelArguments:
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
use_auth_token: bool = field(
|
|
||||||
default=None,
|
|
||||||
metadata={
|
|
||||||
"help": "The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead."
|
|
||||||
},
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
@ -470,15 +463,6 @@ def main():
|
|||||||
else:
|
else:
|
||||||
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
||||||
|
|
||||||
if model_args.use_auth_token is not None:
|
|
||||||
warnings.warn(
|
|
||||||
"The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead.",
|
|
||||||
FutureWarning,
|
|
||||||
)
|
|
||||||
if model_args.token is not None:
|
|
||||||
raise ValueError("`token` and `use_auth_token` are both specified. Please set only the argument `token`.")
|
|
||||||
model_args.token = model_args.use_auth_token
|
|
||||||
|
|
||||||
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
||||||
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
||||||
send_example_telemetry("run_bart_dlm", model_args, data_args, framework="flax")
|
send_example_telemetry("run_bart_dlm", model_args, data_args, framework="flax")
|
||||||
|
@ -27,7 +27,6 @@ import math
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
import warnings
|
|
||||||
from dataclasses import asdict, dataclass, field
|
from dataclasses import asdict, dataclass, field
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from itertools import chain
|
from itertools import chain
|
||||||
@ -179,12 +178,6 @@ class ModelArguments:
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
use_auth_token: bool = field(
|
|
||||||
default=None,
|
|
||||||
metadata={
|
|
||||||
"help": "The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead."
|
|
||||||
},
|
|
||||||
)
|
|
||||||
trust_remote_code: bool = field(
|
trust_remote_code: bool = field(
|
||||||
default=False,
|
default=False,
|
||||||
metadata={
|
metadata={
|
||||||
@ -351,15 +344,6 @@ def main():
|
|||||||
else:
|
else:
|
||||||
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
||||||
|
|
||||||
if model_args.use_auth_token is not None:
|
|
||||||
warnings.warn(
|
|
||||||
"The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead.",
|
|
||||||
FutureWarning,
|
|
||||||
)
|
|
||||||
if model_args.token is not None:
|
|
||||||
raise ValueError("`token` and `use_auth_token` are both specified. Please set only the argument `token`.")
|
|
||||||
model_args.token = model_args.use_auth_token
|
|
||||||
|
|
||||||
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
||||||
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
||||||
send_example_telemetry("run_clm", model_args, data_args, framework="flax")
|
send_example_telemetry("run_clm", model_args, data_args, framework="flax")
|
||||||
|
@ -26,7 +26,6 @@ import math
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
import warnings
|
|
||||||
from dataclasses import asdict, dataclass, field
|
from dataclasses import asdict, dataclass, field
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from itertools import chain
|
from itertools import chain
|
||||||
@ -184,12 +183,6 @@ class ModelArguments:
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
use_auth_token: bool = field(
|
|
||||||
default=None,
|
|
||||||
metadata={
|
|
||||||
"help": "The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead."
|
|
||||||
},
|
|
||||||
)
|
|
||||||
trust_remote_code: bool = field(
|
trust_remote_code: bool = field(
|
||||||
default=False,
|
default=False,
|
||||||
metadata={
|
metadata={
|
||||||
@ -394,15 +387,6 @@ def main():
|
|||||||
else:
|
else:
|
||||||
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
||||||
|
|
||||||
if model_args.use_auth_token is not None:
|
|
||||||
warnings.warn(
|
|
||||||
"The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead.",
|
|
||||||
FutureWarning,
|
|
||||||
)
|
|
||||||
if model_args.token is not None:
|
|
||||||
raise ValueError("`token` and `use_auth_token` are both specified. Please set only the argument `token`.")
|
|
||||||
model_args.token = model_args.use_auth_token
|
|
||||||
|
|
||||||
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
||||||
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
||||||
send_example_telemetry("run_mlm", model_args, data_args, framework="flax")
|
send_example_telemetry("run_mlm", model_args, data_args, framework="flax")
|
||||||
|
@ -25,7 +25,6 @@ import math
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
import warnings
|
|
||||||
from dataclasses import asdict, dataclass, field
|
from dataclasses import asdict, dataclass, field
|
||||||
|
|
||||||
# You can also adapt this script on your own masked language modeling task. Pointers for this are left as comments.
|
# You can also adapt this script on your own masked language modeling task. Pointers for this are left as comments.
|
||||||
@ -178,12 +177,6 @@ class ModelArguments:
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
use_auth_token: bool = field(
|
|
||||||
default=None,
|
|
||||||
metadata={
|
|
||||||
"help": "The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead."
|
|
||||||
},
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
@ -511,15 +504,6 @@ def main():
|
|||||||
else:
|
else:
|
||||||
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
||||||
|
|
||||||
if model_args.use_auth_token is not None:
|
|
||||||
warnings.warn(
|
|
||||||
"The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead.",
|
|
||||||
FutureWarning,
|
|
||||||
)
|
|
||||||
if model_args.token is not None:
|
|
||||||
raise ValueError("`token` and `use_auth_token` are both specified. Please set only the argument `token`.")
|
|
||||||
model_args.token = model_args.use_auth_token
|
|
||||||
|
|
||||||
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
||||||
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
||||||
send_example_telemetry("run_t5_mlm", model_args, data_args, framework="flax")
|
send_example_telemetry("run_t5_mlm", model_args, data_args, framework="flax")
|
||||||
|
@ -25,7 +25,6 @@ import os
|
|||||||
import random
|
import random
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
import warnings
|
|
||||||
from dataclasses import asdict, dataclass, field
|
from dataclasses import asdict, dataclass, field
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
@ -165,12 +164,6 @@ class ModelArguments:
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
use_auth_token: bool = field(
|
|
||||||
default=None,
|
|
||||||
metadata={
|
|
||||||
"help": "The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead."
|
|
||||||
},
|
|
||||||
)
|
|
||||||
trust_remote_code: bool = field(
|
trust_remote_code: bool = field(
|
||||||
default=False,
|
default=False,
|
||||||
metadata={
|
metadata={
|
||||||
@ -455,15 +448,6 @@ def main():
|
|||||||
else:
|
else:
|
||||||
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
||||||
|
|
||||||
if model_args.use_auth_token is not None:
|
|
||||||
warnings.warn(
|
|
||||||
"The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead.",
|
|
||||||
FutureWarning,
|
|
||||||
)
|
|
||||||
if model_args.token is not None:
|
|
||||||
raise ValueError("`token` and `use_auth_token` are both specified. Please set only the argument `token`.")
|
|
||||||
model_args.token = model_args.use_auth_token
|
|
||||||
|
|
||||||
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
||||||
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
||||||
send_example_telemetry("run_qa", model_args, data_args, framework="flax")
|
send_example_telemetry("run_qa", model_args, data_args, framework="flax")
|
||||||
|
@ -24,7 +24,6 @@ import math
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
import warnings
|
|
||||||
from dataclasses import asdict, dataclass, field
|
from dataclasses import asdict, dataclass, field
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from functools import partial
|
from functools import partial
|
||||||
@ -198,12 +197,6 @@ class ModelArguments:
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
use_auth_token: bool = field(
|
|
||||||
default=None,
|
|
||||||
metadata={
|
|
||||||
"help": "The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead."
|
|
||||||
},
|
|
||||||
)
|
|
||||||
trust_remote_code: bool = field(
|
trust_remote_code: bool = field(
|
||||||
default=False,
|
default=False,
|
||||||
metadata={
|
metadata={
|
||||||
@ -434,15 +427,6 @@ def main():
|
|||||||
else:
|
else:
|
||||||
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
||||||
|
|
||||||
if model_args.use_auth_token is not None:
|
|
||||||
warnings.warn(
|
|
||||||
"The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead.",
|
|
||||||
FutureWarning,
|
|
||||||
)
|
|
||||||
if model_args.token is not None:
|
|
||||||
raise ValueError("`token` and `use_auth_token` are both specified. Please set only the argument `token`.")
|
|
||||||
model_args.token = model_args.use_auth_token
|
|
||||||
|
|
||||||
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
||||||
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
||||||
send_example_telemetry("run_summarization", model_args, data_args, framework="flax")
|
send_example_telemetry("run_summarization", model_args, data_args, framework="flax")
|
||||||
|
@ -24,7 +24,6 @@ import logging
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
import warnings
|
|
||||||
from dataclasses import asdict, dataclass, field
|
from dataclasses import asdict, dataclass, field
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
@ -169,12 +168,6 @@ class ModelArguments:
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
use_auth_token: bool = field(
|
|
||||||
default=None,
|
|
||||||
metadata={
|
|
||||||
"help": "The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead."
|
|
||||||
},
|
|
||||||
)
|
|
||||||
trust_remote_code: bool = field(
|
trust_remote_code: bool = field(
|
||||||
default=False,
|
default=False,
|
||||||
metadata={
|
metadata={
|
||||||
@ -274,15 +267,6 @@ def main():
|
|||||||
else:
|
else:
|
||||||
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
||||||
|
|
||||||
if model_args.use_auth_token is not None:
|
|
||||||
warnings.warn(
|
|
||||||
"The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead.",
|
|
||||||
FutureWarning,
|
|
||||||
)
|
|
||||||
if model_args.token is not None:
|
|
||||||
raise ValueError("`token` and `use_auth_token` are both specified. Please set only the argument `token`.")
|
|
||||||
model_args.token = model_args.use_auth_token
|
|
||||||
|
|
||||||
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
||||||
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
||||||
send_example_telemetry("run_image_classification", model_args, data_args, framework="flax")
|
send_example_telemetry("run_image_classification", model_args, data_args, framework="flax")
|
||||||
|
@ -161,12 +161,6 @@ class ModelArguments:
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
use_auth_token: bool = field(
|
|
||||||
default=None,
|
|
||||||
metadata={
|
|
||||||
"help": "The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead."
|
|
||||||
},
|
|
||||||
)
|
|
||||||
trust_remote_code: bool = field(
|
trust_remote_code: bool = field(
|
||||||
default=False,
|
default=False,
|
||||||
metadata={
|
metadata={
|
||||||
@ -214,15 +208,6 @@ def main():
|
|||||||
else:
|
else:
|
||||||
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
||||||
|
|
||||||
if model_args.use_auth_token is not None:
|
|
||||||
warnings.warn(
|
|
||||||
"The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead.",
|
|
||||||
FutureWarning,
|
|
||||||
)
|
|
||||||
if model_args.token is not None:
|
|
||||||
raise ValueError("`token` and `use_auth_token` are both specified. Please set only the argument `token`.")
|
|
||||||
model_args.token = model_args.use_auth_token
|
|
||||||
|
|
||||||
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
||||||
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
||||||
send_example_telemetry("run_audio_classification", model_args, data_args)
|
send_example_telemetry("run_audio_classification", model_args, data_args)
|
||||||
|
@ -26,7 +26,6 @@ Text models: BERT, ROBERTa (https://huggingface.co/models?filter=fill-mask)
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import warnings
|
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
@ -96,12 +95,6 @@ class ModelArguments:
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
use_auth_token: bool = field(
|
|
||||||
default=None,
|
|
||||||
metadata={
|
|
||||||
"help": "The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead."
|
|
||||||
},
|
|
||||||
)
|
|
||||||
trust_remote_code: bool = field(
|
trust_remote_code: bool = field(
|
||||||
default=False,
|
default=False,
|
||||||
metadata={
|
metadata={
|
||||||
@ -252,15 +245,6 @@ def main():
|
|||||||
else:
|
else:
|
||||||
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
||||||
|
|
||||||
if model_args.use_auth_token is not None:
|
|
||||||
warnings.warn(
|
|
||||||
"The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead.",
|
|
||||||
FutureWarning,
|
|
||||||
)
|
|
||||||
if model_args.token is not None:
|
|
||||||
raise ValueError("`token` and `use_auth_token` are both specified. Please set only the argument `token`.")
|
|
||||||
model_args.token = model_args.use_auth_token
|
|
||||||
|
|
||||||
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
||||||
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
||||||
send_example_telemetry("run_clip", model_args, data_args)
|
send_example_telemetry("run_clip", model_args, data_args)
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import warnings
|
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
@ -161,12 +160,6 @@ class ModelArguments:
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
use_auth_token: bool = field(
|
|
||||||
default=None,
|
|
||||||
metadata={
|
|
||||||
"help": "The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead."
|
|
||||||
},
|
|
||||||
)
|
|
||||||
trust_remote_code: bool = field(
|
trust_remote_code: bool = field(
|
||||||
default=False,
|
default=False,
|
||||||
metadata={
|
metadata={
|
||||||
@ -196,15 +189,6 @@ def main():
|
|||||||
else:
|
else:
|
||||||
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
||||||
|
|
||||||
if model_args.use_auth_token is not None:
|
|
||||||
warnings.warn(
|
|
||||||
"The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead.",
|
|
||||||
FutureWarning,
|
|
||||||
)
|
|
||||||
if model_args.token is not None:
|
|
||||||
raise ValueError("`token` and `use_auth_token` are both specified. Please set only the argument `token`.")
|
|
||||||
model_args.token = model_args.use_auth_token
|
|
||||||
|
|
||||||
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
||||||
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
||||||
send_example_telemetry("run_image_classification", model_args, data_args)
|
send_example_telemetry("run_image_classification", model_args, data_args)
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import warnings
|
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
@ -143,12 +142,6 @@ class ModelArguments:
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
use_auth_token: bool = field(
|
|
||||||
default=None,
|
|
||||||
metadata={
|
|
||||||
"help": "The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead."
|
|
||||||
},
|
|
||||||
)
|
|
||||||
mask_ratio: float = field(
|
mask_ratio: float = field(
|
||||||
default=0.75, metadata={"help": "The ratio of the number of masked tokens in the input sequence."}
|
default=0.75, metadata={"help": "The ratio of the number of masked tokens in the input sequence."}
|
||||||
)
|
)
|
||||||
@ -182,15 +175,6 @@ def main():
|
|||||||
else:
|
else:
|
||||||
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
||||||
|
|
||||||
if model_args.use_auth_token is not None:
|
|
||||||
warnings.warn(
|
|
||||||
"The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead.",
|
|
||||||
FutureWarning,
|
|
||||||
)
|
|
||||||
if model_args.token is not None:
|
|
||||||
raise ValueError("`token` and `use_auth_token` are both specified. Please set only the argument `token`.")
|
|
||||||
model_args.token = model_args.use_auth_token
|
|
||||||
|
|
||||||
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
||||||
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
||||||
send_example_telemetry("run_mae", model_args, data_args)
|
send_example_telemetry("run_mae", model_args, data_args)
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import warnings
|
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
@ -163,12 +162,6 @@ class ModelArguments:
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
use_auth_token: bool = field(
|
|
||||||
default=None,
|
|
||||||
metadata={
|
|
||||||
"help": "The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead."
|
|
||||||
},
|
|
||||||
)
|
|
||||||
trust_remote_code: bool = field(
|
trust_remote_code: bool = field(
|
||||||
default=False,
|
default=False,
|
||||||
metadata={
|
metadata={
|
||||||
@ -256,15 +249,6 @@ def main():
|
|||||||
else:
|
else:
|
||||||
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
||||||
|
|
||||||
if model_args.use_auth_token is not None:
|
|
||||||
warnings.warn(
|
|
||||||
"The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead.",
|
|
||||||
FutureWarning,
|
|
||||||
)
|
|
||||||
if model_args.token is not None:
|
|
||||||
raise ValueError("`token` and `use_auth_token` are both specified. Please set only the argument `token`.")
|
|
||||||
model_args.token = model_args.use_auth_token
|
|
||||||
|
|
||||||
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
||||||
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
||||||
send_example_telemetry("run_mim", model_args, data_args)
|
send_example_telemetry("run_mim", model_args, data_args)
|
||||||
|
@ -17,7 +17,6 @@ import argparse
|
|||||||
import logging
|
import logging
|
||||||
import math
|
import math
|
||||||
import os
|
import os
|
||||||
import warnings
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import datasets
|
import datasets
|
||||||
@ -196,12 +195,6 @@ def parse_args():
|
|||||||
"generated when running `huggingface-cli login` (stored in `~/.huggingface`)."
|
"generated when running `huggingface-cli login` (stored in `~/.huggingface`)."
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
|
||||||
"--use_auth_token",
|
|
||||||
type=bool,
|
|
||||||
default=None,
|
|
||||||
help="The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead.",
|
|
||||||
)
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--trust_remote_code",
|
"--trust_remote_code",
|
||||||
type=bool,
|
type=bool,
|
||||||
@ -384,15 +377,6 @@ def collate_fn(examples):
|
|||||||
def main():
|
def main():
|
||||||
args = parse_args()
|
args = parse_args()
|
||||||
|
|
||||||
if args.use_auth_token is not None:
|
|
||||||
warnings.warn(
|
|
||||||
"The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead.",
|
|
||||||
FutureWarning,
|
|
||||||
)
|
|
||||||
if args.token is not None:
|
|
||||||
raise ValueError("`token` and `use_auth_token` are both specified. Please set only the argument `token`.")
|
|
||||||
args.token = args.use_auth_token
|
|
||||||
|
|
||||||
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
||||||
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
||||||
send_example_telemetry("run_mim_no_trainer", args)
|
send_example_telemetry("run_mim_no_trainer", args)
|
||||||
|
@ -25,7 +25,6 @@ import logging
|
|||||||
import math
|
import math
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import warnings
|
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from itertools import chain
|
from itertools import chain
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
@ -121,12 +120,6 @@ class ModelArguments:
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
use_auth_token: bool = field(
|
|
||||||
default=None,
|
|
||||||
metadata={
|
|
||||||
"help": "The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead."
|
|
||||||
},
|
|
||||||
)
|
|
||||||
trust_remote_code: bool = field(
|
trust_remote_code: bool = field(
|
||||||
default=False,
|
default=False,
|
||||||
metadata={
|
metadata={
|
||||||
@ -255,15 +248,6 @@ def main():
|
|||||||
else:
|
else:
|
||||||
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
||||||
|
|
||||||
if model_args.use_auth_token is not None:
|
|
||||||
warnings.warn(
|
|
||||||
"The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead.",
|
|
||||||
FutureWarning,
|
|
||||||
)
|
|
||||||
if model_args.token is not None:
|
|
||||||
raise ValueError("`token` and `use_auth_token` are both specified. Please set only the argument `token`.")
|
|
||||||
model_args.token = model_args.use_auth_token
|
|
||||||
|
|
||||||
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
||||||
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
||||||
send_example_telemetry("run_clm", model_args, data_args)
|
send_example_telemetry("run_clm", model_args, data_args)
|
||||||
|
@ -25,7 +25,6 @@ import logging
|
|||||||
import math
|
import math
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import warnings
|
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from itertools import chain
|
from itertools import chain
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
@ -118,12 +117,6 @@ class ModelArguments:
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
use_auth_token: bool = field(
|
|
||||||
default=None,
|
|
||||||
metadata={
|
|
||||||
"help": "The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead."
|
|
||||||
},
|
|
||||||
)
|
|
||||||
trust_remote_code: bool = field(
|
trust_remote_code: bool = field(
|
||||||
default=False,
|
default=False,
|
||||||
metadata={
|
metadata={
|
||||||
@ -266,15 +259,6 @@ def main():
|
|||||||
else:
|
else:
|
||||||
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
||||||
|
|
||||||
if model_args.use_auth_token is not None:
|
|
||||||
warnings.warn(
|
|
||||||
"The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead.",
|
|
||||||
FutureWarning,
|
|
||||||
)
|
|
||||||
if model_args.token is not None:
|
|
||||||
raise ValueError("`token` and `use_auth_token` are both specified. Please set only the argument `token`.")
|
|
||||||
model_args.token = model_args.use_auth_token
|
|
||||||
|
|
||||||
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
||||||
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
||||||
send_example_telemetry("run_mlm", model_args, data_args)
|
send_example_telemetry("run_mlm", model_args, data_args)
|
||||||
|
@ -22,7 +22,6 @@ import logging
|
|||||||
import math
|
import math
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import warnings
|
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from itertools import chain
|
from itertools import chain
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
@ -105,12 +104,6 @@ class ModelArguments:
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
use_auth_token: bool = field(
|
|
||||||
default=None,
|
|
||||||
metadata={
|
|
||||||
"help": "The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead."
|
|
||||||
},
|
|
||||||
)
|
|
||||||
low_cpu_mem_usage: bool = field(
|
low_cpu_mem_usage: bool = field(
|
||||||
default=False,
|
default=False,
|
||||||
metadata={
|
metadata={
|
||||||
@ -236,15 +229,6 @@ def main():
|
|||||||
else:
|
else:
|
||||||
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
||||||
|
|
||||||
if model_args.use_auth_token is not None:
|
|
||||||
warnings.warn(
|
|
||||||
"The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead.",
|
|
||||||
FutureWarning,
|
|
||||||
)
|
|
||||||
if model_args.token is not None:
|
|
||||||
raise ValueError("`token` and `use_auth_token` are both specified. Please set only the argument `token`.")
|
|
||||||
model_args.token = model_args.use_auth_token
|
|
||||||
|
|
||||||
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
||||||
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
||||||
send_example_telemetry("run_plm", model_args, data_args)
|
send_example_telemetry("run_plm", model_args, data_args)
|
||||||
|
@ -21,7 +21,6 @@ Fine-tuning the library models for multiple choice.
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import warnings
|
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from itertools import chain
|
from itertools import chain
|
||||||
from typing import Optional, Union
|
from typing import Optional, Union
|
||||||
@ -89,12 +88,6 @@ class ModelArguments:
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
use_auth_token: bool = field(
|
|
||||||
default=None,
|
|
||||||
metadata={
|
|
||||||
"help": "The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead."
|
|
||||||
},
|
|
||||||
)
|
|
||||||
trust_remote_code: bool = field(
|
trust_remote_code: bool = field(
|
||||||
default=False,
|
default=False,
|
||||||
metadata={
|
metadata={
|
||||||
@ -242,15 +235,6 @@ def main():
|
|||||||
else:
|
else:
|
||||||
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
||||||
|
|
||||||
if model_args.use_auth_token is not None:
|
|
||||||
warnings.warn(
|
|
||||||
"The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead.",
|
|
||||||
FutureWarning,
|
|
||||||
)
|
|
||||||
if model_args.token is not None:
|
|
||||||
raise ValueError("`token` and `use_auth_token` are both specified. Please set only the argument `token`.")
|
|
||||||
model_args.token = model_args.use_auth_token
|
|
||||||
|
|
||||||
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
||||||
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
||||||
send_example_telemetry("run_swag", model_args, data_args)
|
send_example_telemetry("run_swag", model_args, data_args)
|
||||||
|
@ -89,12 +89,6 @@ class ModelArguments:
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
use_auth_token: bool = field(
|
|
||||||
default=None,
|
|
||||||
metadata={
|
|
||||||
"help": "The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead."
|
|
||||||
},
|
|
||||||
)
|
|
||||||
trust_remote_code: bool = field(
|
trust_remote_code: bool = field(
|
||||||
default=False,
|
default=False,
|
||||||
metadata={
|
metadata={
|
||||||
@ -244,15 +238,6 @@ def main():
|
|||||||
else:
|
else:
|
||||||
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
||||||
|
|
||||||
if model_args.use_auth_token is not None:
|
|
||||||
warnings.warn(
|
|
||||||
"The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead.",
|
|
||||||
FutureWarning,
|
|
||||||
)
|
|
||||||
if model_args.token is not None:
|
|
||||||
raise ValueError("`token` and `use_auth_token` are both specified. Please set only the argument `token`.")
|
|
||||||
model_args.token = model_args.use_auth_token
|
|
||||||
|
|
||||||
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
||||||
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
||||||
send_example_telemetry("run_qa", model_args, data_args)
|
send_example_telemetry("run_qa", model_args, data_args)
|
||||||
|
@ -21,7 +21,6 @@ Fine-tuning XLNet for question answering with beam search using a slightly adapt
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import warnings
|
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
@ -88,12 +87,6 @@ class ModelArguments:
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
use_auth_token: bool = field(
|
|
||||||
default=None,
|
|
||||||
metadata={
|
|
||||||
"help": "The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead."
|
|
||||||
},
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
@ -233,15 +226,6 @@ def main():
|
|||||||
else:
|
else:
|
||||||
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
||||||
|
|
||||||
if model_args.use_auth_token is not None:
|
|
||||||
warnings.warn(
|
|
||||||
"The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead.",
|
|
||||||
FutureWarning,
|
|
||||||
)
|
|
||||||
if model_args.token is not None:
|
|
||||||
raise ValueError("`token` and `use_auth_token` are both specified. Please set only the argument `token`.")
|
|
||||||
model_args.token = model_args.use_auth_token
|
|
||||||
|
|
||||||
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
||||||
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
||||||
send_example_telemetry("run_qa_beam_search", model_args, data_args)
|
send_example_telemetry("run_qa_beam_search", model_args, data_args)
|
||||||
|
@ -21,7 +21,6 @@ Fine-tuning the library's seq2seq models for question answering using the 🤗 S
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import warnings
|
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from typing import List, Optional, Tuple
|
from typing import List, Optional, Tuple
|
||||||
|
|
||||||
@ -90,12 +89,6 @@ class ModelArguments:
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
use_auth_token: bool = field(
|
|
||||||
default=None,
|
|
||||||
metadata={
|
|
||||||
"help": "The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead."
|
|
||||||
},
|
|
||||||
)
|
|
||||||
trust_remote_code: bool = field(
|
trust_remote_code: bool = field(
|
||||||
default=False,
|
default=False,
|
||||||
metadata={
|
metadata={
|
||||||
@ -290,15 +283,6 @@ def main():
|
|||||||
else:
|
else:
|
||||||
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
||||||
|
|
||||||
if model_args.use_auth_token is not None:
|
|
||||||
warnings.warn(
|
|
||||||
"The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead.",
|
|
||||||
FutureWarning,
|
|
||||||
)
|
|
||||||
if model_args.token is not None:
|
|
||||||
raise ValueError("`token` and `use_auth_token` are both specified. Please set only the argument `token`.")
|
|
||||||
model_args.token = model_args.use_auth_token
|
|
||||||
|
|
||||||
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
||||||
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
||||||
send_example_telemetry("run_seq2seq_qa", model_args, data_args)
|
send_example_telemetry("run_seq2seq_qa", model_args, data_args)
|
||||||
|
@ -17,7 +17,6 @@ import json
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import warnings
|
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from functools import partial
|
from functools import partial
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
@ -151,12 +150,6 @@ class ModelArguments:
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
use_auth_token: bool = field(
|
|
||||||
default=None,
|
|
||||||
metadata={
|
|
||||||
"help": "The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead."
|
|
||||||
},
|
|
||||||
)
|
|
||||||
trust_remote_code: bool = field(
|
trust_remote_code: bool = field(
|
||||||
default=False,
|
default=False,
|
||||||
metadata={
|
metadata={
|
||||||
@ -182,15 +175,6 @@ def main():
|
|||||||
else:
|
else:
|
||||||
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
||||||
|
|
||||||
if model_args.use_auth_token is not None:
|
|
||||||
warnings.warn(
|
|
||||||
"The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead.",
|
|
||||||
FutureWarning,
|
|
||||||
)
|
|
||||||
if model_args.token is not None:
|
|
||||||
raise ValueError("`token` and `use_auth_token` are both specified. Please set only the argument `token`.")
|
|
||||||
model_args.token = model_args.use_auth_token
|
|
||||||
|
|
||||||
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
||||||
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
||||||
send_example_telemetry("run_semantic_segmentation", model_args, data_args)
|
send_example_telemetry("run_semantic_segmentation", model_args, data_args)
|
||||||
|
@ -251,12 +251,6 @@ class DataTrainingArguments:
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
use_auth_token: bool = field(
|
|
||||||
default=None,
|
|
||||||
metadata={
|
|
||||||
"help": "The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead."
|
|
||||||
},
|
|
||||||
)
|
|
||||||
trust_remote_code: bool = field(
|
trust_remote_code: bool = field(
|
||||||
default=False,
|
default=False,
|
||||||
metadata={
|
metadata={
|
||||||
@ -411,15 +405,6 @@ def main():
|
|||||||
else:
|
else:
|
||||||
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
||||||
|
|
||||||
if data_args.use_auth_token is not None:
|
|
||||||
warnings.warn(
|
|
||||||
"The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead.",
|
|
||||||
FutureWarning,
|
|
||||||
)
|
|
||||||
if data_args.token is not None:
|
|
||||||
raise ValueError("`token` and `use_auth_token` are both specified. Please set only the argument `token`.")
|
|
||||||
data_args.token = data_args.use_auth_token
|
|
||||||
|
|
||||||
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
||||||
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
||||||
send_example_telemetry("run_speech_recognition_ctc", model_args, data_args)
|
send_example_telemetry("run_speech_recognition_ctc", model_args, data_args)
|
||||||
|
@ -241,12 +241,6 @@ class DataTrainingArguments:
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
use_auth_token: bool = field(
|
|
||||||
default=None,
|
|
||||||
metadata={
|
|
||||||
"help": "The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead."
|
|
||||||
},
|
|
||||||
)
|
|
||||||
trust_remote_code: bool = field(
|
trust_remote_code: bool = field(
|
||||||
default=False,
|
default=False,
|
||||||
metadata={
|
metadata={
|
||||||
@ -391,15 +385,6 @@ def main():
|
|||||||
else:
|
else:
|
||||||
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
||||||
|
|
||||||
if data_args.use_auth_token is not None:
|
|
||||||
warnings.warn(
|
|
||||||
"The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead.",
|
|
||||||
FutureWarning,
|
|
||||||
)
|
|
||||||
if data_args.token is not None:
|
|
||||||
raise ValueError("`token` and `use_auth_token` are both specified. Please set only the argument `token`.")
|
|
||||||
data_args.token = data_args.use_auth_token
|
|
||||||
|
|
||||||
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
||||||
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
||||||
send_example_telemetry("run_speech_recognition_ctc_adapter", model_args, data_args)
|
send_example_telemetry("run_speech_recognition_ctc_adapter", model_args, data_args)
|
||||||
|
@ -22,7 +22,6 @@ Fine-tuning the library models for sequence to sequence speech recognition.
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import warnings
|
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from typing import Any, Dict, List, Optional, Union
|
from typing import Any, Dict, List, Optional, Union
|
||||||
|
|
||||||
@ -95,12 +94,6 @@ class ModelArguments:
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
use_auth_token: bool = field(
|
|
||||||
default=None,
|
|
||||||
metadata={
|
|
||||||
"help": "The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead."
|
|
||||||
},
|
|
||||||
)
|
|
||||||
trust_remote_code: bool = field(
|
trust_remote_code: bool = field(
|
||||||
default=False,
|
default=False,
|
||||||
metadata={
|
metadata={
|
||||||
@ -295,15 +288,6 @@ def main():
|
|||||||
else:
|
else:
|
||||||
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
||||||
|
|
||||||
if model_args.use_auth_token is not None:
|
|
||||||
warnings.warn(
|
|
||||||
"The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead.",
|
|
||||||
FutureWarning,
|
|
||||||
)
|
|
||||||
if model_args.token is not None:
|
|
||||||
raise ValueError("`token` and `use_auth_token` are both specified. Please set only the argument `token`.")
|
|
||||||
model_args.token = model_args.use_auth_token
|
|
||||||
|
|
||||||
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
||||||
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
||||||
send_example_telemetry("run_speech_recognition_seq2seq", model_args, data_args)
|
send_example_telemetry("run_speech_recognition_seq2seq", model_args, data_args)
|
||||||
|
@ -21,7 +21,6 @@ Fine-tuning the library models for sequence to sequence.
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import warnings
|
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
@ -109,12 +108,6 @@ class ModelArguments:
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
use_auth_token: bool = field(
|
|
||||||
default=None,
|
|
||||||
metadata={
|
|
||||||
"help": "The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead."
|
|
||||||
},
|
|
||||||
)
|
|
||||||
trust_remote_code: bool = field(
|
trust_remote_code: bool = field(
|
||||||
default=False,
|
default=False,
|
||||||
metadata={
|
metadata={
|
||||||
@ -329,15 +322,6 @@ def main():
|
|||||||
else:
|
else:
|
||||||
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
||||||
|
|
||||||
if model_args.use_auth_token is not None:
|
|
||||||
warnings.warn(
|
|
||||||
"The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead.",
|
|
||||||
FutureWarning,
|
|
||||||
)
|
|
||||||
if model_args.token is not None:
|
|
||||||
raise ValueError("`token` and `use_auth_token` are both specified. Please set only the argument `token`.")
|
|
||||||
model_args.token = model_args.use_auth_token
|
|
||||||
|
|
||||||
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
||||||
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
||||||
send_example_telemetry("run_summarization", model_args, data_args)
|
send_example_telemetry("run_summarization", model_args, data_args)
|
||||||
|
@ -20,7 +20,6 @@ import logging
|
|||||||
import os
|
import os
|
||||||
import random
|
import random
|
||||||
import sys
|
import sys
|
||||||
import warnings
|
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from typing import List, Optional
|
from typing import List, Optional
|
||||||
|
|
||||||
@ -237,12 +236,6 @@ class ModelArguments:
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
use_auth_token: bool = field(
|
|
||||||
default=None,
|
|
||||||
metadata={
|
|
||||||
"help": "The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead."
|
|
||||||
},
|
|
||||||
)
|
|
||||||
trust_remote_code: bool = field(
|
trust_remote_code: bool = field(
|
||||||
default=False,
|
default=False,
|
||||||
metadata={
|
metadata={
|
||||||
@ -285,15 +278,6 @@ def main():
|
|||||||
else:
|
else:
|
||||||
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
||||||
|
|
||||||
if model_args.use_auth_token is not None:
|
|
||||||
warnings.warn(
|
|
||||||
"The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead.",
|
|
||||||
FutureWarning,
|
|
||||||
)
|
|
||||||
if model_args.token is not None:
|
|
||||||
raise ValueError("`token` and `use_auth_token` are both specified. Please set only the argument `token`.")
|
|
||||||
model_args.token = model_args.use_auth_token
|
|
||||||
|
|
||||||
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
||||||
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
||||||
send_example_telemetry("run_classification", model_args, data_args)
|
send_example_telemetry("run_classification", model_args, data_args)
|
||||||
|
@ -20,7 +20,6 @@ import logging
|
|||||||
import os
|
import os
|
||||||
import random
|
import random
|
||||||
import sys
|
import sys
|
||||||
import warnings
|
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
@ -198,12 +197,6 @@ class ModelArguments:
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
use_auth_token: bool = field(
|
|
||||||
default=None,
|
|
||||||
metadata={
|
|
||||||
"help": "The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead."
|
|
||||||
},
|
|
||||||
)
|
|
||||||
trust_remote_code: bool = field(
|
trust_remote_code: bool = field(
|
||||||
default=False,
|
default=False,
|
||||||
metadata={
|
metadata={
|
||||||
@ -233,15 +226,6 @@ def main():
|
|||||||
else:
|
else:
|
||||||
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
||||||
|
|
||||||
if model_args.use_auth_token is not None:
|
|
||||||
warnings.warn(
|
|
||||||
"The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead.",
|
|
||||||
FutureWarning,
|
|
||||||
)
|
|
||||||
if model_args.token is not None:
|
|
||||||
raise ValueError("`token` and `use_auth_token` are both specified. Please set only the argument `token`.")
|
|
||||||
model_args.token = model_args.use_auth_token
|
|
||||||
|
|
||||||
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
||||||
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
||||||
send_example_telemetry("run_glue", model_args, data_args)
|
send_example_telemetry("run_glue", model_args, data_args)
|
||||||
|
@ -21,7 +21,6 @@ import logging
|
|||||||
import os
|
import os
|
||||||
import random
|
import random
|
||||||
import sys
|
import sys
|
||||||
import warnings
|
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
@ -162,12 +161,6 @@ class ModelArguments:
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
use_auth_token: bool = field(
|
|
||||||
default=None,
|
|
||||||
metadata={
|
|
||||||
"help": "The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead."
|
|
||||||
},
|
|
||||||
)
|
|
||||||
trust_remote_code: bool = field(
|
trust_remote_code: bool = field(
|
||||||
default=False,
|
default=False,
|
||||||
metadata={
|
metadata={
|
||||||
@ -192,15 +185,6 @@ def main():
|
|||||||
parser = HfArgumentParser((ModelArguments, DataTrainingArguments, TrainingArguments))
|
parser = HfArgumentParser((ModelArguments, DataTrainingArguments, TrainingArguments))
|
||||||
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
||||||
|
|
||||||
if model_args.use_auth_token is not None:
|
|
||||||
warnings.warn(
|
|
||||||
"The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead.",
|
|
||||||
FutureWarning,
|
|
||||||
)
|
|
||||||
if model_args.token is not None:
|
|
||||||
raise ValueError("`token` and `use_auth_token` are both specified. Please set only the argument `token`.")
|
|
||||||
model_args.token = model_args.use_auth_token
|
|
||||||
|
|
||||||
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
||||||
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
||||||
send_example_telemetry("run_xnli", model_args)
|
send_example_telemetry("run_xnli", model_args)
|
||||||
|
@ -22,7 +22,6 @@ Fine-tuning the library models for token classification.
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import warnings
|
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
@ -89,12 +88,6 @@ class ModelArguments:
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
use_auth_token: bool = field(
|
|
||||||
default=None,
|
|
||||||
metadata={
|
|
||||||
"help": "The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead."
|
|
||||||
},
|
|
||||||
)
|
|
||||||
trust_remote_code: bool = field(
|
trust_remote_code: bool = field(
|
||||||
default=False,
|
default=False,
|
||||||
metadata={
|
metadata={
|
||||||
@ -234,15 +227,6 @@ def main():
|
|||||||
else:
|
else:
|
||||||
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
||||||
|
|
||||||
if model_args.use_auth_token is not None:
|
|
||||||
warnings.warn(
|
|
||||||
"The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead.",
|
|
||||||
FutureWarning,
|
|
||||||
)
|
|
||||||
if model_args.token is not None:
|
|
||||||
raise ValueError("`token` and `use_auth_token` are both specified. Please set only the argument `token`.")
|
|
||||||
model_args.token = model_args.use_auth_token
|
|
||||||
|
|
||||||
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
||||||
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
||||||
send_example_telemetry("run_ner", model_args, data_args)
|
send_example_telemetry("run_ner", model_args, data_args)
|
||||||
|
@ -21,7 +21,6 @@ Fine-tuning the library models for sequence to sequence.
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import warnings
|
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
@ -99,12 +98,6 @@ class ModelArguments:
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
use_auth_token: bool = field(
|
|
||||||
default=None,
|
|
||||||
metadata={
|
|
||||||
"help": "The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead."
|
|
||||||
},
|
|
||||||
)
|
|
||||||
trust_remote_code: bool = field(
|
trust_remote_code: bool = field(
|
||||||
default=False,
|
default=False,
|
||||||
metadata={
|
metadata={
|
||||||
@ -278,15 +271,6 @@ def main():
|
|||||||
else:
|
else:
|
||||||
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
||||||
|
|
||||||
if model_args.use_auth_token is not None:
|
|
||||||
warnings.warn(
|
|
||||||
"The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead.",
|
|
||||||
FutureWarning,
|
|
||||||
)
|
|
||||||
if model_args.token is not None:
|
|
||||||
raise ValueError("`token` and `use_auth_token` are both specified. Please set only the argument `token`.")
|
|
||||||
model_args.token = model_args.use_auth_token
|
|
||||||
|
|
||||||
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
||||||
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
||||||
send_example_telemetry("run_translation", model_args, data_args)
|
send_example_telemetry("run_translation", model_args, data_args)
|
||||||
|
@ -26,7 +26,6 @@ Text models: BERT, ROBERTa (https://huggingface.co/models?filter=fill-mask)
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import warnings
|
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
@ -102,12 +101,6 @@ class ModelArguments:
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
use_auth_token: bool = field(
|
|
||||||
default=None,
|
|
||||||
metadata={
|
|
||||||
"help": "The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead."
|
|
||||||
},
|
|
||||||
)
|
|
||||||
trust_remote_code: bool = field(
|
trust_remote_code: bool = field(
|
||||||
default=False,
|
default=False,
|
||||||
metadata={
|
metadata={
|
||||||
@ -262,15 +255,6 @@ def main():
|
|||||||
else:
|
else:
|
||||||
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
||||||
|
|
||||||
if model_args.use_auth_token is not None:
|
|
||||||
warnings.warn(
|
|
||||||
"The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead.",
|
|
||||||
FutureWarning,
|
|
||||||
)
|
|
||||||
if model_args.token is not None:
|
|
||||||
raise ValueError("`token` and `use_auth_token` are both specified. Please set only the argument `token`.")
|
|
||||||
model_args.token = model_args.use_auth_token
|
|
||||||
|
|
||||||
if model_args.model_name_or_path is not None:
|
if model_args.model_name_or_path is not None:
|
||||||
if model_args.vision_model_name_or_path is not None or model_args.text_model_name_or_path is not None:
|
if model_args.vision_model_name_or_path is not None or model_args.text_model_name_or_path is not None:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
|
@ -23,7 +23,6 @@ import json
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import warnings
|
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
@ -168,12 +167,6 @@ class ModelArguments:
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
use_auth_token: bool = field(
|
|
||||||
default=None,
|
|
||||||
metadata={
|
|
||||||
"help": "The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead."
|
|
||||||
},
|
|
||||||
)
|
|
||||||
trust_remote_code: bool = field(
|
trust_remote_code: bool = field(
|
||||||
default=False,
|
default=False,
|
||||||
metadata={
|
metadata={
|
||||||
@ -244,18 +237,6 @@ def main():
|
|||||||
else:
|
else:
|
||||||
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
||||||
|
|
||||||
if model_args.use_auth_token is not None:
|
|
||||||
warnings.warn(
|
|
||||||
"The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead.",
|
|
||||||
FutureWarning,
|
|
||||||
)
|
|
||||||
if model_args.token is not None:
|
|
||||||
raise ValueError("`token` and `use_auth_token` are both specified. Please set only the argument `token`.")
|
|
||||||
model_args.token = model_args.use_auth_token
|
|
||||||
|
|
||||||
if not (training_args.do_train or training_args.do_eval or training_args.do_predict):
|
|
||||||
exit("Must specify at least one of --do_train, --do_eval or --do_predict!")
|
|
||||||
|
|
||||||
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
||||||
# information sent is the one passed as arguments along with your Python/TensorFlow versions.
|
# information sent is the one passed as arguments along with your Python/TensorFlow versions.
|
||||||
send_example_telemetry("run_image_classification", model_args, data_args, framework="tensorflow")
|
send_example_telemetry("run_image_classification", model_args, data_args, framework="tensorflow")
|
||||||
|
@ -30,7 +30,6 @@ import math
|
|||||||
import os
|
import os
|
||||||
import random
|
import random
|
||||||
import sys
|
import sys
|
||||||
import warnings
|
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from itertools import chain
|
from itertools import chain
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
@ -122,12 +121,6 @@ class ModelArguments:
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
use_auth_token: bool = field(
|
|
||||||
default=None,
|
|
||||||
metadata={
|
|
||||||
"help": "The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead."
|
|
||||||
},
|
|
||||||
)
|
|
||||||
trust_remote_code: bool = field(
|
trust_remote_code: bool = field(
|
||||||
default=False,
|
default=False,
|
||||||
metadata={
|
metadata={
|
||||||
@ -237,15 +230,6 @@ def main():
|
|||||||
else:
|
else:
|
||||||
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
||||||
|
|
||||||
if model_args.use_auth_token is not None:
|
|
||||||
warnings.warn(
|
|
||||||
"The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead.",
|
|
||||||
FutureWarning,
|
|
||||||
)
|
|
||||||
if model_args.token is not None:
|
|
||||||
raise ValueError("`token` and `use_auth_token` are both specified. Please set only the argument `token`.")
|
|
||||||
model_args.token = model_args.use_auth_token
|
|
||||||
|
|
||||||
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
||||||
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
||||||
send_example_telemetry("run_clm", model_args, data_args, framework="tensorflow")
|
send_example_telemetry("run_clm", model_args, data_args, framework="tensorflow")
|
||||||
|
@ -28,7 +28,6 @@ import math
|
|||||||
import os
|
import os
|
||||||
import random
|
import random
|
||||||
import sys
|
import sys
|
||||||
import warnings
|
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from itertools import chain
|
from itertools import chain
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
@ -120,12 +119,6 @@ class ModelArguments:
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
use_auth_token: bool = field(
|
|
||||||
default=None,
|
|
||||||
metadata={
|
|
||||||
"help": "The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead."
|
|
||||||
},
|
|
||||||
)
|
|
||||||
trust_remote_code: bool = field(
|
trust_remote_code: bool = field(
|
||||||
default=False,
|
default=False,
|
||||||
metadata={
|
metadata={
|
||||||
@ -243,15 +236,6 @@ def main():
|
|||||||
else:
|
else:
|
||||||
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
||||||
|
|
||||||
if model_args.use_auth_token is not None:
|
|
||||||
warnings.warn(
|
|
||||||
"The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead.",
|
|
||||||
FutureWarning,
|
|
||||||
)
|
|
||||||
if model_args.token is not None:
|
|
||||||
raise ValueError("`token` and `use_auth_token` are both specified. Please set only the argument `token`.")
|
|
||||||
model_args.token = model_args.use_auth_token
|
|
||||||
|
|
||||||
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
||||||
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
||||||
send_example_telemetry("run_mlm", model_args, data_args, framework="tensorflow")
|
send_example_telemetry("run_mlm", model_args, data_args, framework="tensorflow")
|
||||||
|
@ -22,7 +22,6 @@ import json
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import warnings
|
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from itertools import chain
|
from itertools import chain
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
@ -156,12 +155,6 @@ class ModelArguments:
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
use_auth_token: bool = field(
|
|
||||||
default=None,
|
|
||||||
metadata={
|
|
||||||
"help": "The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead."
|
|
||||||
},
|
|
||||||
)
|
|
||||||
trust_remote_code: bool = field(
|
trust_remote_code: bool = field(
|
||||||
default=False,
|
default=False,
|
||||||
metadata={
|
metadata={
|
||||||
@ -256,15 +249,6 @@ def main():
|
|||||||
else:
|
else:
|
||||||
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
||||||
|
|
||||||
if model_args.use_auth_token is not None:
|
|
||||||
warnings.warn(
|
|
||||||
"The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead.",
|
|
||||||
FutureWarning,
|
|
||||||
)
|
|
||||||
if model_args.token is not None:
|
|
||||||
raise ValueError("`token` and `use_auth_token` are both specified. Please set only the argument `token`.")
|
|
||||||
model_args.token = model_args.use_auth_token
|
|
||||||
|
|
||||||
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
||||||
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
||||||
send_example_telemetry("run_swag", model_args, data_args, framework="tensorflow")
|
send_example_telemetry("run_swag", model_args, data_args, framework="tensorflow")
|
||||||
|
@ -22,7 +22,6 @@ import json
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import warnings
|
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
@ -101,12 +100,6 @@ class ModelArguments:
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
use_auth_token: bool = field(
|
|
||||||
default=None,
|
|
||||||
metadata={
|
|
||||||
"help": "The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead."
|
|
||||||
},
|
|
||||||
)
|
|
||||||
trust_remote_code: bool = field(
|
trust_remote_code: bool = field(
|
||||||
default=False,
|
default=False,
|
||||||
metadata={
|
metadata={
|
||||||
@ -276,15 +269,6 @@ def main():
|
|||||||
else:
|
else:
|
||||||
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
||||||
|
|
||||||
if model_args.use_auth_token is not None:
|
|
||||||
warnings.warn(
|
|
||||||
"The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead.",
|
|
||||||
FutureWarning,
|
|
||||||
)
|
|
||||||
if model_args.token is not None:
|
|
||||||
raise ValueError("`token` and `use_auth_token` are both specified. Please set only the argument `token`.")
|
|
||||||
model_args.token = model_args.use_auth_token
|
|
||||||
|
|
||||||
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
||||||
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
||||||
send_example_telemetry("run_qa", model_args, data_args, framework="tensorflow")
|
send_example_telemetry("run_qa", model_args, data_args, framework="tensorflow")
|
||||||
|
@ -22,7 +22,6 @@ import json
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import warnings
|
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
@ -109,12 +108,6 @@ class ModelArguments:
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
use_auth_token: bool = field(
|
|
||||||
default=None,
|
|
||||||
metadata={
|
|
||||||
"help": "The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead."
|
|
||||||
},
|
|
||||||
)
|
|
||||||
trust_remote_code: bool = field(
|
trust_remote_code: bool = field(
|
||||||
default=False,
|
default=False,
|
||||||
metadata={
|
metadata={
|
||||||
@ -304,15 +297,6 @@ def main():
|
|||||||
else:
|
else:
|
||||||
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
||||||
|
|
||||||
if model_args.use_auth_token is not None:
|
|
||||||
warnings.warn(
|
|
||||||
"The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead.",
|
|
||||||
FutureWarning,
|
|
||||||
)
|
|
||||||
if model_args.token is not None:
|
|
||||||
raise ValueError("`token` and `use_auth_token` are both specified. Please set only the argument `token`.")
|
|
||||||
model_args.token = model_args.use_auth_token
|
|
||||||
|
|
||||||
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
||||||
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
||||||
send_example_telemetry("run_summarization", model_args, data_args, framework="tensorflow")
|
send_example_telemetry("run_summarization", model_args, data_args, framework="tensorflow")
|
||||||
|
@ -20,7 +20,6 @@ import json
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import warnings
|
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
@ -174,12 +173,6 @@ class ModelArguments:
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
use_auth_token: bool = field(
|
|
||||||
default=None,
|
|
||||||
metadata={
|
|
||||||
"help": "The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead."
|
|
||||||
},
|
|
||||||
)
|
|
||||||
trust_remote_code: bool = field(
|
trust_remote_code: bool = field(
|
||||||
default=False,
|
default=False,
|
||||||
metadata={
|
metadata={
|
||||||
@ -209,15 +202,6 @@ def main():
|
|||||||
else:
|
else:
|
||||||
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
||||||
|
|
||||||
if model_args.use_auth_token is not None:
|
|
||||||
warnings.warn(
|
|
||||||
"The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead.",
|
|
||||||
FutureWarning,
|
|
||||||
)
|
|
||||||
if model_args.token is not None:
|
|
||||||
raise ValueError("`token` and `use_auth_token` are both specified. Please set only the argument `token`.")
|
|
||||||
model_args.token = model_args.use_auth_token
|
|
||||||
|
|
||||||
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
||||||
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
||||||
send_example_telemetry("run_glue", model_args, data_args, framework="tensorflow")
|
send_example_telemetry("run_glue", model_args, data_args, framework="tensorflow")
|
||||||
|
@ -20,7 +20,6 @@ import json
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import warnings
|
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
@ -194,12 +193,6 @@ class ModelArguments:
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
use_auth_token: bool = field(
|
|
||||||
default=None,
|
|
||||||
metadata={
|
|
||||||
"help": "The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead."
|
|
||||||
},
|
|
||||||
)
|
|
||||||
trust_remote_code: bool = field(
|
trust_remote_code: bool = field(
|
||||||
default=False,
|
default=False,
|
||||||
metadata={
|
metadata={
|
||||||
@ -229,15 +222,6 @@ def main():
|
|||||||
else:
|
else:
|
||||||
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
||||||
|
|
||||||
if model_args.use_auth_token is not None:
|
|
||||||
warnings.warn(
|
|
||||||
"The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead.",
|
|
||||||
FutureWarning,
|
|
||||||
)
|
|
||||||
if model_args.token is not None:
|
|
||||||
raise ValueError("`token` and `use_auth_token` are both specified. Please set only the argument `token`.")
|
|
||||||
model_args.token = model_args.use_auth_token
|
|
||||||
|
|
||||||
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
||||||
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
||||||
send_example_telemetry("run_text_classification", model_args, data_args, framework="tensorflow")
|
send_example_telemetry("run_text_classification", model_args, data_args, framework="tensorflow")
|
||||||
|
@ -21,7 +21,6 @@ import json
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import random
|
import random
|
||||||
import warnings
|
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
@ -85,12 +84,6 @@ class ModelArguments:
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
use_auth_token: bool = field(
|
|
||||||
default=None,
|
|
||||||
metadata={
|
|
||||||
"help": "The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead."
|
|
||||||
},
|
|
||||||
)
|
|
||||||
trust_remote_code: bool = field(
|
trust_remote_code: bool = field(
|
||||||
default=False,
|
default=False,
|
||||||
metadata={
|
metadata={
|
||||||
@ -213,15 +206,6 @@ def main():
|
|||||||
parser = HfArgumentParser((ModelArguments, DataTrainingArguments, TFTrainingArguments))
|
parser = HfArgumentParser((ModelArguments, DataTrainingArguments, TFTrainingArguments))
|
||||||
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
||||||
|
|
||||||
if model_args.use_auth_token is not None:
|
|
||||||
warnings.warn(
|
|
||||||
"The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead.",
|
|
||||||
FutureWarning,
|
|
||||||
)
|
|
||||||
if model_args.token is not None:
|
|
||||||
raise ValueError("`token` and `use_auth_token` are both specified. Please set only the argument `token`.")
|
|
||||||
model_args.token = model_args.use_auth_token
|
|
||||||
|
|
||||||
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
||||||
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
||||||
send_example_telemetry("run_ner", model_args, data_args, framework="tensorflow")
|
send_example_telemetry("run_ner", model_args, data_args, framework="tensorflow")
|
||||||
|
@ -22,7 +22,6 @@ import json
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import warnings
|
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
@ -103,12 +102,6 @@ class ModelArguments:
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
use_auth_token: bool = field(
|
|
||||||
default=None,
|
|
||||||
metadata={
|
|
||||||
"help": "The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead."
|
|
||||||
},
|
|
||||||
)
|
|
||||||
trust_remote_code: bool = field(
|
trust_remote_code: bool = field(
|
||||||
default=False,
|
default=False,
|
||||||
metadata={
|
metadata={
|
||||||
@ -285,15 +278,6 @@ def main():
|
|||||||
else:
|
else:
|
||||||
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
model_args, data_args, training_args = parser.parse_args_into_dataclasses()
|
||||||
|
|
||||||
if model_args.use_auth_token is not None:
|
|
||||||
warnings.warn(
|
|
||||||
"The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead.",
|
|
||||||
FutureWarning,
|
|
||||||
)
|
|
||||||
if model_args.token is not None:
|
|
||||||
raise ValueError("`token` and `use_auth_token` are both specified. Please set only the argument `token`.")
|
|
||||||
model_args.token = model_args.use_auth_token
|
|
||||||
|
|
||||||
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
|
||||||
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
# information sent is the one passed as arguments along with your Python/PyTorch versions.
|
||||||
send_example_telemetry("run_translation", model_args, data_args, framework="tensorflow")
|
send_example_telemetry("run_translation", model_args, data_args, framework="tensorflow")
|
||||||
|
@ -727,23 +727,11 @@ class ImageFeatureExtractionMixin:
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def promote_annotation_format(annotation_format: Union[AnnotionFormat, AnnotationFormat]) -> AnnotationFormat:
|
|
||||||
# can be removed when `AnnotionFormat` is fully deprecated
|
|
||||||
return AnnotationFormat(annotation_format.value)
|
|
||||||
|
|
||||||
|
|
||||||
def validate_annotations(
|
def validate_annotations(
|
||||||
annotation_format: AnnotationFormat,
|
annotation_format: AnnotationFormat,
|
||||||
supported_annotation_formats: Tuple[AnnotationFormat, ...],
|
supported_annotation_formats: Tuple[AnnotationFormat, ...],
|
||||||
annotations: List[Dict],
|
annotations: List[Dict],
|
||||||
) -> None:
|
) -> None:
|
||||||
if isinstance(annotation_format, AnnotionFormat):
|
|
||||||
logger.warning_once(
|
|
||||||
f"`{annotation_format.__class__.__name__}` is deprecated and will be removed in v4.38. "
|
|
||||||
f"Please use `{AnnotationFormat.__name__}` instead."
|
|
||||||
)
|
|
||||||
annotation_format = promote_annotation_format(annotation_format)
|
|
||||||
|
|
||||||
if annotation_format not in supported_annotation_formats:
|
if annotation_format not in supported_annotation_formats:
|
||||||
raise ValueError(f"Unsupported annotation format: {format} must be one of {supported_annotation_formats}")
|
raise ValueError(f"Unsupported annotation format: {format} must be one of {supported_annotation_formats}")
|
||||||
|
|
||||||
|
@ -371,22 +371,10 @@ class AutoImageProcessor:
|
|||||||
if image_processor_class is None and image_processor_auto_map is None:
|
if image_processor_class is None and image_processor_auto_map is None:
|
||||||
feature_extractor_class = config_dict.pop("feature_extractor_type", None)
|
feature_extractor_class = config_dict.pop("feature_extractor_type", None)
|
||||||
if feature_extractor_class is not None:
|
if feature_extractor_class is not None:
|
||||||
logger.warning(
|
|
||||||
"Could not find image processor class in the image processor config or the model config. Loading "
|
|
||||||
"based on pattern matching with the model's feature extractor configuration. Please open a "
|
|
||||||
"PR/issue to update `preprocessor_config.json` to use `image_processor_type` instead of "
|
|
||||||
"`feature_extractor_type`. This warning will be removed in v4.40."
|
|
||||||
)
|
|
||||||
image_processor_class = feature_extractor_class.replace("FeatureExtractor", "ImageProcessor")
|
image_processor_class = feature_extractor_class.replace("FeatureExtractor", "ImageProcessor")
|
||||||
if "AutoFeatureExtractor" in config_dict.get("auto_map", {}):
|
if "AutoFeatureExtractor" in config_dict.get("auto_map", {}):
|
||||||
feature_extractor_auto_map = config_dict["auto_map"]["AutoFeatureExtractor"]
|
feature_extractor_auto_map = config_dict["auto_map"]["AutoFeatureExtractor"]
|
||||||
image_processor_auto_map = feature_extractor_auto_map.replace("FeatureExtractor", "ImageProcessor")
|
image_processor_auto_map = feature_extractor_auto_map.replace("FeatureExtractor", "ImageProcessor")
|
||||||
logger.warning(
|
|
||||||
"Could not find image processor auto map in the image processor config or the model config. "
|
|
||||||
"Loading based on pattern matching with the model's feature extractor configuration. Please open a "
|
|
||||||
"PR/issue to update `preprocessor_config.json` to use `AutoImageProcessor` instead of "
|
|
||||||
"`AutoFeatureExtractor`. This warning will be removed in v4.40."
|
|
||||||
)
|
|
||||||
|
|
||||||
# If we don't find the image processor class in the image processor config, let's try the model config.
|
# If we don't find the image processor class in the image processor config, let's try the model config.
|
||||||
if image_processor_class is None and image_processor_auto_map is None:
|
if image_processor_class is None and image_processor_auto_map is None:
|
||||||
|
@ -23,7 +23,6 @@
|
|||||||
"""PyTorch Cohere model."""
|
"""PyTorch Cohere model."""
|
||||||
|
|
||||||
import math
|
import math
|
||||||
import warnings
|
|
||||||
from typing import List, Optional, Tuple, Union
|
from typing import List, Optional, Tuple, Union
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
@ -635,7 +634,6 @@ class CohereDecoderLayer(nn.Module):
|
|||||||
output_attentions: Optional[bool] = False,
|
output_attentions: Optional[bool] = False,
|
||||||
use_cache: Optional[bool] = False,
|
use_cache: Optional[bool] = False,
|
||||||
cache_position: Optional[torch.LongTensor] = None,
|
cache_position: Optional[torch.LongTensor] = None,
|
||||||
**kwargs,
|
|
||||||
) -> Tuple[torch.FloatTensor, Optional[Tuple[torch.FloatTensor, torch.FloatTensor]]]:
|
) -> Tuple[torch.FloatTensor, Optional[Tuple[torch.FloatTensor, torch.FloatTensor]]]:
|
||||||
"""
|
"""
|
||||||
Args:
|
Args:
|
||||||
@ -651,11 +649,6 @@ class CohereDecoderLayer(nn.Module):
|
|||||||
(see `past_key_values`).
|
(see `past_key_values`).
|
||||||
past_key_value (`Tuple(torch.FloatTensor)`, *optional*): cached past key and value projection states
|
past_key_value (`Tuple(torch.FloatTensor)`, *optional*): cached past key and value projection states
|
||||||
"""
|
"""
|
||||||
if "padding_mask" in kwargs:
|
|
||||||
warnings.warn(
|
|
||||||
"Passing `padding_mask` is deprecated and will be removed in v4.37. Please make sure use `attention_mask` instead.`"
|
|
||||||
)
|
|
||||||
|
|
||||||
residual = hidden_states
|
residual = hidden_states
|
||||||
|
|
||||||
hidden_states = self.input_layernorm(hidden_states)
|
hidden_states = self.input_layernorm(hidden_states)
|
||||||
@ -669,7 +662,6 @@ class CohereDecoderLayer(nn.Module):
|
|||||||
output_attentions=output_attentions,
|
output_attentions=output_attentions,
|
||||||
use_cache=use_cache,
|
use_cache=use_cache,
|
||||||
cache_position=cache_position,
|
cache_position=cache_position,
|
||||||
**kwargs,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Fully Connected
|
# Fully Connected
|
||||||
|
@ -915,31 +915,6 @@ class ConditionalDetrImageProcessor(BaseImageProcessor):
|
|||||||
raise ValueError(f"Format {format} is not supported.")
|
raise ValueError(f"Format {format} is not supported.")
|
||||||
return target
|
return target
|
||||||
|
|
||||||
# Copied from transformers.models.detr.image_processing_detr.DetrImageProcessor.prepare
|
|
||||||
def prepare(self, image, target, return_segmentation_masks=None, masks_path=None):
|
|
||||||
logger.warning_once(
|
|
||||||
"The `prepare` method is deprecated and will be removed in a v4.33. "
|
|
||||||
"Please use `prepare_annotation` instead. Note: the `prepare_annotation` method "
|
|
||||||
"does not return the image anymore.",
|
|
||||||
)
|
|
||||||
target = self.prepare_annotation(image, target, return_segmentation_masks, masks_path, self.format)
|
|
||||||
return image, target
|
|
||||||
|
|
||||||
# Copied from transformers.models.detr.image_processing_detr.DetrImageProcessor.convert_coco_poly_to_mask
|
|
||||||
def convert_coco_poly_to_mask(self, *args, **kwargs):
|
|
||||||
logger.warning_once("The `convert_coco_poly_to_mask` method is deprecated and will be removed in v4.33. ")
|
|
||||||
return convert_coco_poly_to_mask(*args, **kwargs)
|
|
||||||
|
|
||||||
# Copied from transformers.models.detr.image_processing_detr.DetrImageProcessor.prepare_coco_detection with DETR->ConditionalDetr
|
|
||||||
def prepare_coco_detection(self, *args, **kwargs):
|
|
||||||
logger.warning_once("The `prepare_coco_detection` method is deprecated and will be removed in v4.33. ")
|
|
||||||
return prepare_coco_detection_annotation(*args, **kwargs)
|
|
||||||
|
|
||||||
# Copied from transformers.models.detr.image_processing_detr.DetrImageProcessor.prepare_coco_panoptic
|
|
||||||
def prepare_coco_panoptic(self, *args, **kwargs):
|
|
||||||
logger.warning_once("The `prepare_coco_panoptic` method is deprecated and will be removed in v4.33. ")
|
|
||||||
return prepare_coco_panoptic_annotation(*args, **kwargs)
|
|
||||||
|
|
||||||
# Copied from transformers.models.detr.image_processing_detr.DetrImageProcessor.resize
|
# Copied from transformers.models.detr.image_processing_detr.DetrImageProcessor.resize
|
||||||
def resize(
|
def resize(
|
||||||
self,
|
self,
|
||||||
|
@ -556,23 +556,7 @@ class DetrAttention(nn.Module):
|
|||||||
def _shape(self, tensor: torch.Tensor, seq_len: int, batch_size: int):
|
def _shape(self, tensor: torch.Tensor, seq_len: int, batch_size: int):
|
||||||
return tensor.view(batch_size, seq_len, self.num_heads, self.head_dim).transpose(1, 2).contiguous()
|
return tensor.view(batch_size, seq_len, self.num_heads, self.head_dim).transpose(1, 2).contiguous()
|
||||||
|
|
||||||
def with_pos_embed(self, tensor: torch.Tensor, object_queries: Optional[Tensor], **kwargs):
|
def with_pos_embed(self, tensor: torch.Tensor, object_queries: Optional[Tensor]):
|
||||||
position_embeddings = kwargs.pop("position_embeddings", None)
|
|
||||||
|
|
||||||
if kwargs:
|
|
||||||
raise ValueError(f"Unexpected arguments {kwargs.keys()}")
|
|
||||||
|
|
||||||
if position_embeddings is not None and object_queries is not None:
|
|
||||||
raise ValueError(
|
|
||||||
"Cannot specify both position_embeddings and object_queries. Please use just object_queries"
|
|
||||||
)
|
|
||||||
|
|
||||||
if position_embeddings is not None:
|
|
||||||
logger.warning_once(
|
|
||||||
"position_embeddings has been deprecated and will be removed in v4.34. Please use object_queries instead"
|
|
||||||
)
|
|
||||||
object_queries = position_embeddings
|
|
||||||
|
|
||||||
return tensor if object_queries is None else tensor + object_queries
|
return tensor if object_queries is None else tensor + object_queries
|
||||||
|
|
||||||
def forward(
|
def forward(
|
||||||
@ -583,38 +567,8 @@ class DetrAttention(nn.Module):
|
|||||||
key_value_states: Optional[torch.Tensor] = None,
|
key_value_states: Optional[torch.Tensor] = None,
|
||||||
spatial_position_embeddings: Optional[torch.Tensor] = None,
|
spatial_position_embeddings: Optional[torch.Tensor] = None,
|
||||||
output_attentions: bool = False,
|
output_attentions: bool = False,
|
||||||
**kwargs,
|
|
||||||
) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]:
|
) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]:
|
||||||
"""Input shape: Batch x Time x Channel"""
|
"""Input shape: Batch x Time x Channel"""
|
||||||
|
|
||||||
position_embeddings = kwargs.pop("position_ebmeddings", None)
|
|
||||||
key_value_position_embeddings = kwargs.pop("key_value_position_embeddings", None)
|
|
||||||
|
|
||||||
if kwargs:
|
|
||||||
raise ValueError(f"Unexpected arguments {kwargs.keys()}")
|
|
||||||
|
|
||||||
if position_embeddings is not None and object_queries is not None:
|
|
||||||
raise ValueError(
|
|
||||||
"Cannot specify both position_embeddings and object_queries. Please use just object_queries"
|
|
||||||
)
|
|
||||||
|
|
||||||
if key_value_position_embeddings is not None and spatial_position_embeddings is not None:
|
|
||||||
raise ValueError(
|
|
||||||
"Cannot specify both key_value_position_embeddings and spatial_position_embeddings. Please use just spatial_position_embeddings"
|
|
||||||
)
|
|
||||||
|
|
||||||
if position_embeddings is not None:
|
|
||||||
logger.warning_once(
|
|
||||||
"position_embeddings has been deprecated and will be removed in v4.34. Please use object_queries instead"
|
|
||||||
)
|
|
||||||
object_queries = position_embeddings
|
|
||||||
|
|
||||||
if key_value_position_embeddings is not None:
|
|
||||||
logger.warning_once(
|
|
||||||
"key_value_position_embeddings has been deprecated and will be removed in v4.34. Please use spatial_position_embeddings instead"
|
|
||||||
)
|
|
||||||
spatial_position_embeddings = key_value_position_embeddings
|
|
||||||
|
|
||||||
# if key_value_states are provided this layer is used as a cross-attention layer
|
# if key_value_states are provided this layer is used as a cross-attention layer
|
||||||
# for the decoder
|
# for the decoder
|
||||||
is_cross_attention = key_value_states is not None
|
is_cross_attention = key_value_states is not None
|
||||||
@ -838,7 +792,6 @@ class ConditionalDetrEncoderLayer(nn.Module):
|
|||||||
attention_mask: torch.Tensor,
|
attention_mask: torch.Tensor,
|
||||||
object_queries: torch.Tensor = None,
|
object_queries: torch.Tensor = None,
|
||||||
output_attentions: bool = False,
|
output_attentions: bool = False,
|
||||||
**kwargs,
|
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
Args:
|
Args:
|
||||||
@ -852,22 +805,6 @@ class ConditionalDetrEncoderLayer(nn.Module):
|
|||||||
Whether or not to return the attentions tensors of all attention layers. See `attentions` under
|
Whether or not to return the attentions tensors of all attention layers. See `attentions` under
|
||||||
returned tensors for more detail.
|
returned tensors for more detail.
|
||||||
"""
|
"""
|
||||||
position_embeddings = kwargs.pop("position_embeddings", None)
|
|
||||||
|
|
||||||
if kwargs:
|
|
||||||
raise ValueError(f"Unexpected arguments {kwargs.keys()}")
|
|
||||||
|
|
||||||
if position_embeddings is not None and object_queries is not None:
|
|
||||||
raise ValueError(
|
|
||||||
"Cannot specify both position_embeddings and object_queries. Please use just object_queries"
|
|
||||||
)
|
|
||||||
|
|
||||||
if position_embeddings is not None:
|
|
||||||
logger.warning_once(
|
|
||||||
"position_embeddings has been deprecated and will be removed in v4.34. Please use object_queries instead"
|
|
||||||
)
|
|
||||||
object_queries = position_embeddings
|
|
||||||
|
|
||||||
residual = hidden_states
|
residual = hidden_states
|
||||||
hidden_states, attn_weights = self.self_attn(
|
hidden_states, attn_weights = self.self_attn(
|
||||||
hidden_states=hidden_states,
|
hidden_states=hidden_states,
|
||||||
@ -956,7 +893,6 @@ class ConditionalDetrDecoderLayer(nn.Module):
|
|||||||
encoder_attention_mask: Optional[torch.Tensor] = None,
|
encoder_attention_mask: Optional[torch.Tensor] = None,
|
||||||
output_attentions: Optional[bool] = False,
|
output_attentions: Optional[bool] = False,
|
||||||
is_first: Optional[bool] = False,
|
is_first: Optional[bool] = False,
|
||||||
**kwargs,
|
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
Args:
|
Args:
|
||||||
@ -979,22 +915,6 @@ class ConditionalDetrDecoderLayer(nn.Module):
|
|||||||
Whether or not to return the attentions tensors of all attention layers. See `attentions` under
|
Whether or not to return the attentions tensors of all attention layers. See `attentions` under
|
||||||
returned tensors for more detail.
|
returned tensors for more detail.
|
||||||
"""
|
"""
|
||||||
position_embeddings = kwargs.pop("position_embeddings", None)
|
|
||||||
|
|
||||||
if kwargs:
|
|
||||||
raise ValueError(f"Unexpected arguments {kwargs.keys()}")
|
|
||||||
|
|
||||||
if position_embeddings is not None and object_queries is not None:
|
|
||||||
raise ValueError(
|
|
||||||
"Cannot specify both position_embeddings and object_queries. Please use just object_queries"
|
|
||||||
)
|
|
||||||
|
|
||||||
if position_embeddings is not None:
|
|
||||||
logger.warning_once(
|
|
||||||
"position_embeddings has been deprecated and will be removed in v4.34. Please use object_queries instead"
|
|
||||||
)
|
|
||||||
object_queries = position_embeddings
|
|
||||||
|
|
||||||
residual = hidden_states
|
residual = hidden_states
|
||||||
|
|
||||||
# ========== Begin of Self-Attention =============
|
# ========== Begin of Self-Attention =============
|
||||||
@ -1236,7 +1156,6 @@ class ConditionalDetrEncoder(ConditionalDetrPreTrainedModel):
|
|||||||
output_attentions=None,
|
output_attentions=None,
|
||||||
output_hidden_states=None,
|
output_hidden_states=None,
|
||||||
return_dict=None,
|
return_dict=None,
|
||||||
**kwargs,
|
|
||||||
):
|
):
|
||||||
r"""
|
r"""
|
||||||
Args:
|
Args:
|
||||||
@ -1263,22 +1182,6 @@ class ConditionalDetrEncoder(ConditionalDetrPreTrainedModel):
|
|||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
position_embeddings = kwargs.pop("position_embeddings", None)
|
|
||||||
|
|
||||||
if kwargs:
|
|
||||||
raise ValueError(f"Unexpected arguments {kwargs.keys()}")
|
|
||||||
|
|
||||||
if position_embeddings is not None and object_queries is not None:
|
|
||||||
raise ValueError(
|
|
||||||
"Cannot specify both position_embeddings and object_queries. Please use just object_queries"
|
|
||||||
)
|
|
||||||
|
|
||||||
if position_embeddings is not None:
|
|
||||||
logger.warning_once(
|
|
||||||
"position_embeddings has been deprecated and will be removed in v4.34. Please use object_queries instead"
|
|
||||||
)
|
|
||||||
object_queries = position_embeddings
|
|
||||||
|
|
||||||
output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
|
output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
|
||||||
output_hidden_states = (
|
output_hidden_states = (
|
||||||
output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
|
output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
|
||||||
@ -1377,7 +1280,6 @@ class ConditionalDetrDecoder(ConditionalDetrPreTrainedModel):
|
|||||||
output_attentions=None,
|
output_attentions=None,
|
||||||
output_hidden_states=None,
|
output_hidden_states=None,
|
||||||
return_dict=None,
|
return_dict=None,
|
||||||
**kwargs,
|
|
||||||
):
|
):
|
||||||
r"""
|
r"""
|
||||||
Args:
|
Args:
|
||||||
@ -1414,22 +1316,6 @@ class ConditionalDetrDecoder(ConditionalDetrPreTrainedModel):
|
|||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
position_embeddings = kwargs.pop("position_embeddings", None)
|
|
||||||
|
|
||||||
if kwargs:
|
|
||||||
raise ValueError(f"Unexpected arguments {kwargs.keys()}")
|
|
||||||
|
|
||||||
if position_embeddings is not None and object_queries is not None:
|
|
||||||
raise ValueError(
|
|
||||||
"Cannot specify both position_embeddings and object_queries. Please use just object_queries"
|
|
||||||
)
|
|
||||||
|
|
||||||
if position_embeddings is not None:
|
|
||||||
logger.warning_once(
|
|
||||||
"position_embeddings has been deprecated and will be removed in v4.34. Please use object_queries instead"
|
|
||||||
)
|
|
||||||
object_queries = position_embeddings
|
|
||||||
|
|
||||||
output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
|
output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
|
||||||
output_hidden_states = (
|
output_hidden_states = (
|
||||||
output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
|
output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
|
||||||
|
@ -913,31 +913,6 @@ class DeformableDetrImageProcessor(BaseImageProcessor):
|
|||||||
raise ValueError(f"Format {format} is not supported.")
|
raise ValueError(f"Format {format} is not supported.")
|
||||||
return target
|
return target
|
||||||
|
|
||||||
# Copied from transformers.models.detr.image_processing_detr.DetrImageProcessor.prepare
|
|
||||||
def prepare(self, image, target, return_segmentation_masks=None, masks_path=None):
|
|
||||||
logger.warning_once(
|
|
||||||
"The `prepare` method is deprecated and will be removed in a v4.33. "
|
|
||||||
"Please use `prepare_annotation` instead. Note: the `prepare_annotation` method "
|
|
||||||
"does not return the image anymore.",
|
|
||||||
)
|
|
||||||
target = self.prepare_annotation(image, target, return_segmentation_masks, masks_path, self.format)
|
|
||||||
return image, target
|
|
||||||
|
|
||||||
# Copied from transformers.models.detr.image_processing_detr.DetrImageProcessor.convert_coco_poly_to_mask
|
|
||||||
def convert_coco_poly_to_mask(self, *args, **kwargs):
|
|
||||||
logger.warning_once("The `convert_coco_poly_to_mask` method is deprecated and will be removed in v4.33. ")
|
|
||||||
return convert_coco_poly_to_mask(*args, **kwargs)
|
|
||||||
|
|
||||||
# Copied from transformers.models.detr.image_processing_detr.DetrImageProcessor.prepare_coco_detection
|
|
||||||
def prepare_coco_detection(self, *args, **kwargs):
|
|
||||||
logger.warning_once("The `prepare_coco_detection` method is deprecated and will be removed in v4.33. ")
|
|
||||||
return prepare_coco_detection_annotation(*args, **kwargs)
|
|
||||||
|
|
||||||
# Copied from transformers.models.detr.image_processing_detr.DetrImageProcessor.prepare_coco_panoptic
|
|
||||||
def prepare_coco_panoptic(self, *args, **kwargs):
|
|
||||||
logger.warning_once("The `prepare_coco_panoptic` method is deprecated and will be removed in v4.33. ")
|
|
||||||
return prepare_coco_panoptic_annotation(*args, **kwargs)
|
|
||||||
|
|
||||||
# Copied from transformers.models.detr.image_processing_detr.DetrImageProcessor.resize
|
# Copied from transformers.models.detr.image_processing_detr.DetrImageProcessor.resize
|
||||||
def resize(
|
def resize(
|
||||||
self,
|
self,
|
||||||
|
@ -576,31 +576,6 @@ class DetaImageProcessor(BaseImageProcessor):
|
|||||||
raise ValueError(f"Format {format} is not supported.")
|
raise ValueError(f"Format {format} is not supported.")
|
||||||
return target
|
return target
|
||||||
|
|
||||||
# Copied from transformers.models.detr.image_processing_detr.DetrImageProcessor.prepare
|
|
||||||
def prepare(self, image, target, return_segmentation_masks=None, masks_path=None):
|
|
||||||
logger.warning_once(
|
|
||||||
"The `prepare` method is deprecated and will be removed in a v4.33. "
|
|
||||||
"Please use `prepare_annotation` instead. Note: the `prepare_annotation` method "
|
|
||||||
"does not return the image anymore.",
|
|
||||||
)
|
|
||||||
target = self.prepare_annotation(image, target, return_segmentation_masks, masks_path, self.format)
|
|
||||||
return image, target
|
|
||||||
|
|
||||||
# Copied from transformers.models.detr.image_processing_detr.DetrImageProcessor.convert_coco_poly_to_mask
|
|
||||||
def convert_coco_poly_to_mask(self, *args, **kwargs):
|
|
||||||
logger.warning_once("The `convert_coco_poly_to_mask` method is deprecated and will be removed in v4.33. ")
|
|
||||||
return convert_coco_poly_to_mask(*args, **kwargs)
|
|
||||||
|
|
||||||
# Copied from transformers.models.detr.image_processing_detr.DetrImageProcessor.prepare_coco_detection
|
|
||||||
def prepare_coco_detection(self, *args, **kwargs):
|
|
||||||
logger.warning_once("The `prepare_coco_detection` method is deprecated and will be removed in v4.33. ")
|
|
||||||
return prepare_coco_detection_annotation(*args, **kwargs)
|
|
||||||
|
|
||||||
# Copied from transformers.models.detr.image_processing_detr.DetrImageProcessor.prepare_coco_panoptic
|
|
||||||
def prepare_coco_panoptic(self, *args, **kwargs):
|
|
||||||
logger.warning_once("The `prepare_coco_panoptic` method is deprecated and will be removed in v4.33. ")
|
|
||||||
return prepare_coco_panoptic_annotation(*args, **kwargs)
|
|
||||||
|
|
||||||
def resize(
|
def resize(
|
||||||
self,
|
self,
|
||||||
image: np.ndarray,
|
image: np.ndarray,
|
||||||
|
@ -896,27 +896,6 @@ class DetrImageProcessor(BaseImageProcessor):
|
|||||||
raise ValueError(f"Format {format} is not supported.")
|
raise ValueError(f"Format {format} is not supported.")
|
||||||
return target
|
return target
|
||||||
|
|
||||||
def prepare(self, image, target, return_segmentation_masks=None, masks_path=None):
|
|
||||||
logger.warning_once(
|
|
||||||
"The `prepare` method is deprecated and will be removed in a v4.33. "
|
|
||||||
"Please use `prepare_annotation` instead. Note: the `prepare_annotation` method "
|
|
||||||
"does not return the image anymore.",
|
|
||||||
)
|
|
||||||
target = self.prepare_annotation(image, target, return_segmentation_masks, masks_path, self.format)
|
|
||||||
return image, target
|
|
||||||
|
|
||||||
def convert_coco_poly_to_mask(self, *args, **kwargs):
|
|
||||||
logger.warning_once("The `convert_coco_poly_to_mask` method is deprecated and will be removed in v4.33. ")
|
|
||||||
return convert_coco_poly_to_mask(*args, **kwargs)
|
|
||||||
|
|
||||||
def prepare_coco_detection(self, *args, **kwargs):
|
|
||||||
logger.warning_once("The `prepare_coco_detection` method is deprecated and will be removed in v4.33. ")
|
|
||||||
return prepare_coco_detection_annotation(*args, **kwargs)
|
|
||||||
|
|
||||||
def prepare_coco_panoptic(self, *args, **kwargs):
|
|
||||||
logger.warning_once("The `prepare_coco_panoptic` method is deprecated and will be removed in v4.33. ")
|
|
||||||
return prepare_coco_panoptic_annotation(*args, **kwargs)
|
|
||||||
|
|
||||||
def resize(
|
def resize(
|
||||||
self,
|
self,
|
||||||
image: np.ndarray,
|
image: np.ndarray,
|
||||||
|
@ -524,23 +524,7 @@ class DetrAttention(nn.Module):
|
|||||||
def _shape(self, tensor: torch.Tensor, seq_len: int, batch_size: int):
|
def _shape(self, tensor: torch.Tensor, seq_len: int, batch_size: int):
|
||||||
return tensor.view(batch_size, seq_len, self.num_heads, self.head_dim).transpose(1, 2).contiguous()
|
return tensor.view(batch_size, seq_len, self.num_heads, self.head_dim).transpose(1, 2).contiguous()
|
||||||
|
|
||||||
def with_pos_embed(self, tensor: torch.Tensor, object_queries: Optional[Tensor], **kwargs):
|
def with_pos_embed(self, tensor: torch.Tensor, object_queries: Optional[Tensor]):
|
||||||
position_embeddings = kwargs.pop("position_embeddings", None)
|
|
||||||
|
|
||||||
if kwargs:
|
|
||||||
raise ValueError(f"Unexpected arguments {kwargs.keys()}")
|
|
||||||
|
|
||||||
if position_embeddings is not None and object_queries is not None:
|
|
||||||
raise ValueError(
|
|
||||||
"Cannot specify both position_embeddings and object_queries. Please use just object_queries"
|
|
||||||
)
|
|
||||||
|
|
||||||
if position_embeddings is not None:
|
|
||||||
logger.warning_once(
|
|
||||||
"position_embeddings has been deprecated and will be removed in v4.34. Please use object_queries instead"
|
|
||||||
)
|
|
||||||
object_queries = position_embeddings
|
|
||||||
|
|
||||||
return tensor if object_queries is None else tensor + object_queries
|
return tensor if object_queries is None else tensor + object_queries
|
||||||
|
|
||||||
def forward(
|
def forward(
|
||||||
@ -551,38 +535,8 @@ class DetrAttention(nn.Module):
|
|||||||
key_value_states: Optional[torch.Tensor] = None,
|
key_value_states: Optional[torch.Tensor] = None,
|
||||||
spatial_position_embeddings: Optional[torch.Tensor] = None,
|
spatial_position_embeddings: Optional[torch.Tensor] = None,
|
||||||
output_attentions: bool = False,
|
output_attentions: bool = False,
|
||||||
**kwargs,
|
|
||||||
) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]:
|
) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]:
|
||||||
"""Input shape: Batch x Time x Channel"""
|
"""Input shape: Batch x Time x Channel"""
|
||||||
|
|
||||||
position_embeddings = kwargs.pop("position_ebmeddings", None)
|
|
||||||
key_value_position_embeddings = kwargs.pop("key_value_position_embeddings", None)
|
|
||||||
|
|
||||||
if kwargs:
|
|
||||||
raise ValueError(f"Unexpected arguments {kwargs.keys()}")
|
|
||||||
|
|
||||||
if position_embeddings is not None and object_queries is not None:
|
|
||||||
raise ValueError(
|
|
||||||
"Cannot specify both position_embeddings and object_queries. Please use just object_queries"
|
|
||||||
)
|
|
||||||
|
|
||||||
if key_value_position_embeddings is not None and spatial_position_embeddings is not None:
|
|
||||||
raise ValueError(
|
|
||||||
"Cannot specify both key_value_position_embeddings and spatial_position_embeddings. Please use just spatial_position_embeddings"
|
|
||||||
)
|
|
||||||
|
|
||||||
if position_embeddings is not None:
|
|
||||||
logger.warning_once(
|
|
||||||
"position_embeddings has been deprecated and will be removed in v4.34. Please use object_queries instead"
|
|
||||||
)
|
|
||||||
object_queries = position_embeddings
|
|
||||||
|
|
||||||
if key_value_position_embeddings is not None:
|
|
||||||
logger.warning_once(
|
|
||||||
"key_value_position_embeddings has been deprecated and will be removed in v4.34. Please use spatial_position_embeddings instead"
|
|
||||||
)
|
|
||||||
spatial_position_embeddings = key_value_position_embeddings
|
|
||||||
|
|
||||||
# if key_value_states are provided this layer is used as a cross-attention layer
|
# if key_value_states are provided this layer is used as a cross-attention layer
|
||||||
# for the decoder
|
# for the decoder
|
||||||
is_cross_attention = key_value_states is not None
|
is_cross_attention = key_value_states is not None
|
||||||
@ -688,7 +642,6 @@ class DetrEncoderLayer(nn.Module):
|
|||||||
attention_mask: torch.Tensor,
|
attention_mask: torch.Tensor,
|
||||||
object_queries: torch.Tensor = None,
|
object_queries: torch.Tensor = None,
|
||||||
output_attentions: bool = False,
|
output_attentions: bool = False,
|
||||||
**kwargs,
|
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
Args:
|
Args:
|
||||||
@ -702,22 +655,6 @@ class DetrEncoderLayer(nn.Module):
|
|||||||
Whether or not to return the attentions tensors of all attention layers. See `attentions` under
|
Whether or not to return the attentions tensors of all attention layers. See `attentions` under
|
||||||
returned tensors for more detail.
|
returned tensors for more detail.
|
||||||
"""
|
"""
|
||||||
position_embeddings = kwargs.pop("position_embeddings", None)
|
|
||||||
|
|
||||||
if kwargs:
|
|
||||||
raise ValueError(f"Unexpected arguments {kwargs.keys()}")
|
|
||||||
|
|
||||||
if position_embeddings is not None and object_queries is not None:
|
|
||||||
raise ValueError(
|
|
||||||
"Cannot specify both position_embeddings and object_queries. Please use just object_queries"
|
|
||||||
)
|
|
||||||
|
|
||||||
if position_embeddings is not None:
|
|
||||||
logger.warning_once(
|
|
||||||
"position_embeddings has been deprecated and will be removed in v4.34. Please use object_queries instead"
|
|
||||||
)
|
|
||||||
object_queries = position_embeddings
|
|
||||||
|
|
||||||
residual = hidden_states
|
residual = hidden_states
|
||||||
hidden_states, attn_weights = self.self_attn(
|
hidden_states, attn_weights = self.self_attn(
|
||||||
hidden_states=hidden_states,
|
hidden_states=hidden_states,
|
||||||
@ -787,7 +724,6 @@ class DetrDecoderLayer(nn.Module):
|
|||||||
encoder_hidden_states: Optional[torch.Tensor] = None,
|
encoder_hidden_states: Optional[torch.Tensor] = None,
|
||||||
encoder_attention_mask: Optional[torch.Tensor] = None,
|
encoder_attention_mask: Optional[torch.Tensor] = None,
|
||||||
output_attentions: Optional[bool] = False,
|
output_attentions: Optional[bool] = False,
|
||||||
**kwargs,
|
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
Args:
|
Args:
|
||||||
@ -810,22 +746,6 @@ class DetrDecoderLayer(nn.Module):
|
|||||||
Whether or not to return the attentions tensors of all attention layers. See `attentions` under
|
Whether or not to return the attentions tensors of all attention layers. See `attentions` under
|
||||||
returned tensors for more detail.
|
returned tensors for more detail.
|
||||||
"""
|
"""
|
||||||
position_embeddings = kwargs.pop("position_embeddings", None)
|
|
||||||
|
|
||||||
if kwargs:
|
|
||||||
raise ValueError(f"Unexpected arguments {kwargs.keys()}")
|
|
||||||
|
|
||||||
if position_embeddings is not None and object_queries is not None:
|
|
||||||
raise ValueError(
|
|
||||||
"Cannot specify both position_embeddings and object_queries. Please use just object_queries"
|
|
||||||
)
|
|
||||||
|
|
||||||
if position_embeddings is not None:
|
|
||||||
logger.warning_once(
|
|
||||||
"position_embeddings has been deprecated and will be removed in v4.34. Please use object_queries instead"
|
|
||||||
)
|
|
||||||
object_queries = position_embeddings
|
|
||||||
|
|
||||||
residual = hidden_states
|
residual = hidden_states
|
||||||
|
|
||||||
# Self Attention
|
# Self Attention
|
||||||
@ -995,7 +915,6 @@ class DetrEncoder(DetrPreTrainedModel):
|
|||||||
output_attentions=None,
|
output_attentions=None,
|
||||||
output_hidden_states=None,
|
output_hidden_states=None,
|
||||||
return_dict=None,
|
return_dict=None,
|
||||||
**kwargs,
|
|
||||||
):
|
):
|
||||||
r"""
|
r"""
|
||||||
Args:
|
Args:
|
||||||
@ -1022,22 +941,6 @@ class DetrEncoder(DetrPreTrainedModel):
|
|||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
position_embeddings = kwargs.pop("position_embeddings", None)
|
|
||||||
|
|
||||||
if kwargs:
|
|
||||||
raise ValueError(f"Unexpected arguments {kwargs.keys()}")
|
|
||||||
|
|
||||||
if position_embeddings is not None and object_queries is not None:
|
|
||||||
raise ValueError(
|
|
||||||
"Cannot specify both position_embeddings and object_queries. Please use just object_queries"
|
|
||||||
)
|
|
||||||
|
|
||||||
if position_embeddings is not None:
|
|
||||||
logger.warning_once(
|
|
||||||
"position_embeddings has been deprecated and will be removed in v4.34. Please use object_queries instead"
|
|
||||||
)
|
|
||||||
object_queries = position_embeddings
|
|
||||||
|
|
||||||
output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
|
output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
|
||||||
output_hidden_states = (
|
output_hidden_states = (
|
||||||
output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
|
output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
|
||||||
@ -1129,7 +1032,6 @@ class DetrDecoder(DetrPreTrainedModel):
|
|||||||
output_attentions=None,
|
output_attentions=None,
|
||||||
output_hidden_states=None,
|
output_hidden_states=None,
|
||||||
return_dict=None,
|
return_dict=None,
|
||||||
**kwargs,
|
|
||||||
):
|
):
|
||||||
r"""
|
r"""
|
||||||
Args:
|
Args:
|
||||||
@ -1167,22 +1069,6 @@ class DetrDecoder(DetrPreTrainedModel):
|
|||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
position_embeddings = kwargs.pop("position_embeddings", None)
|
|
||||||
|
|
||||||
if kwargs:
|
|
||||||
raise ValueError(f"Unexpected arguments {kwargs.keys()}")
|
|
||||||
|
|
||||||
if position_embeddings is not None and object_queries is not None:
|
|
||||||
raise ValueError(
|
|
||||||
"Cannot specify both position_embeddings and object_queries. Please use just object_queries"
|
|
||||||
)
|
|
||||||
|
|
||||||
if position_embeddings is not None:
|
|
||||||
logger.warning_once(
|
|
||||||
"position_embeddings has been deprecated and will be removed in v4.34. Please use object_queries instead"
|
|
||||||
)
|
|
||||||
object_queries = position_embeddings
|
|
||||||
|
|
||||||
output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
|
output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
|
||||||
output_hidden_states = (
|
output_hidden_states = (
|
||||||
output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
|
output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
"""PyTorch Falcon model."""
|
"""PyTorch Falcon model."""
|
||||||
|
|
||||||
import math
|
import math
|
||||||
import warnings
|
|
||||||
from typing import TYPE_CHECKING, Optional, Tuple, Union
|
from typing import TYPE_CHECKING, Optional, Tuple, Union
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
@ -393,13 +392,7 @@ class FalconAttention(nn.Module):
|
|||||||
head_mask: Optional[torch.Tensor] = None,
|
head_mask: Optional[torch.Tensor] = None,
|
||||||
use_cache: bool = False,
|
use_cache: bool = False,
|
||||||
output_attentions: bool = False,
|
output_attentions: bool = False,
|
||||||
**kwargs,
|
|
||||||
):
|
):
|
||||||
if "padding_mask" in kwargs:
|
|
||||||
warnings.warn(
|
|
||||||
"Passing `padding_mask` is deprecated and will be removed in v4.37. Please make sure use `attention_mask` instead.`"
|
|
||||||
)
|
|
||||||
|
|
||||||
fused_qkv = self.query_key_value(hidden_states) # [batch_size, seq_length, 3 x hidden_size]
|
fused_qkv = self.query_key_value(hidden_states) # [batch_size, seq_length, 3 x hidden_size]
|
||||||
num_kv_heads = self.num_heads if self.new_decoder_architecture else self.num_kv_heads
|
num_kv_heads = self.num_heads if self.new_decoder_architecture else self.num_kv_heads
|
||||||
# 3 x [batch_size, seq_length, num_heads, head_dim]
|
# 3 x [batch_size, seq_length, num_heads, head_dim]
|
||||||
@ -549,16 +542,7 @@ class FalconFlashAttention2(FalconAttention):
|
|||||||
head_mask: Optional[torch.Tensor] = None,
|
head_mask: Optional[torch.Tensor] = None,
|
||||||
use_cache: bool = False,
|
use_cache: bool = False,
|
||||||
output_attentions: bool = False,
|
output_attentions: bool = False,
|
||||||
**kwargs,
|
|
||||||
):
|
):
|
||||||
if "padding_mask" in kwargs:
|
|
||||||
warnings.warn(
|
|
||||||
"Passing `padding_mask` is deprecated and will be removed in v4.37. Please make sure use `attention_mask` instead.`"
|
|
||||||
)
|
|
||||||
|
|
||||||
# overwrite attention_mask with padding_mask
|
|
||||||
attention_mask = kwargs.pop("padding_mask")
|
|
||||||
|
|
||||||
fused_qkv = self.query_key_value(hidden_states) # [batch_size, seq_length, 3 x hidden_size]
|
fused_qkv = self.query_key_value(hidden_states) # [batch_size, seq_length, 3 x hidden_size]
|
||||||
num_kv_heads = self.num_heads if self.new_decoder_architecture else self.num_kv_heads
|
num_kv_heads = self.num_heads if self.new_decoder_architecture else self.num_kv_heads
|
||||||
# 3 x [batch_size, seq_length, num_heads, head_dim]
|
# 3 x [batch_size, seq_length, num_heads, head_dim]
|
||||||
@ -792,13 +776,7 @@ class FalconDecoderLayer(nn.Module):
|
|||||||
head_mask: Optional[torch.Tensor] = None,
|
head_mask: Optional[torch.Tensor] = None,
|
||||||
use_cache: bool = False,
|
use_cache: bool = False,
|
||||||
output_attentions: bool = False,
|
output_attentions: bool = False,
|
||||||
**kwargs,
|
|
||||||
):
|
):
|
||||||
if "padding_mask" in kwargs:
|
|
||||||
warnings.warn(
|
|
||||||
"Passing `padding_mask` is deprecated and will be removed in v4.37. Please make sure use `attention_mask` instead.`"
|
|
||||||
)
|
|
||||||
|
|
||||||
residual = hidden_states
|
residual = hidden_states
|
||||||
|
|
||||||
if self.config.new_decoder_architecture and self.config.num_ln_in_parallel_attn == 2:
|
if self.config.new_decoder_architecture and self.config.num_ln_in_parallel_attn == 2:
|
||||||
@ -817,7 +795,6 @@ class FalconDecoderLayer(nn.Module):
|
|||||||
head_mask=head_mask,
|
head_mask=head_mask,
|
||||||
use_cache=use_cache,
|
use_cache=use_cache,
|
||||||
output_attentions=output_attentions,
|
output_attentions=output_attentions,
|
||||||
**kwargs,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
attention_output = attn_outputs[0]
|
attention_output = attn_outputs[0]
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
""" PyTorch Gemma model."""
|
""" PyTorch Gemma model."""
|
||||||
|
|
||||||
import math
|
import math
|
||||||
import warnings
|
|
||||||
from typing import List, Optional, Tuple, Union
|
from typing import List, Optional, Tuple, Union
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
@ -616,7 +615,6 @@ class GemmaDecoderLayer(nn.Module):
|
|||||||
output_attentions: Optional[bool] = False,
|
output_attentions: Optional[bool] = False,
|
||||||
use_cache: Optional[bool] = False,
|
use_cache: Optional[bool] = False,
|
||||||
cache_position: Optional[torch.LongTensor] = None,
|
cache_position: Optional[torch.LongTensor] = None,
|
||||||
**kwargs,
|
|
||||||
) -> Tuple[torch.FloatTensor, Optional[Tuple[torch.FloatTensor, torch.FloatTensor]]]:
|
) -> Tuple[torch.FloatTensor, Optional[Tuple[torch.FloatTensor, torch.FloatTensor]]]:
|
||||||
"""
|
"""
|
||||||
Args:
|
Args:
|
||||||
@ -632,11 +630,6 @@ class GemmaDecoderLayer(nn.Module):
|
|||||||
(see `past_key_values`).
|
(see `past_key_values`).
|
||||||
past_key_value (`Tuple(torch.FloatTensor)`, *optional*): cached past key and value projection states
|
past_key_value (`Tuple(torch.FloatTensor)`, *optional*): cached past key and value projection states
|
||||||
"""
|
"""
|
||||||
if "padding_mask" in kwargs:
|
|
||||||
warnings.warn(
|
|
||||||
"Passing `padding_mask` is deprecated and will be removed in v4.37. Please make sure use `attention_mask` instead.`"
|
|
||||||
)
|
|
||||||
|
|
||||||
residual = hidden_states
|
residual = hidden_states
|
||||||
|
|
||||||
hidden_states = self.input_layernorm(hidden_states)
|
hidden_states = self.input_layernorm(hidden_states)
|
||||||
@ -650,7 +643,6 @@ class GemmaDecoderLayer(nn.Module):
|
|||||||
output_attentions=output_attentions,
|
output_attentions=output_attentions,
|
||||||
use_cache=use_cache,
|
use_cache=use_cache,
|
||||||
cache_position=cache_position,
|
cache_position=cache_position,
|
||||||
**kwargs,
|
|
||||||
)
|
)
|
||||||
hidden_states = residual + hidden_states
|
hidden_states = residual + hidden_states
|
||||||
|
|
||||||
|
@ -920,31 +920,6 @@ class GroundingDinoImageProcessor(BaseImageProcessor):
|
|||||||
raise ValueError(f"Format {format} is not supported.")
|
raise ValueError(f"Format {format} is not supported.")
|
||||||
return target
|
return target
|
||||||
|
|
||||||
# Copied from transformers.models.detr.image_processing_detr.DetrImageProcessor.prepare
|
|
||||||
def prepare(self, image, target, return_segmentation_masks=None, masks_path=None):
|
|
||||||
logger.warning_once(
|
|
||||||
"The `prepare` method is deprecated and will be removed in a v4.33. "
|
|
||||||
"Please use `prepare_annotation` instead. Note: the `prepare_annotation` method "
|
|
||||||
"does not return the image anymore.",
|
|
||||||
)
|
|
||||||
target = self.prepare_annotation(image, target, return_segmentation_masks, masks_path, self.format)
|
|
||||||
return image, target
|
|
||||||
|
|
||||||
# Copied from transformers.models.detr.image_processing_detr.DetrImageProcessor.convert_coco_poly_to_mask
|
|
||||||
def convert_coco_poly_to_mask(self, *args, **kwargs):
|
|
||||||
logger.warning_once("The `convert_coco_poly_to_mask` method is deprecated and will be removed in v4.33. ")
|
|
||||||
return convert_coco_poly_to_mask(*args, **kwargs)
|
|
||||||
|
|
||||||
# Copied from transformers.models.detr.image_processing_detr.DetrImageProcessor.prepare_coco_detection
|
|
||||||
def prepare_coco_detection(self, *args, **kwargs):
|
|
||||||
logger.warning_once("The `prepare_coco_detection` method is deprecated and will be removed in v4.33. ")
|
|
||||||
return prepare_coco_detection_annotation(*args, **kwargs)
|
|
||||||
|
|
||||||
# Copied from transformers.models.detr.image_processing_detr.DetrImageProcessor.prepare_coco_panoptic
|
|
||||||
def prepare_coco_panoptic(self, *args, **kwargs):
|
|
||||||
logger.warning_once("The `prepare_coco_panoptic` method is deprecated and will be removed in v4.33. ")
|
|
||||||
return prepare_coco_panoptic_annotation(*args, **kwargs)
|
|
||||||
|
|
||||||
# Copied from transformers.models.detr.image_processing_detr.DetrImageProcessor.resize
|
# Copied from transformers.models.detr.image_processing_detr.DetrImageProcessor.resize
|
||||||
def resize(
|
def resize(
|
||||||
self,
|
self,
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
"""PyTorch LLaMA model."""
|
"""PyTorch LLaMA model."""
|
||||||
|
|
||||||
import math
|
import math
|
||||||
import warnings
|
|
||||||
from typing import List, Optional, Tuple, Union
|
from typing import List, Optional, Tuple, Union
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
@ -104,29 +103,6 @@ class LlamaRotaryEmbedding(nn.Module):
|
|||||||
self.register_buffer("inv_freq", inv_freq, persistent=False)
|
self.register_buffer("inv_freq", inv_freq, persistent=False)
|
||||||
# For BC we register cos and sin cached
|
# For BC we register cos and sin cached
|
||||||
self.max_seq_len_cached = max_position_embeddings
|
self.max_seq_len_cached = max_position_embeddings
|
||||||
t = torch.arange(self.max_seq_len_cached, device=device, dtype=torch.int64).type_as(self.inv_freq)
|
|
||||||
t = t / self.scaling_factor
|
|
||||||
freqs = torch.outer(t, self.inv_freq)
|
|
||||||
# Different from paper, but it uses a different permutation in order to obtain the same calculation
|
|
||||||
emb = torch.cat((freqs, freqs), dim=-1)
|
|
||||||
self.register_buffer("_cos_cached", emb.cos().to(torch.get_default_dtype()), persistent=False)
|
|
||||||
self.register_buffer("_sin_cached", emb.sin().to(torch.get_default_dtype()), persistent=False)
|
|
||||||
|
|
||||||
@property
|
|
||||||
def sin_cached(self):
|
|
||||||
logger.warning_once(
|
|
||||||
"The sin_cached attribute will be removed in 4.39. Bear in mind that its contents changed in v4.38. Use "
|
|
||||||
"the forward method of RoPE from now on instead. It is not used in the `LlamaAttention` class"
|
|
||||||
)
|
|
||||||
return self._sin_cached
|
|
||||||
|
|
||||||
@property
|
|
||||||
def cos_cached(self):
|
|
||||||
logger.warning_once(
|
|
||||||
"The cos_cached attribute will be removed in 4.39. Bear in mind that its contents changed in v4.38. Use "
|
|
||||||
"the forward method of RoPE from now on instead. It is not used in the `LlamaAttention` class"
|
|
||||||
)
|
|
||||||
return self._cos_cached
|
|
||||||
|
|
||||||
@torch.no_grad()
|
@torch.no_grad()
|
||||||
def forward(self, x, position_ids):
|
def forward(self, x, position_ids):
|
||||||
@ -714,7 +690,6 @@ class LlamaDecoderLayer(nn.Module):
|
|||||||
output_attentions: Optional[bool] = False,
|
output_attentions: Optional[bool] = False,
|
||||||
use_cache: Optional[bool] = False,
|
use_cache: Optional[bool] = False,
|
||||||
cache_position: Optional[torch.LongTensor] = None,
|
cache_position: Optional[torch.LongTensor] = None,
|
||||||
**kwargs,
|
|
||||||
) -> Tuple[torch.FloatTensor, Optional[Tuple[torch.FloatTensor, torch.FloatTensor]]]:
|
) -> Tuple[torch.FloatTensor, Optional[Tuple[torch.FloatTensor, torch.FloatTensor]]]:
|
||||||
"""
|
"""
|
||||||
Args:
|
Args:
|
||||||
@ -730,11 +705,6 @@ class LlamaDecoderLayer(nn.Module):
|
|||||||
(see `past_key_values`).
|
(see `past_key_values`).
|
||||||
past_key_value (`Tuple(torch.FloatTensor)`, *optional*): cached past key and value projection states
|
past_key_value (`Tuple(torch.FloatTensor)`, *optional*): cached past key and value projection states
|
||||||
"""
|
"""
|
||||||
if "padding_mask" in kwargs:
|
|
||||||
warnings.warn(
|
|
||||||
"Passing `padding_mask` is deprecated and will be removed in v4.37. Please make sure use `attention_mask` instead.`"
|
|
||||||
)
|
|
||||||
|
|
||||||
residual = hidden_states
|
residual = hidden_states
|
||||||
|
|
||||||
hidden_states = self.input_layernorm(hidden_states)
|
hidden_states = self.input_layernorm(hidden_states)
|
||||||
@ -748,7 +718,6 @@ class LlamaDecoderLayer(nn.Module):
|
|||||||
output_attentions=output_attentions,
|
output_attentions=output_attentions,
|
||||||
use_cache=use_cache,
|
use_cache=use_cache,
|
||||||
cache_position=cache_position,
|
cache_position=cache_position,
|
||||||
**kwargs,
|
|
||||||
)
|
)
|
||||||
hidden_states = residual + hidden_states
|
hidden_states = residual + hidden_states
|
||||||
|
|
||||||
|
@ -440,23 +440,7 @@ class DetrAttention(nn.Module):
|
|||||||
def _shape(self, tensor: torch.Tensor, seq_len: int, batch_size: int):
|
def _shape(self, tensor: torch.Tensor, seq_len: int, batch_size: int):
|
||||||
return tensor.view(batch_size, seq_len, self.num_heads, self.head_dim).transpose(1, 2).contiguous()
|
return tensor.view(batch_size, seq_len, self.num_heads, self.head_dim).transpose(1, 2).contiguous()
|
||||||
|
|
||||||
def with_pos_embed(self, tensor: torch.Tensor, object_queries: Optional[Tensor], **kwargs):
|
def with_pos_embed(self, tensor: torch.Tensor, object_queries: Optional[Tensor]):
|
||||||
position_embeddings = kwargs.pop("position_embeddings", None)
|
|
||||||
|
|
||||||
if kwargs:
|
|
||||||
raise ValueError(f"Unexpected arguments {kwargs.keys()}")
|
|
||||||
|
|
||||||
if position_embeddings is not None and object_queries is not None:
|
|
||||||
raise ValueError(
|
|
||||||
"Cannot specify both position_embeddings and object_queries. Please use just object_queries"
|
|
||||||
)
|
|
||||||
|
|
||||||
if position_embeddings is not None:
|
|
||||||
logger.warning_once(
|
|
||||||
"position_embeddings has been deprecated and will be removed in v4.34. Please use object_queries instead"
|
|
||||||
)
|
|
||||||
object_queries = position_embeddings
|
|
||||||
|
|
||||||
return tensor if object_queries is None else tensor + object_queries
|
return tensor if object_queries is None else tensor + object_queries
|
||||||
|
|
||||||
def forward(
|
def forward(
|
||||||
@ -467,38 +451,8 @@ class DetrAttention(nn.Module):
|
|||||||
key_value_states: Optional[torch.Tensor] = None,
|
key_value_states: Optional[torch.Tensor] = None,
|
||||||
spatial_position_embeddings: Optional[torch.Tensor] = None,
|
spatial_position_embeddings: Optional[torch.Tensor] = None,
|
||||||
output_attentions: bool = False,
|
output_attentions: bool = False,
|
||||||
**kwargs,
|
|
||||||
) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]:
|
) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]:
|
||||||
"""Input shape: Batch x Time x Channel"""
|
"""Input shape: Batch x Time x Channel"""
|
||||||
|
|
||||||
position_embeddings = kwargs.pop("position_ebmeddings", None)
|
|
||||||
key_value_position_embeddings = kwargs.pop("key_value_position_embeddings", None)
|
|
||||||
|
|
||||||
if kwargs:
|
|
||||||
raise ValueError(f"Unexpected arguments {kwargs.keys()}")
|
|
||||||
|
|
||||||
if position_embeddings is not None and object_queries is not None:
|
|
||||||
raise ValueError(
|
|
||||||
"Cannot specify both position_embeddings and object_queries. Please use just object_queries"
|
|
||||||
)
|
|
||||||
|
|
||||||
if key_value_position_embeddings is not None and spatial_position_embeddings is not None:
|
|
||||||
raise ValueError(
|
|
||||||
"Cannot specify both key_value_position_embeddings and spatial_position_embeddings. Please use just spatial_position_embeddings"
|
|
||||||
)
|
|
||||||
|
|
||||||
if position_embeddings is not None:
|
|
||||||
logger.warning_once(
|
|
||||||
"position_embeddings has been deprecated and will be removed in v4.34. Please use object_queries instead"
|
|
||||||
)
|
|
||||||
object_queries = position_embeddings
|
|
||||||
|
|
||||||
if key_value_position_embeddings is not None:
|
|
||||||
logger.warning_once(
|
|
||||||
"key_value_position_embeddings has been deprecated and will be removed in v4.34. Please use spatial_position_embeddings instead"
|
|
||||||
)
|
|
||||||
spatial_position_embeddings = key_value_position_embeddings
|
|
||||||
|
|
||||||
# if key_value_states are provided this layer is used as a cross-attention layer
|
# if key_value_states are provided this layer is used as a cross-attention layer
|
||||||
# for the decoder
|
# for the decoder
|
||||||
is_cross_attention = key_value_states is not None
|
is_cross_attention = key_value_states is not None
|
||||||
@ -616,7 +570,6 @@ class DetrDecoderLayer(nn.Module):
|
|||||||
encoder_hidden_states: Optional[torch.Tensor] = None,
|
encoder_hidden_states: Optional[torch.Tensor] = None,
|
||||||
encoder_attention_mask: Optional[torch.Tensor] = None,
|
encoder_attention_mask: Optional[torch.Tensor] = None,
|
||||||
output_attentions: Optional[bool] = False,
|
output_attentions: Optional[bool] = False,
|
||||||
**kwargs,
|
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
Args:
|
Args:
|
||||||
@ -639,22 +592,6 @@ class DetrDecoderLayer(nn.Module):
|
|||||||
Whether or not to return the attentions tensors of all attention layers. See `attentions` under
|
Whether or not to return the attentions tensors of all attention layers. See `attentions` under
|
||||||
returned tensors for more detail.
|
returned tensors for more detail.
|
||||||
"""
|
"""
|
||||||
position_embeddings = kwargs.pop("position_embeddings", None)
|
|
||||||
|
|
||||||
if kwargs:
|
|
||||||
raise ValueError(f"Unexpected arguments {kwargs.keys()}")
|
|
||||||
|
|
||||||
if position_embeddings is not None and object_queries is not None:
|
|
||||||
raise ValueError(
|
|
||||||
"Cannot specify both position_embeddings and object_queries. Please use just object_queries"
|
|
||||||
)
|
|
||||||
|
|
||||||
if position_embeddings is not None:
|
|
||||||
logger.warning_once(
|
|
||||||
"position_embeddings has been deprecated and will be removed in v4.34. Please use object_queries instead"
|
|
||||||
)
|
|
||||||
object_queries = position_embeddings
|
|
||||||
|
|
||||||
residual = hidden_states
|
residual = hidden_states
|
||||||
|
|
||||||
# Self Attention
|
# Self Attention
|
||||||
@ -742,7 +679,6 @@ class DetrDecoder(nn.Module):
|
|||||||
output_attentions=None,
|
output_attentions=None,
|
||||||
output_hidden_states=None,
|
output_hidden_states=None,
|
||||||
return_dict=None,
|
return_dict=None,
|
||||||
**kwargs,
|
|
||||||
):
|
):
|
||||||
r"""
|
r"""
|
||||||
Args:
|
Args:
|
||||||
@ -779,21 +715,6 @@ class DetrDecoder(nn.Module):
|
|||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
position_embeddings = kwargs.pop("position_embeddings", None)
|
|
||||||
if kwargs:
|
|
||||||
raise ValueError(f"Unexpected arguments {kwargs.keys()}")
|
|
||||||
|
|
||||||
if position_embeddings is not None and object_queries is not None:
|
|
||||||
raise ValueError(
|
|
||||||
"Cannot specify both position_embeddings and object_queries. Please use just object_queries"
|
|
||||||
)
|
|
||||||
|
|
||||||
if position_embeddings is not None:
|
|
||||||
logger.warning_once(
|
|
||||||
"position_embeddings has been deprecated and will be removed in v4.34. Please use object_queries instead"
|
|
||||||
)
|
|
||||||
object_queries = position_embeddings
|
|
||||||
|
|
||||||
output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
|
output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
|
||||||
output_hidden_states = (
|
output_hidden_states = (
|
||||||
output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
|
output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
""" PyTorch Mistral model."""
|
""" PyTorch Mistral model."""
|
||||||
import inspect
|
import inspect
|
||||||
import math
|
import math
|
||||||
import warnings
|
|
||||||
from typing import List, Optional, Tuple, Union
|
from typing import List, Optional, Tuple, Union
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
@ -246,12 +245,7 @@ class MistralAttention(nn.Module):
|
|||||||
past_key_value: Optional[Cache] = None,
|
past_key_value: Optional[Cache] = None,
|
||||||
output_attentions: bool = False,
|
output_attentions: bool = False,
|
||||||
use_cache: bool = False,
|
use_cache: bool = False,
|
||||||
**kwargs,
|
|
||||||
) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]:
|
) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]:
|
||||||
if "padding_mask" in kwargs:
|
|
||||||
warnings.warn(
|
|
||||||
"Passing `padding_mask` is deprecated and will be removed in v4.37. Please make sure use `attention_mask` instead.`"
|
|
||||||
)
|
|
||||||
bsz, q_len, _ = hidden_states.size()
|
bsz, q_len, _ = hidden_states.size()
|
||||||
|
|
||||||
query_states = self.q_proj(hidden_states)
|
query_states = self.q_proj(hidden_states)
|
||||||
@ -344,15 +338,7 @@ class MistralFlashAttention2(MistralAttention):
|
|||||||
past_key_value: Optional[Cache] = None,
|
past_key_value: Optional[Cache] = None,
|
||||||
output_attentions: bool = False,
|
output_attentions: bool = False,
|
||||||
use_cache: bool = False,
|
use_cache: bool = False,
|
||||||
**kwargs,
|
|
||||||
):
|
):
|
||||||
if "padding_mask" in kwargs:
|
|
||||||
warnings.warn(
|
|
||||||
"Passing `padding_mask` is deprecated and will be removed in v4.37. Please make sure use `attention_mask` instead.`"
|
|
||||||
)
|
|
||||||
|
|
||||||
# overwrite attention_mask with padding_mask
|
|
||||||
attention_mask = kwargs.pop("padding_mask")
|
|
||||||
bsz, q_len, _ = hidden_states.size()
|
bsz, q_len, _ = hidden_states.size()
|
||||||
|
|
||||||
query_states = self.q_proj(hidden_states)
|
query_states = self.q_proj(hidden_states)
|
||||||
@ -729,12 +715,7 @@ class MistralDecoderLayer(nn.Module):
|
|||||||
past_key_value: Optional[Tuple[torch.Tensor]] = None,
|
past_key_value: Optional[Tuple[torch.Tensor]] = None,
|
||||||
output_attentions: Optional[bool] = False,
|
output_attentions: Optional[bool] = False,
|
||||||
use_cache: Optional[bool] = False,
|
use_cache: Optional[bool] = False,
|
||||||
**kwargs,
|
|
||||||
) -> Tuple[torch.FloatTensor, Optional[Tuple[torch.FloatTensor, torch.FloatTensor]]]:
|
) -> Tuple[torch.FloatTensor, Optional[Tuple[torch.FloatTensor, torch.FloatTensor]]]:
|
||||||
if "padding_mask" in kwargs:
|
|
||||||
warnings.warn(
|
|
||||||
"Passing `padding_mask` is deprecated and will be removed in v4.37. Please make sure use `attention_mask` instead.`"
|
|
||||||
)
|
|
||||||
"""
|
"""
|
||||||
Args:
|
Args:
|
||||||
hidden_states (`torch.FloatTensor`): input to the layer of shape `(batch, seq_len, embed_dim)`
|
hidden_states (`torch.FloatTensor`): input to the layer of shape `(batch, seq_len, embed_dim)`
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
""" PyTorch Mixtral model."""
|
""" PyTorch Mixtral model."""
|
||||||
import inspect
|
import inspect
|
||||||
import math
|
import math
|
||||||
import warnings
|
|
||||||
from typing import List, Optional, Tuple, Union
|
from typing import List, Optional, Tuple, Union
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
@ -323,12 +322,7 @@ class MixtralAttention(nn.Module):
|
|||||||
past_key_value: Optional[Cache] = None,
|
past_key_value: Optional[Cache] = None,
|
||||||
output_attentions: bool = False,
|
output_attentions: bool = False,
|
||||||
use_cache: bool = False,
|
use_cache: bool = False,
|
||||||
**kwargs,
|
|
||||||
) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]:
|
) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]:
|
||||||
if "padding_mask" in kwargs:
|
|
||||||
warnings.warn(
|
|
||||||
"Passing `padding_mask` is deprecated and will be removed in v4.37. Please make sure use `attention_mask` instead.`"
|
|
||||||
)
|
|
||||||
bsz, q_len, _ = hidden_states.size()
|
bsz, q_len, _ = hidden_states.size()
|
||||||
|
|
||||||
query_states = self.q_proj(hidden_states)
|
query_states = self.q_proj(hidden_states)
|
||||||
@ -422,15 +416,7 @@ class MixtralFlashAttention2(MixtralAttention):
|
|||||||
past_key_value: Optional[Cache] = None,
|
past_key_value: Optional[Cache] = None,
|
||||||
output_attentions: bool = False,
|
output_attentions: bool = False,
|
||||||
use_cache: bool = False,
|
use_cache: bool = False,
|
||||||
**kwargs,
|
|
||||||
):
|
):
|
||||||
if "padding_mask" in kwargs:
|
|
||||||
warnings.warn(
|
|
||||||
"Passing `padding_mask` is deprecated and will be removed in v4.37. Please make sure use `attention_mask` instead.`"
|
|
||||||
)
|
|
||||||
|
|
||||||
# overwrite attention_mask with padding_mask
|
|
||||||
attention_mask = kwargs.pop("padding_mask")
|
|
||||||
bsz, q_len, _ = hidden_states.size()
|
bsz, q_len, _ = hidden_states.size()
|
||||||
|
|
||||||
query_states = self.q_proj(hidden_states)
|
query_states = self.q_proj(hidden_states)
|
||||||
@ -805,14 +791,6 @@ class MixtralBlockSparseTop2MLP(nn.Module):
|
|||||||
return current_hidden_states
|
return current_hidden_states
|
||||||
|
|
||||||
|
|
||||||
class MixtralBLockSparseTop2MLP(MixtralBlockSparseTop2MLP):
|
|
||||||
def __init__(self, *args, **kwargs):
|
|
||||||
logger.warning_once(
|
|
||||||
"MixtralBLockSparseTop2MLP is deprecated by MixtralBlockSparseTop2MLP and will be removed in v4.40."
|
|
||||||
)
|
|
||||||
super().__init__(*args, **kwargs)
|
|
||||||
|
|
||||||
|
|
||||||
class MixtralSparseMoeBlock(nn.Module):
|
class MixtralSparseMoeBlock(nn.Module):
|
||||||
"""
|
"""
|
||||||
This implementation is
|
This implementation is
|
||||||
@ -901,12 +879,7 @@ class MixtralDecoderLayer(nn.Module):
|
|||||||
output_attentions: Optional[bool] = False,
|
output_attentions: Optional[bool] = False,
|
||||||
output_router_logits: Optional[bool] = False,
|
output_router_logits: Optional[bool] = False,
|
||||||
use_cache: Optional[bool] = False,
|
use_cache: Optional[bool] = False,
|
||||||
**kwargs,
|
|
||||||
) -> Tuple[torch.FloatTensor, Optional[Tuple[torch.FloatTensor, torch.FloatTensor]]]:
|
) -> Tuple[torch.FloatTensor, Optional[Tuple[torch.FloatTensor, torch.FloatTensor]]]:
|
||||||
if "padding_mask" in kwargs:
|
|
||||||
warnings.warn(
|
|
||||||
"Passing `padding_mask` is deprecated and will be removed in v4.37. Please make sure use `attention_mask` instead.`"
|
|
||||||
)
|
|
||||||
"""
|
"""
|
||||||
Args:
|
Args:
|
||||||
hidden_states (`torch.FloatTensor`): input to the layer of shape `(batch, seq_len, embed_dim)`
|
hidden_states (`torch.FloatTensor`): input to the layer of shape `(batch, seq_len, embed_dim)`
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
"""PyTorch OLMo model."""
|
"""PyTorch OLMo model."""
|
||||||
|
|
||||||
import math
|
import math
|
||||||
import warnings
|
|
||||||
from typing import List, Optional, Tuple, Union
|
from typing import List, Optional, Tuple, Union
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
@ -101,29 +100,6 @@ class OlmoRotaryEmbedding(nn.Module):
|
|||||||
self.register_buffer("inv_freq", inv_freq, persistent=False)
|
self.register_buffer("inv_freq", inv_freq, persistent=False)
|
||||||
# For BC we register cos and sin cached
|
# For BC we register cos and sin cached
|
||||||
self.max_seq_len_cached = max_position_embeddings
|
self.max_seq_len_cached = max_position_embeddings
|
||||||
t = torch.arange(self.max_seq_len_cached, device=device, dtype=torch.int64).type_as(self.inv_freq)
|
|
||||||
t = t / self.scaling_factor
|
|
||||||
freqs = torch.outer(t, self.inv_freq)
|
|
||||||
# Different from paper, but it uses a different permutation in order to obtain the same calculation
|
|
||||||
emb = torch.cat((freqs, freqs), dim=-1)
|
|
||||||
self.register_buffer("_cos_cached", emb.cos().to(torch.get_default_dtype()), persistent=False)
|
|
||||||
self.register_buffer("_sin_cached", emb.sin().to(torch.get_default_dtype()), persistent=False)
|
|
||||||
|
|
||||||
@property
|
|
||||||
def sin_cached(self):
|
|
||||||
logger.warning_once(
|
|
||||||
"The sin_cached attribute will be removed in 4.39. Bear in mind that its contents changed in v4.38. Use "
|
|
||||||
"the forward method of RoPE from now on instead. It is not used in the `OlmoAttention` class"
|
|
||||||
)
|
|
||||||
return self._sin_cached
|
|
||||||
|
|
||||||
@property
|
|
||||||
def cos_cached(self):
|
|
||||||
logger.warning_once(
|
|
||||||
"The cos_cached attribute will be removed in 4.39. Bear in mind that its contents changed in v4.38. Use "
|
|
||||||
"the forward method of RoPE from now on instead. It is not used in the `OlmoAttention` class"
|
|
||||||
)
|
|
||||||
return self._cos_cached
|
|
||||||
|
|
||||||
@torch.no_grad()
|
@torch.no_grad()
|
||||||
def forward(self, x, position_ids):
|
def forward(self, x, position_ids):
|
||||||
@ -690,7 +666,6 @@ class OlmoDecoderLayer(nn.Module):
|
|||||||
output_attentions: Optional[bool] = False,
|
output_attentions: Optional[bool] = False,
|
||||||
use_cache: Optional[bool] = False,
|
use_cache: Optional[bool] = False,
|
||||||
cache_position: Optional[torch.LongTensor] = None,
|
cache_position: Optional[torch.LongTensor] = None,
|
||||||
**kwargs,
|
|
||||||
) -> Tuple[torch.FloatTensor, Optional[Tuple[torch.FloatTensor, torch.FloatTensor]]]:
|
) -> Tuple[torch.FloatTensor, Optional[Tuple[torch.FloatTensor, torch.FloatTensor]]]:
|
||||||
"""
|
"""
|
||||||
Args:
|
Args:
|
||||||
@ -706,11 +681,6 @@ class OlmoDecoderLayer(nn.Module):
|
|||||||
(see `past_key_values`).
|
(see `past_key_values`).
|
||||||
past_key_value (`Tuple(torch.FloatTensor)`, *optional*): cached past key and value projection states
|
past_key_value (`Tuple(torch.FloatTensor)`, *optional*): cached past key and value projection states
|
||||||
"""
|
"""
|
||||||
if "padding_mask" in kwargs:
|
|
||||||
warnings.warn(
|
|
||||||
"Passing `padding_mask` is deprecated and will be removed in v4.37. Please make sure use `attention_mask` instead.`"
|
|
||||||
)
|
|
||||||
|
|
||||||
residual = hidden_states
|
residual = hidden_states
|
||||||
|
|
||||||
hidden_states = self.input_layernorm(hidden_states)
|
hidden_states = self.input_layernorm(hidden_states)
|
||||||
@ -724,7 +694,6 @@ class OlmoDecoderLayer(nn.Module):
|
|||||||
output_attentions=output_attentions,
|
output_attentions=output_attentions,
|
||||||
use_cache=use_cache,
|
use_cache=use_cache,
|
||||||
cache_position=cache_position,
|
cache_position=cache_position,
|
||||||
**kwargs,
|
|
||||||
)
|
)
|
||||||
hidden_states = residual + hidden_states
|
hidden_states = residual + hidden_states
|
||||||
|
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
""" PyTorch OWLv2 model."""
|
""" PyTorch OWLv2 model."""
|
||||||
|
|
||||||
import warnings
|
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from functools import lru_cache
|
from functools import lru_cache
|
||||||
from typing import Any, Dict, Optional, Tuple, Union
|
from typing import Any, Dict, Optional, Tuple, Union
|
||||||
@ -1197,16 +1196,7 @@ class Owlv2Model(Owlv2PreTrainedModel):
|
|||||||
if return_loss:
|
if return_loss:
|
||||||
loss = owlv2_loss(logits_per_text)
|
loss = owlv2_loss(logits_per_text)
|
||||||
|
|
||||||
if return_base_image_embeds:
|
text_embeds = text_embeds_norm
|
||||||
warnings.warn(
|
|
||||||
"`return_base_image_embeds` is deprecated and will be removed in v4.27 of Transformers, one can"
|
|
||||||
" obtain the base (unprojected) image embeddings from outputs.vision_model_output.",
|
|
||||||
FutureWarning,
|
|
||||||
)
|
|
||||||
last_hidden_state = vision_outputs[0]
|
|
||||||
image_embeds = self.vision_model.post_layernorm(last_hidden_state)
|
|
||||||
else:
|
|
||||||
text_embeds = text_embeds_norm
|
|
||||||
|
|
||||||
if not return_dict:
|
if not return_dict:
|
||||||
output = (logits_per_image, logits_per_text, text_embeds, image_embeds, text_outputs, vision_outputs)
|
output = (logits_per_image, logits_per_text, text_embeds, image_embeds, text_outputs, vision_outputs)
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
""" PyTorch OWL-ViT model."""
|
""" PyTorch OWL-ViT model."""
|
||||||
|
|
||||||
import warnings
|
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from functools import lru_cache
|
from functools import lru_cache
|
||||||
from typing import Any, Dict, Optional, Tuple, Union
|
from typing import Any, Dict, Optional, Tuple, Union
|
||||||
@ -1180,16 +1179,7 @@ class OwlViTModel(OwlViTPreTrainedModel):
|
|||||||
if return_loss:
|
if return_loss:
|
||||||
loss = owlvit_loss(logits_per_text)
|
loss = owlvit_loss(logits_per_text)
|
||||||
|
|
||||||
if return_base_image_embeds:
|
text_embeds = text_embeds_norm
|
||||||
warnings.warn(
|
|
||||||
"`return_base_image_embeds` is deprecated and will be removed in v4.27 of Transformers, one can"
|
|
||||||
" obtain the base (unprojected) image embeddings from outputs.vision_model_output.",
|
|
||||||
FutureWarning,
|
|
||||||
)
|
|
||||||
last_hidden_state = vision_outputs[0]
|
|
||||||
image_embeds = self.vision_model.post_layernorm(last_hidden_state)
|
|
||||||
else:
|
|
||||||
text_embeds = text_embeds_norm
|
|
||||||
|
|
||||||
if not return_dict:
|
if not return_dict:
|
||||||
output = (logits_per_image, logits_per_text, text_embeds, image_embeds, text_outputs, vision_outputs)
|
output = (logits_per_image, logits_per_text, text_embeds, image_embeds, text_outputs, vision_outputs)
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
|
|
||||||
import inspect
|
import inspect
|
||||||
import math
|
import math
|
||||||
import warnings
|
|
||||||
from typing import List, Optional, Tuple, Union
|
from typing import List, Optional, Tuple, Union
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
@ -430,7 +429,6 @@ class Phi3FlashAttention2(Phi3Attention):
|
|||||||
past_key_value: Optional[Cache] = None,
|
past_key_value: Optional[Cache] = None,
|
||||||
output_attentions: bool = False,
|
output_attentions: bool = False,
|
||||||
use_cache: bool = False,
|
use_cache: bool = False,
|
||||||
**kwargs,
|
|
||||||
) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]:
|
) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]:
|
||||||
# Phi3FlashAttention2 attention does not support output_attentions
|
# Phi3FlashAttention2 attention does not support output_attentions
|
||||||
|
|
||||||
@ -442,14 +440,6 @@ class Phi3FlashAttention2(Phi3Attention):
|
|||||||
|
|
||||||
output_attentions = False
|
output_attentions = False
|
||||||
|
|
||||||
if "padding_mask" in kwargs:
|
|
||||||
warnings.warn(
|
|
||||||
"Passing `padding_mask` is deprecated and will be removed in v4.37. Please make sure use `attention_mask` instead.`"
|
|
||||||
)
|
|
||||||
|
|
||||||
# overwrite attention_mask with padding_mask
|
|
||||||
attention_mask = kwargs.pop("padding_mask")
|
|
||||||
|
|
||||||
bsz, q_len, _ = hidden_states.size()
|
bsz, q_len, _ = hidden_states.size()
|
||||||
|
|
||||||
qkv = self.qkv_proj(hidden_states)
|
qkv = self.qkv_proj(hidden_states)
|
||||||
@ -835,12 +825,7 @@ class Phi3DecoderLayer(nn.Module):
|
|||||||
past_key_value: Optional[Tuple[torch.Tensor]] = None,
|
past_key_value: Optional[Tuple[torch.Tensor]] = None,
|
||||||
output_attentions: Optional[bool] = False,
|
output_attentions: Optional[bool] = False,
|
||||||
use_cache: Optional[bool] = False,
|
use_cache: Optional[bool] = False,
|
||||||
**kwargs,
|
|
||||||
) -> Tuple[torch.FloatTensor, Optional[Tuple[torch.FloatTensor, torch.FloatTensor]]]:
|
) -> Tuple[torch.FloatTensor, Optional[Tuple[torch.FloatTensor, torch.FloatTensor]]]:
|
||||||
if "padding_mask" in kwargs:
|
|
||||||
warnings.warn(
|
|
||||||
"Passing `padding_mask` is deprecated and will be removed in v4.37. Please make sure use `attention_mask` instead.`"
|
|
||||||
)
|
|
||||||
"""
|
"""
|
||||||
Args:
|
Args:
|
||||||
hidden_states (`torch.FloatTensor`):
|
hidden_states (`torch.FloatTensor`):
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
""" PyTorch Qwen2 model."""
|
""" PyTorch Qwen2 model."""
|
||||||
import inspect
|
import inspect
|
||||||
import math
|
import math
|
||||||
import warnings
|
|
||||||
from typing import List, Optional, Tuple, Union
|
from typing import List, Optional, Tuple, Union
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
@ -244,12 +243,7 @@ class Qwen2Attention(nn.Module):
|
|||||||
past_key_value: Optional[Cache] = None,
|
past_key_value: Optional[Cache] = None,
|
||||||
output_attentions: bool = False,
|
output_attentions: bool = False,
|
||||||
use_cache: bool = False,
|
use_cache: bool = False,
|
||||||
**kwargs,
|
|
||||||
) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]:
|
) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]:
|
||||||
if "padding_mask" in kwargs:
|
|
||||||
warnings.warn(
|
|
||||||
"Passing `padding_mask` is deprecated and will be removed in v4.37. Please make sure use `attention_mask` instead.`"
|
|
||||||
)
|
|
||||||
bsz, q_len, _ = hidden_states.size()
|
bsz, q_len, _ = hidden_states.size()
|
||||||
|
|
||||||
query_states = self.q_proj(hidden_states)
|
query_states = self.q_proj(hidden_states)
|
||||||
@ -344,15 +338,7 @@ class Qwen2FlashAttention2(Qwen2Attention):
|
|||||||
past_key_value: Optional[Cache] = None,
|
past_key_value: Optional[Cache] = None,
|
||||||
output_attentions: bool = False,
|
output_attentions: bool = False,
|
||||||
use_cache: bool = False,
|
use_cache: bool = False,
|
||||||
**kwargs,
|
|
||||||
):
|
):
|
||||||
if "padding_mask" in kwargs:
|
|
||||||
warnings.warn(
|
|
||||||
"Passing `padding_mask` is deprecated and will be removed in v4.37. Please make sure use `attention_mask` instead.`"
|
|
||||||
)
|
|
||||||
|
|
||||||
# overwrite attention_mask with padding_mask
|
|
||||||
attention_mask = kwargs.pop("padding_mask")
|
|
||||||
bsz, q_len, _ = hidden_states.size()
|
bsz, q_len, _ = hidden_states.size()
|
||||||
|
|
||||||
query_states = self.q_proj(hidden_states)
|
query_states = self.q_proj(hidden_states)
|
||||||
@ -739,13 +725,7 @@ class Qwen2DecoderLayer(nn.Module):
|
|||||||
past_key_value: Optional[Tuple[torch.Tensor]] = None,
|
past_key_value: Optional[Tuple[torch.Tensor]] = None,
|
||||||
output_attentions: Optional[bool] = False,
|
output_attentions: Optional[bool] = False,
|
||||||
use_cache: Optional[bool] = False,
|
use_cache: Optional[bool] = False,
|
||||||
**kwargs,
|
|
||||||
) -> Tuple[torch.FloatTensor, Optional[Tuple[torch.FloatTensor, torch.FloatTensor]]]:
|
) -> Tuple[torch.FloatTensor, Optional[Tuple[torch.FloatTensor, torch.FloatTensor]]]:
|
||||||
if "padding_mask" in kwargs:
|
|
||||||
warnings.warn(
|
|
||||||
"Passing `padding_mask` is deprecated and will be removed in v4.37. "
|
|
||||||
"Please make sure use `attention_mask` instead.`"
|
|
||||||
)
|
|
||||||
"""
|
"""
|
||||||
Args:
|
Args:
|
||||||
hidden_states (`torch.FloatTensor`): input to the layer of shape `(batch, seq_len, embed_dim)`
|
hidden_states (`torch.FloatTensor`): input to the layer of shape `(batch, seq_len, embed_dim)`
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
|
|
||||||
import inspect
|
import inspect
|
||||||
import math
|
import math
|
||||||
import warnings
|
|
||||||
from typing import List, Optional, Tuple, Union
|
from typing import List, Optional, Tuple, Union
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
@ -321,12 +320,7 @@ class Qwen2MoeAttention(nn.Module):
|
|||||||
past_key_value: Optional[Cache] = None,
|
past_key_value: Optional[Cache] = None,
|
||||||
output_attentions: bool = False,
|
output_attentions: bool = False,
|
||||||
use_cache: bool = False,
|
use_cache: bool = False,
|
||||||
**kwargs,
|
|
||||||
) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]:
|
) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]:
|
||||||
if "padding_mask" in kwargs:
|
|
||||||
warnings.warn(
|
|
||||||
"Passing `padding_mask` is deprecated and will be removed in v4.37. Please make sure use `attention_mask` instead.`"
|
|
||||||
)
|
|
||||||
bsz, q_len, _ = hidden_states.size()
|
bsz, q_len, _ = hidden_states.size()
|
||||||
|
|
||||||
query_states = self.q_proj(hidden_states)
|
query_states = self.q_proj(hidden_states)
|
||||||
@ -422,15 +416,7 @@ class Qwen2MoeFlashAttention2(Qwen2MoeAttention):
|
|||||||
past_key_value: Optional[Cache] = None,
|
past_key_value: Optional[Cache] = None,
|
||||||
output_attentions: bool = False,
|
output_attentions: bool = False,
|
||||||
use_cache: bool = False,
|
use_cache: bool = False,
|
||||||
**kwargs,
|
|
||||||
):
|
):
|
||||||
if "padding_mask" in kwargs:
|
|
||||||
warnings.warn(
|
|
||||||
"Passing `padding_mask` is deprecated and will be removed in v4.37. Please make sure use `attention_mask` instead.`"
|
|
||||||
)
|
|
||||||
|
|
||||||
# overwrite attention_mask with padding_mask
|
|
||||||
attention_mask = kwargs.pop("padding_mask")
|
|
||||||
bsz, q_len, _ = hidden_states.size()
|
bsz, q_len, _ = hidden_states.size()
|
||||||
|
|
||||||
query_states = self.q_proj(hidden_states)
|
query_states = self.q_proj(hidden_states)
|
||||||
@ -881,13 +867,7 @@ class Qwen2MoeDecoderLayer(nn.Module):
|
|||||||
output_attentions: Optional[bool] = False,
|
output_attentions: Optional[bool] = False,
|
||||||
output_router_logits: Optional[bool] = False,
|
output_router_logits: Optional[bool] = False,
|
||||||
use_cache: Optional[bool] = False,
|
use_cache: Optional[bool] = False,
|
||||||
**kwargs,
|
|
||||||
) -> Tuple[torch.FloatTensor, Optional[Tuple[torch.FloatTensor, torch.FloatTensor]]]:
|
) -> Tuple[torch.FloatTensor, Optional[Tuple[torch.FloatTensor, torch.FloatTensor]]]:
|
||||||
if "padding_mask" in kwargs:
|
|
||||||
warnings.warn(
|
|
||||||
"Passing `padding_mask` is deprecated and will be removed in v4.37. "
|
|
||||||
"Please make sure use `attention_mask` instead.`"
|
|
||||||
)
|
|
||||||
"""
|
"""
|
||||||
Args:
|
Args:
|
||||||
hidden_states (`torch.FloatTensor`): input to the layer of shape `(batch, seq_len, embed_dim)`
|
hidden_states (`torch.FloatTensor`): input to the layer of shape `(batch, seq_len, embed_dim)`
|
||||||
|
@ -279,11 +279,6 @@ class SEWDConfig(PretrainedConfig):
|
|||||||
def inputs_to_logits_ratio(self):
|
def inputs_to_logits_ratio(self):
|
||||||
return functools.reduce(operator.mul, self.conv_stride, 1)
|
return functools.reduce(operator.mul, self.conv_stride, 1)
|
||||||
|
|
||||||
@property
|
|
||||||
def hidden_dropout(self):
|
|
||||||
logger.warning_once("hidden_dropout is not used by the model and will be removed as config attribute in v4.35")
|
|
||||||
return self._hidden_dropout
|
|
||||||
|
|
||||||
def to_dict(self):
|
def to_dict(self):
|
||||||
"""
|
"""
|
||||||
Serializes this instance to a Python dictionary.
|
Serializes this instance to a Python dictionary.
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
""" PyTorch Starcoder2 model."""
|
""" PyTorch Starcoder2 model."""
|
||||||
import inspect
|
import inspect
|
||||||
import math
|
import math
|
||||||
import warnings
|
|
||||||
from typing import List, Optional, Tuple, Union
|
from typing import List, Optional, Tuple, Union
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
@ -227,12 +226,7 @@ class Starcoder2Attention(nn.Module):
|
|||||||
past_key_value: Optional[Cache] = None,
|
past_key_value: Optional[Cache] = None,
|
||||||
output_attentions: bool = False,
|
output_attentions: bool = False,
|
||||||
use_cache: bool = False,
|
use_cache: bool = False,
|
||||||
**kwargs,
|
|
||||||
) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]:
|
) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]:
|
||||||
if "padding_mask" in kwargs:
|
|
||||||
warnings.warn(
|
|
||||||
"Passing `padding_mask` is deprecated and will be removed in v4.37. Please make sure use `attention_mask` instead.`"
|
|
||||||
)
|
|
||||||
bsz, q_len, _ = hidden_states.size()
|
bsz, q_len, _ = hidden_states.size()
|
||||||
|
|
||||||
query_states = self.q_proj(hidden_states)
|
query_states = self.q_proj(hidden_states)
|
||||||
@ -328,15 +322,7 @@ class Starcoder2FlashAttention2(Starcoder2Attention):
|
|||||||
past_key_value: Optional[Cache] = None,
|
past_key_value: Optional[Cache] = None,
|
||||||
output_attentions: bool = False,
|
output_attentions: bool = False,
|
||||||
use_cache: bool = False,
|
use_cache: bool = False,
|
||||||
**kwargs,
|
|
||||||
):
|
):
|
||||||
if "padding_mask" in kwargs:
|
|
||||||
warnings.warn(
|
|
||||||
"Passing `padding_mask` is deprecated and will be removed in v4.37. Please make sure use `attention_mask` instead.`"
|
|
||||||
)
|
|
||||||
|
|
||||||
# overwrite attention_mask with padding_mask
|
|
||||||
attention_mask = kwargs.pop("padding_mask")
|
|
||||||
bsz, q_len, _ = hidden_states.size()
|
bsz, q_len, _ = hidden_states.size()
|
||||||
|
|
||||||
query_states = self.q_proj(hidden_states)
|
query_states = self.q_proj(hidden_states)
|
||||||
@ -717,12 +703,7 @@ class Starcoder2DecoderLayer(nn.Module):
|
|||||||
past_key_value: Optional[Tuple[torch.Tensor]] = None,
|
past_key_value: Optional[Tuple[torch.Tensor]] = None,
|
||||||
output_attentions: Optional[bool] = False,
|
output_attentions: Optional[bool] = False,
|
||||||
use_cache: Optional[bool] = False,
|
use_cache: Optional[bool] = False,
|
||||||
**kwargs,
|
|
||||||
) -> Tuple[torch.FloatTensor, Optional[Tuple[torch.FloatTensor, torch.FloatTensor]]]:
|
) -> Tuple[torch.FloatTensor, Optional[Tuple[torch.FloatTensor, torch.FloatTensor]]]:
|
||||||
if "padding_mask" in kwargs:
|
|
||||||
warnings.warn(
|
|
||||||
"Passing `padding_mask` is deprecated and will be removed in v4.37. Please make sure use `attention_mask` instead.`"
|
|
||||||
)
|
|
||||||
"""
|
"""
|
||||||
Args:
|
Args:
|
||||||
hidden_states (`torch.FloatTensor`): input to the layer of shape `(batch, seq_len, embed_dim)`
|
hidden_states (`torch.FloatTensor`): input to the layer of shape `(batch, seq_len, embed_dim)`
|
||||||
|
@ -461,23 +461,7 @@ class TableTransformerAttention(nn.Module):
|
|||||||
def _shape(self, tensor: torch.Tensor, seq_len: int, batch_size: int):
|
def _shape(self, tensor: torch.Tensor, seq_len: int, batch_size: int):
|
||||||
return tensor.view(batch_size, seq_len, self.num_heads, self.head_dim).transpose(1, 2).contiguous()
|
return tensor.view(batch_size, seq_len, self.num_heads, self.head_dim).transpose(1, 2).contiguous()
|
||||||
|
|
||||||
def with_pos_embed(self, tensor: torch.Tensor, object_queries: Optional[Tensor], **kwargs):
|
def with_pos_embed(self, tensor: torch.Tensor, object_queries: Optional[Tensor]):
|
||||||
position_embeddings = kwargs.pop("position_embeddings", None)
|
|
||||||
|
|
||||||
if kwargs:
|
|
||||||
raise ValueError(f"Unexpected arguments {kwargs.keys()}")
|
|
||||||
|
|
||||||
if position_embeddings is not None and object_queries is not None:
|
|
||||||
raise ValueError(
|
|
||||||
"Cannot specify both position_embeddings and object_queries. Please use just object_queries"
|
|
||||||
)
|
|
||||||
|
|
||||||
if position_embeddings is not None:
|
|
||||||
logger.warning_once(
|
|
||||||
"position_embeddings has been deprecated and will be removed in v4.34. Please use object_queries instead"
|
|
||||||
)
|
|
||||||
object_queries = position_embeddings
|
|
||||||
|
|
||||||
return tensor if object_queries is None else tensor + object_queries
|
return tensor if object_queries is None else tensor + object_queries
|
||||||
|
|
||||||
def forward(
|
def forward(
|
||||||
@ -488,38 +472,8 @@ class TableTransformerAttention(nn.Module):
|
|||||||
key_value_states: Optional[torch.Tensor] = None,
|
key_value_states: Optional[torch.Tensor] = None,
|
||||||
spatial_position_embeddings: Optional[torch.Tensor] = None,
|
spatial_position_embeddings: Optional[torch.Tensor] = None,
|
||||||
output_attentions: bool = False,
|
output_attentions: bool = False,
|
||||||
**kwargs,
|
|
||||||
) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]:
|
) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]:
|
||||||
"""Input shape: Batch x Time x Channel"""
|
"""Input shape: Batch x Time x Channel"""
|
||||||
|
|
||||||
position_embeddings = kwargs.pop("position_ebmeddings", None)
|
|
||||||
key_value_position_embeddings = kwargs.pop("key_value_position_embeddings", None)
|
|
||||||
|
|
||||||
if kwargs:
|
|
||||||
raise ValueError(f"Unexpected arguments {kwargs.keys()}")
|
|
||||||
|
|
||||||
if position_embeddings is not None and object_queries is not None:
|
|
||||||
raise ValueError(
|
|
||||||
"Cannot specify both position_embeddings and object_queries. Please use just object_queries"
|
|
||||||
)
|
|
||||||
|
|
||||||
if key_value_position_embeddings is not None and spatial_position_embeddings is not None:
|
|
||||||
raise ValueError(
|
|
||||||
"Cannot specify both key_value_position_embeddings and spatial_position_embeddings. Please use just spatial_position_embeddings"
|
|
||||||
)
|
|
||||||
|
|
||||||
if position_embeddings is not None:
|
|
||||||
logger.warning_once(
|
|
||||||
"position_embeddings has been deprecated and will be removed in v4.34. Please use object_queries instead"
|
|
||||||
)
|
|
||||||
object_queries = position_embeddings
|
|
||||||
|
|
||||||
if key_value_position_embeddings is not None:
|
|
||||||
logger.warning_once(
|
|
||||||
"key_value_position_embeddings has been deprecated and will be removed in v4.34. Please use spatial_position_embeddings instead"
|
|
||||||
)
|
|
||||||
spatial_position_embeddings = key_value_position_embeddings
|
|
||||||
|
|
||||||
# if key_value_states are provided this layer is used as a cross-attention layer
|
# if key_value_states are provided this layer is used as a cross-attention layer
|
||||||
# for the decoder
|
# for the decoder
|
||||||
is_cross_attention = key_value_states is not None
|
is_cross_attention = key_value_states is not None
|
||||||
@ -1020,7 +974,6 @@ class TableTransformerDecoder(TableTransformerPreTrainedModel):
|
|||||||
output_attentions=None,
|
output_attentions=None,
|
||||||
output_hidden_states=None,
|
output_hidden_states=None,
|
||||||
return_dict=None,
|
return_dict=None,
|
||||||
**kwargs,
|
|
||||||
):
|
):
|
||||||
r"""
|
r"""
|
||||||
Args:
|
Args:
|
||||||
@ -1058,22 +1011,6 @@ class TableTransformerDecoder(TableTransformerPreTrainedModel):
|
|||||||
return_dict (`bool`, *optional*):
|
return_dict (`bool`, *optional*):
|
||||||
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
||||||
"""
|
"""
|
||||||
position_embeddings = kwargs.pop("position_embeddings", None)
|
|
||||||
|
|
||||||
if kwargs:
|
|
||||||
raise ValueError(f"Unexpected arguments {kwargs.keys()}")
|
|
||||||
|
|
||||||
if position_embeddings is not None and object_queries is not None:
|
|
||||||
raise ValueError(
|
|
||||||
"Cannot specify both position_embeddings and object_queries. Please use just object_queries"
|
|
||||||
)
|
|
||||||
|
|
||||||
if position_embeddings is not None:
|
|
||||||
logger.warning_once(
|
|
||||||
"position_embeddings has been deprecated and will be removed in v4.34. Please use object_queries instead"
|
|
||||||
)
|
|
||||||
object_queries = position_embeddings
|
|
||||||
|
|
||||||
output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
|
output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
|
||||||
output_hidden_states = (
|
output_hidden_states = (
|
||||||
output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
|
output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
|
||||||
|
@ -820,31 +820,6 @@ class YolosImageProcessor(BaseImageProcessor):
|
|||||||
raise ValueError(f"Format {format} is not supported.")
|
raise ValueError(f"Format {format} is not supported.")
|
||||||
return target
|
return target
|
||||||
|
|
||||||
# Copied from transformers.models.detr.image_processing_detr.DetrImageProcessor.prepare
|
|
||||||
def prepare(self, image, target, return_segmentation_masks=None, masks_path=None):
|
|
||||||
logger.warning_once(
|
|
||||||
"The `prepare` method is deprecated and will be removed in a v4.33. "
|
|
||||||
"Please use `prepare_annotation` instead. Note: the `prepare_annotation` method "
|
|
||||||
"does not return the image anymore.",
|
|
||||||
)
|
|
||||||
target = self.prepare_annotation(image, target, return_segmentation_masks, masks_path, self.format)
|
|
||||||
return image, target
|
|
||||||
|
|
||||||
# Copied from transformers.models.detr.image_processing_detr.DetrImageProcessor.convert_coco_poly_to_mask
|
|
||||||
def convert_coco_poly_to_mask(self, *args, **kwargs):
|
|
||||||
logger.warning_once("The `convert_coco_poly_to_mask` method is deprecated and will be removed in v4.33. ")
|
|
||||||
return convert_coco_poly_to_mask(*args, **kwargs)
|
|
||||||
|
|
||||||
# Copied from transformers.models.detr.image_processing_detr.DetrImageProcessor.prepare_coco_detection with DETR->Yolos
|
|
||||||
def prepare_coco_detection(self, *args, **kwargs):
|
|
||||||
logger.warning_once("The `prepare_coco_detection` method is deprecated and will be removed in v4.33. ")
|
|
||||||
return prepare_coco_detection_annotation(*args, **kwargs)
|
|
||||||
|
|
||||||
# Copied from transformers.models.detr.image_processing_detr.DetrImageProcessor.prepare_coco_panoptic
|
|
||||||
def prepare_coco_panoptic(self, *args, **kwargs):
|
|
||||||
logger.warning_once("The `prepare_coco_panoptic` method is deprecated and will be removed in v4.33. ")
|
|
||||||
return prepare_coco_panoptic_annotation(*args, **kwargs)
|
|
||||||
|
|
||||||
# Copied from transformers.models.detr.image_processing_detr.DetrImageProcessor.resize
|
# Copied from transformers.models.detr.image_processing_detr.DetrImageProcessor.resize
|
||||||
def resize(
|
def resize(
|
||||||
self,
|
self,
|
||||||
|
Loading…
Reference in New Issue
Block a user