Skip to content

Commit b42586e

Browse files
authored
Fix CI after killing archive maps (huggingface#4724)
* 🐛 Fix model ids for BART and Flaubert
1 parent b43c78e commit b42586e

File tree

9 files changed

+39
-34
lines changed

9 files changed

+39
-34
lines changed

docs/source/model_doc/bart.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Implementation Notes
2222
- The forward pass of ``BartModel`` will create decoder inputs (using the helper function ``transformers.modeling_bart._prepare_bart_decoder_inputs``) if they are not passed. This is different than some other modeling APIs.
2323
- Model predictions are intended to be identical to the original implementation. This only works, however, if the string you pass to ``fairseq.encode`` starts with a space.
2424
- ``BartForConditionalGeneration.generate`` should be used for conditional generation tasks like summarization, see the example in that docstrings
25-
- Models that load the ``"bart-large-cnn"`` weights will not have a ``mask_token_id``, or be able to perform mask filling tasks.
25+
- Models that load the ``"facebook/bart-large-cnn"`` weights will not have a ``mask_token_id``, or be able to perform mask filling tasks.
2626

2727

2828

examples/summarization/bart/evaluate_cnn.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def generate_summaries(
2121
):
2222
fout = Path(out_file).open("w")
2323
model = BartForConditionalGeneration.from_pretrained(model_name).to(device)
24-
tokenizer = BartTokenizer.from_pretrained("bart-large")
24+
tokenizer = BartTokenizer.from_pretrained("facebook/bart-large")
2525

2626
max_length = 140
2727
min_length = 55
@@ -54,7 +54,7 @@ def run_generate():
5454
"output_path", type=str, help="where to save summaries",
5555
)
5656
parser.add_argument(
57-
"model_name", type=str, default="bart-large-cnn", help="like bart-large-cnn",
57+
"model_name", type=str, default="facebook/bart-large-cnn", help="like bart-large-cnn",
5858
)
5959
parser.add_argument(
6060
"--device", type=str, required=False, default=DEFAULT_DEVICE, help="cuda, cuda:1, cpu etc.",

examples/summarization/bart/test_bart_examples.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def test_bart_summarization_dataset(self):
129129
summaries = ["A very interesting story about what I ate for lunch.", "Avocado, celery, turkey, coffee"]
130130
_dump_articles((tmp_dir / "train.source"), articles)
131131
_dump_articles((tmp_dir / "train.target"), summaries)
132-
tokenizer = BartTokenizer.from_pretrained("bart-large")
132+
tokenizer = BartTokenizer.from_pretrained("facebook/bart-large")
133133
max_len_source = max(len(tokenizer.encode(a)) for a in articles)
134134
max_len_target = max(len(tokenizer.encode(a)) for a in summaries)
135135
trunc_target = 4

src/transformers/configuration_ctrl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
logger = logging.getLogger(__name__)
2424

25-
CTRL_PRETRAINED_CONFIG_ARCHIVE_MAP = {"ctrl": "https://storage.googleapis.com/sf-ctrl/pytorch/ctrl-config.json"}
25+
CTRL_PRETRAINED_CONFIG_ARCHIVE_MAP = {"ctrl": "https://s3.amazonaws.com/models.huggingface.co/bert/ctrl-config.json"}
2626

2727

2828
class CTRLConfig(PretrainedConfig):

src/transformers/convert_bart_original_pytorch_checkpoint_to_pytorch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def convert_bart_checkpoint(checkpoint_path, pytorch_dump_folder_path, hf_checkp
124124
remove_ignore_keys_(state_dict)
125125
state_dict["shared.weight"] = state_dict["decoder.embed_tokens.weight"]
126126
fairseq_output = bart.extract_features(tokens)
127-
if hf_checkpoint_name == "bart-large":
127+
if hf_checkpoint_name == "facebook/bart-large":
128128
model = BartModel(config).eval()
129129
model.load_state_dict(state_dict)
130130
new_model_outputs = model(tokens).model[0]

src/transformers/pipelines.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1633,7 +1633,7 @@ def __call__(
16331633
"impl": SummarizationPipeline,
16341634
"tf": TFAutoModelWithLMHead if is_tf_available() else None,
16351635
"pt": AutoModelWithLMHead if is_torch_available() else None,
1636-
"default": {"model": {"pt": "bart-large-cnn", "tf": "t5-small"}, "config": None, "tokenizer": None},
1636+
"default": {"model": {"pt": "facebook/bart-large-cnn", "tf": "t5-small"}, "config": None, "tokenizer": None},
16371637
},
16381638
"translation_en_to_fr": {
16391639
"impl": TranslationPipeline,

src/transformers/tokenization_bart.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,12 @@
2525
# vocab and merges same as roberta
2626
vocab_url = "https://s3.amazonaws.com/models.huggingface.co/bert/roberta-large-vocab.json"
2727
merges_url = "https://s3.amazonaws.com/models.huggingface.co/bert/roberta-large-merges.txt"
28-
_all_bart_models = ["bart-large", "bart-large-mnli", "bart-large-cnn", "bart-large-xsum"]
28+
_all_bart_models = [
29+
"facebook/bart-large",
30+
"facebook/bart-large-mnli",
31+
"facebook/bart-large-cnn",
32+
"facebook/bart-large-xsum",
33+
]
2934

3035

3136
class BartTokenizer(RobertaTokenizer):
@@ -37,7 +42,7 @@ class BartTokenizer(RobertaTokenizer):
3742
}
3843

3944

40-
_all_mbart_models = ["mbart-large-en-ro"]
45+
_all_mbart_models = ["facebook/mbart-large-en-ro"]
4146
SPM_URL = "https://s3.amazonaws.com/models.huggingface.co/bert/facebook/mbart-large-en-ro/sentence.bpe.model"
4247

4348

src/transformers/tokenization_flaubert.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,31 +32,31 @@
3232

3333
PRETRAINED_VOCAB_FILES_MAP = {
3434
"vocab_file": {
35-
"flaubert-small-cased": "https://s3.amazonaws.com/models.huggingface.co/bert/flaubert/flaubert_small_cased/vocab.json",
36-
"flaubert-base-uncased": "https://s3.amazonaws.com/models.huggingface.co/bert/flaubert/flaubert_base_uncased/vocab.json",
37-
"flaubert-base-cased": "https://s3.amazonaws.com/models.huggingface.co/bert/flaubert/flaubert_base_cased/vocab.json",
38-
"flaubert-large-cased": "https://s3.amazonaws.com/models.huggingface.co/bert/flaubert/flaubert_large_cased/vocab.json",
35+
"flaubert/flaubert_small_cased": "https://s3.amazonaws.com/models.huggingface.co/bert/flaubert/flaubert_small_cased/vocab.json",
36+
"flaubert/flaubert_base_uncased": "https://s3.amazonaws.com/models.huggingface.co/bert/flaubert/flaubert_base_uncased/vocab.json",
37+
"flaubert/flaubert_base_cased": "https://s3.amazonaws.com/models.huggingface.co/bert/flaubert/flaubert_base_cased/vocab.json",
38+
"flaubert/flaubert_large_cased": "https://s3.amazonaws.com/models.huggingface.co/bert/flaubert/flaubert_large_cased/vocab.json",
3939
},
4040
"merges_file": {
41-
"flaubert-small-cased": "https://s3.amazonaws.com/models.huggingface.co/bert/flaubert/flaubert_small_cased/merges.txt",
42-
"flaubert-base-uncased": "https://s3.amazonaws.com/models.huggingface.co/bert/flaubert/flaubert_base_uncased/merges.txt",
43-
"flaubert-base-cased": "https://s3.amazonaws.com/models.huggingface.co/bert/flaubert/flaubert_base_cased/merges.txt",
44-
"flaubert-large-cased": "https://s3.amazonaws.com/models.huggingface.co/bert/flaubert/flaubert_large_cased/merges.txt",
41+
"flaubert/flaubert_small_cased": "https://s3.amazonaws.com/models.huggingface.co/bert/flaubert/flaubert_small_cased/merges.txt",
42+
"flaubert/flaubert_base_uncased": "https://s3.amazonaws.com/models.huggingface.co/bert/flaubert/flaubert_base_uncased/merges.txt",
43+
"flaubert/flaubert_base_cased": "https://s3.amazonaws.com/models.huggingface.co/bert/flaubert/flaubert_base_cased/merges.txt",
44+
"flaubert/flaubert_large_cased": "https://s3.amazonaws.com/models.huggingface.co/bert/flaubert/flaubert_large_cased/merges.txt",
4545
},
4646
}
4747

4848
PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES = {
49-
"flaubert-small-cased": 512,
50-
"flaubert-base-uncased": 512,
51-
"flaubert-base-cased": 512,
52-
"flaubert-large-cased": 512,
49+
"flaubert/flaubert_small_cased": 512,
50+
"flaubert/flaubert_base_uncased": 512,
51+
"flaubert/flaubert_base_cased": 512,
52+
"flaubert/flaubert_large_cased": 512,
5353
}
5454

5555
PRETRAINED_INIT_CONFIGURATION = {
56-
"flaubert-small-cased": {"do_lowercase": False},
57-
"flaubert-base-uncased": {"do_lowercase": True},
58-
"flaubert-base-cased": {"do_lowercase": False},
59-
"flaubert-large-cased": {"do_lowercase": False},
56+
"flaubert/flaubert_small_cased": {"do_lowercase": False},
57+
"flaubert/flaubert_base_uncased": {"do_lowercase": True},
58+
"flaubert/flaubert_base_cased": {"do_lowercase": False},
59+
"flaubert/flaubert_large_cased": {"do_lowercase": False},
6060
}
6161

6262

tests/test_modeling_bart.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ class BartTranslationTests(unittest.TestCase):
203203

204204
@classmethod
205205
def setUpClass(cls):
206-
checkpoint_name = "mbart-large-en-ro"
206+
checkpoint_name = "facebook/mbart-large-en-ro"
207207
cls.tokenizer = MBartTokenizer.from_pretrained(checkpoint_name)
208208
cls.pad_token_id = 1
209209
net_input = {
@@ -230,7 +230,7 @@ def setUpClass(cls):
230230
def model(self):
231231
"""Only load the model if needed."""
232232
if self._model is None:
233-
model = BartForConditionalGeneration.from_pretrained("mbart-large-en-ro")
233+
model = BartForConditionalGeneration.from_pretrained("facebook/mbart-large-en-ro")
234234
self._model = model.to(torch_device)
235235
return self._model
236236

@@ -427,7 +427,7 @@ def test_shift_tokens_right(self):
427427

428428
@slow
429429
def test_tokenization(self):
430-
tokenizer = BartTokenizer.from_pretrained("bart-large")
430+
tokenizer = BartTokenizer.from_pretrained("facebook/bart-large")
431431
examples = [" Hello world", " DomDramg"] # need leading spaces for equality
432432
fairseq_results = [
433433
torch.Tensor([0, 20920, 232, 2]),
@@ -519,7 +519,7 @@ def _long_tensor(tok_lst):
519519
class BartModelIntegrationTests(unittest.TestCase):
520520
@slow
521521
def test_inference_no_head(self):
522-
model = BartModel.from_pretrained("bart-large").to(torch_device)
522+
model = BartModel.from_pretrained("facebook/bart-large").to(torch_device)
523523
input_ids = _long_tensor([[0, 31414, 232, 328, 740, 1140, 12695, 69, 46078, 1588, 2]])
524524
inputs_dict = prepare_bart_inputs_dict(model.config, input_ids)
525525
with torch.no_grad():
@@ -537,7 +537,7 @@ def test_mnli_inference(self):
537537
example_b = [0, 31414, 232, 328, 740, 1140, 69, 46078, 1588, 2, 1]
538538
input_ids = _long_tensor([[0, 31414, 232, 328, 740, 1140, 12695, 69, 46078, 1588, 2], example_b])
539539

540-
model = AutoModelForSequenceClassification.from_pretrained("bart-large-mnli").to(
540+
model = AutoModelForSequenceClassification.from_pretrained("facebook/bart-large-mnli").to(
541541
torch_device
542542
) # eval called in from_pre
543543
inputs_dict = prepare_bart_inputs_dict(model.config, input_ids)
@@ -567,9 +567,9 @@ def test_model_from_pretrained(self):
567567

568568
@slow
569569
def test_xsum_summarization_same_as_fairseq(self):
570-
model = BartForConditionalGeneration.from_pretrained("bart-large-xsum").to(torch_device)
570+
model = BartForConditionalGeneration.from_pretrained("facebook/bart-large-xsum").to(torch_device)
571571
self.assertFalse(model.config.is_valid_mbart())
572-
tok = BartTokenizer.from_pretrained("bart-large")
572+
tok = BartTokenizer.from_pretrained("facebook/bart-large")
573573

574574
PGE_ARTICLE = """ PG&E stated it scheduled the blackouts in response to forecasts for high winds amid dry conditions. The aim is to reduce the risk of wildfires. Nearly 800 thousand customers were scheduled to be affected by the shutoffs which were expected to last through at least midday tomorrow."""
575575
EXPECTED_SUMMARY = "California's largest power company has begun shutting off power to tens of thousands of homes and businesses in the state."
@@ -600,8 +600,8 @@ def test_xsum_config_generation_params(self):
600600

601601
@slow
602602
def test_cnn_summarization_same_as_fairseq(self):
603-
hf = BartForConditionalGeneration.from_pretrained("bart-large-cnn").to(torch_device)
604-
tok = BartTokenizer.from_pretrained("bart-large")
603+
hf = BartForConditionalGeneration.from_pretrained("facebook/bart-large-cnn").to(torch_device)
604+
tok = BartTokenizer.from_pretrained("facebook/bart-large")
605605

606606
FRANCE_ARTICLE = ' Marseille, France (CNN)The French prosecutor leading an investigation into the crash of Germanwings Flight 9525 insisted Wednesday that he was not aware of any video footage from on board the plane. Marseille prosecutor Brice Robin told CNN that "so far no videos were used in the crash investigation." He added, "A person who has such a video needs to immediately give it to the investigators." Robin\'s comments follow claims by two magazines, German daily Bild and French Paris Match, of a cell phone video showing the harrowing final seconds from on board Germanwings Flight 9525 as it crashed into the French Alps. All 150 on board were killed. Paris Match and Bild reported that the video was recovered from a phone at the wreckage site. The two publications described the supposed video, but did not post it on their websites. The publications said that they watched the video, which was found by a source close to the investigation. "One can hear cries of \'My God\' in several languages," Paris Match reported. "Metallic banging can also be heard more than three times, perhaps of the pilot trying to open the cockpit door with a heavy object. Towards the end, after a heavy shake, stronger than the others, the screaming intensifies. Then nothing." "It is a very disturbing scene," said Julian Reichelt, editor-in-chief of Bild online. An official with France\'s accident investigation agency, the BEA, said the agency is not aware of any such video. Lt. Col. Jean-Marc Menichini, a French Gendarmerie spokesman in charge of communications on rescue efforts around the Germanwings crash site, told CNN that the reports were "completely wrong" and "unwarranted." Cell phones have been collected at the site, he said, but that they "hadn\'t been exploited yet." Menichini said he believed the cell phones would need to be sent to the Criminal Research Institute in Rosny sous-Bois, near Paris, in order to be analyzed by specialized technicians working hand-in-hand with investigators. But none of the cell phones found so far have been sent to the institute, Menichini said. Asked whether staff involved in the search could have leaked a memory card to the media, Menichini answered with a categorical "no." Reichelt told "Erin Burnett: Outfront" that he had watched the video and stood by the report, saying Bild and Paris Match are "very confident" that the clip is real. He noted that investigators only revealed they\'d recovered cell phones from the crash site after Bild and Paris Match published their reports. "That is something we did not know before. ... Overall we can say many things of the investigation weren\'t revealed by the investigation at the beginning," he said. What was mental state of Germanwings co-pilot? German airline Lufthansa confirmed Tuesday that co-pilot Andreas Lubitz had battled depression years before he took the controls of Germanwings Flight 9525, which he\'s accused of deliberately crashing last week in the French Alps. Lubitz told his Lufthansa flight training school in 2009 that he had a "previous episode of severe depression," the airline said Tuesday. Email correspondence between Lubitz and the school discovered in an internal investigation, Lufthansa said, included medical documents he submitted in connection with resuming his flight training. The announcement indicates that Lufthansa, the parent company of Germanwings, knew of Lubitz\'s battle with depression, allowed him to continue training and ultimately put him in the cockpit. Lufthansa, whose CEO Carsten Spohr previously said Lubitz was 100% fit to fly, described its statement Tuesday as a "swift and seamless clarification" and said it was sharing the information and documents -- including training and medical records -- with public prosecutors. Spohr traveled to the crash site Wednesday, where recovery teams have been working for the past week to recover human remains and plane debris scattered across a steep mountainside. He saw the crisis center set up in Seyne-les-Alpes, laid a wreath in the village of Le Vernet, closer to the crash site, where grieving families have left flowers at a simple stone memorial. Menichini told CNN late Tuesday that no visible human remains were left at the site but recovery teams would keep searching. French President Francois Hollande, speaking Tuesday, said that it should be possible to identify all the victims using DNA analysis by the end of the week, sooner than authorities had previously suggested. In the meantime, the recovery of the victims\' personal belongings will start Wednesday, Menichini said. Among those personal belongings could be more cell phones belonging to the 144 passengers and six crew on board. Check out the latest from our correspondents . The details about Lubitz\'s correspondence with the flight school during his training were among several developments as investigators continued to delve into what caused the crash and Lubitz\'s possible motive for downing the jet. A Lufthansa spokesperson told CNN on Tuesday that Lubitz had a valid medical certificate, had passed all his examinations and "held all the licenses required." Earlier, a spokesman for the prosecutor\'s office in Dusseldorf, Christoph Kumpa, said medical records reveal Lubitz suffered from suicidal tendencies at some point before his aviation career and underwent psychotherapy before he got his pilot\'s license. Kumpa emphasized there\'s no evidence suggesting Lubitz was suicidal or acting aggressively before the crash. Investigators are looking into whether Lubitz feared his medical condition would cause him to lose his pilot\'s license, a European government official briefed on the investigation told CNN on Tuesday. While flying was "a big part of his life," the source said, it\'s only one theory being considered. Another source, a law enforcement official briefed on the investigation, also told CNN that authorities believe the primary motive for Lubitz to bring down the plane was that he feared he would not be allowed to fly because of his medical problems. Lubitz\'s girlfriend told investigators he had seen an eye doctor and a neuropsychologist, both of whom deemed him unfit to work recently and concluded he had psychological issues, the European government official said. But no matter what details emerge about his previous mental health struggles, there\'s more to the story, said Brian Russell, a forensic psychologist. "Psychology can explain why somebody would turn rage inward on themselves about the fact that maybe they weren\'t going to keep doing their job and they\'re upset about that and so they\'re suicidal," he said. "But there is no mental illness that explains why somebody then feels entitled to also take that rage and turn it outward on 149 other people who had nothing to do with the person\'s problems." Germanwings crash compensation: What we know . Who was the captain of Germanwings Flight 9525? CNN\'s Margot Haddad reported from Marseille and Pamela Brown from Dusseldorf, while Laura Smith-Spark wrote from London. CNN\'s Frederik Pleitgen, Pamela Boykoff, Antonia Mortensen, Sandrine Amiel and Anna-Maja Rappard contributed to this report.' # @noqa
607607
EXPECTED_SUMMARY_FRANCE = 'French prosecutor says he\'s not aware of any video footage from on board the plane. German daily Bild and French Paris Match claim to have found a cell phone video of the crash. A French Gendarmerie spokesman calls the reports "completely wrong" and "unwarranted" German airline Lufthansa confirms co-pilot Andreas Lubitz had battled depression.'

0 commit comments

Comments
 (0)