Export
This notebook regroups the code sample of the video below, which is a part of the Hugging Face course.
[ ]
Install the Transformers and Datasets libraries to run this notebook.
[ ]
[ ]
[{'label': 'POSITIVE', 'score': 0.9598047137260437}] [ ]
[{'label': 'POSITIVE', 'score': 0.9598047137260437},
, {'label': 'NEGATIVE', 'score': 0.9994558095932007}] [ ]
{'sequence': 'This is a course about the Transformers library',
, 'labels': ['education', 'business', 'politics'],
, 'scores': [0.8445963859558105, 0.1119762435555458, 0.043427448719739914]} [ ]
Setting `pad_token_id` to `eos_token_id`:50256 for open-end generation.
[{'generated_text': 'In this course, we will teach you how to apply a real-time flow strategy of a distributed system called "n-to-5th dimension" in real-world situations. The techniques we will demonstrate are as follows:\n\nCreate your'}] [ ]
Setting `pad_token_id` to `eos_token_id`:50256 for open-end generation.
[{'generated_text': 'In this course, we will teach you how to design your software and help you get the most out of it.\n\nStep 10: Start coding'},
, {'generated_text': "In this course, we will teach you how to handle errors in the program. From scratch, you'll learn the basic operations that can be performed as"}] [ ]
[{'sequence': 'This course will teach you all about mathematical models.',
, 'score': 0.19619831442832947,
, 'token': 30412,
, 'token_str': ' mathematical'},
, {'sequence': 'This course will teach you all about computational models.',
, 'score': 0.04052725434303284,
, 'token': 38163,
, 'token_str': ' computational'}] [ ]
/home/sgugger/git/transformers/src/transformers/pipelines/token_classification.py:155: UserWarning: `grouped_entities` is deprecated and will be removed in version v5.0.0, defaulted to `aggregation_strategy="AggregationStrategy.SIMPLE"` instead.
f'`grouped_entities` is deprecated and will be removed in version v5.0.0, defaulted to `aggregation_strategy="{aggregation_strategy}"` instead.'
[{'entity_group': 'PER',
, 'score': 0.9981694,
, 'word': 'Sylvain',
, 'start': 11,
, 'end': 18},
, {'entity_group': 'ORG',
, 'score': 0.97960204,
, 'word': 'Hugging Face',
, 'start': 33,
, 'end': 45},
, {'entity_group': 'LOC',
, 'score': 0.99321055,
, 'word': 'Brooklyn',
, 'start': 49,
, 'end': 57}] [ ]
{'score': 0.6385916471481323, 'start': 33, 'end': 45, 'answer': 'Hugging Face'} [ ]
[{'summary_text': ' America has changed dramatically during recent years . The number of engineering graduates in the U.S. has declined in traditional engineering disciplines such as mechanical, civil, electrical, chemical, and aeronautical engineering . Rapidly developing economies such as China and India, as well as other industrial countries in Europe and Asia, continue to encourage and advance engineering .'}] [ ]
[{'translation_text': 'This course is produced by Hugging Face.'}] [ ]