igorlucic commited on
Commit
89cb238
·
1 Parent(s): 883421e

Upload SeedTranslate.ipynb

Browse files
Files changed (1) hide show
  1. SeedTranslate.ipynb +62 -0
SeedTranslate.ipynb ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "nbformat": 4,
3
+ "nbformat_minor": 0,
4
+ "metadata": {
5
+ "colab": {
6
+ "provenance": []
7
+ },
8
+ "kernelspec": {
9
+ "name": "python3",
10
+ "display_name": "Python 3"
11
+ },
12
+ "language_info": {
13
+ "name": "python"
14
+ }
15
+ },
16
+ "cells": [
17
+ {
18
+ "cell_type": "code",
19
+ "source": [
20
+ "!pip install transformers sentencepiece"
21
+ ],
22
+ "metadata": {
23
+ "id": "FnAf9krqUwBz"
24
+ },
25
+ "execution_count": null,
26
+ "outputs": []
27
+ },
28
+ {
29
+ "cell_type": "code",
30
+ "source": [
31
+ "from transformers import pipeline"
32
+ ],
33
+ "metadata": {
34
+ "id": "EcU9xP_5L0rQ"
35
+ },
36
+ "execution_count": null,
37
+ "outputs": []
38
+ },
39
+ {
40
+ "cell_type": "code",
41
+ "source": [
42
+ "pipe = pipeline(task='text2text-generation', model='facebook/m2m100_418M')"
43
+ ],
44
+ "metadata": {
45
+ "id": "yXUBigNfU02q"
46
+ },
47
+ "execution_count": null,
48
+ "outputs": []
49
+ },
50
+ {
51
+ "cell_type": "code",
52
+ "source": [
53
+ "pipe(\"I love rock and roll\", forced_bos_token_id=pipe.tokenizer.get_lang_id(lang='zh'))"
54
+ ],
55
+ "metadata": {
56
+ "id": "8e6HmITZU-YN"
57
+ },
58
+ "execution_count": null,
59
+ "outputs": []
60
+ }
61
+ ]
62
+ }