cbdb commited on
Commit
8a8da47
1 Parent(s): 8828dd7

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +5 -7
README.md CHANGED
@@ -40,13 +40,11 @@ tobe_translated = ['講筵官','判司簿尉','散騎常侍','殿中省尚輦奉
40
 
41
  <font color="cornflowerblue"> 3. Make a prediction </font>
42
  ```python
43
- trans_list = []
44
- for chinese_sentence in tobe_translated:
45
- inputs = tokenizer([chinese_sentence], return_tensors="pt", padding=True).to(device)
46
- translated = model.generate(**inputs, max_length=128)
47
- tran = [tokenizer.decode(t, skip_special_tokens=True) for t in translated][0]
48
- print(f'{chinese_sentence}: {tran}')
49
- trans_list.append(tran[0])
50
  ```
51
  講筵官: Lecturer<br>
52
  判司簿尉: Supervisor of the Commandant of Records<br>
 
40
 
41
  <font color="cornflowerblue"> 3. Make a prediction </font>
42
  ```python
43
+ inputs = tokenizer(tobe_translated, return_tensors="pt", padding=True).to(device)
44
+ translated = model.generate(**inputs, max_length=128)
45
+ tran = [tokenizer.decode(t, skip_special_tokens=True) for t in translated]
46
+ for c, t in zip(tobe_translated, tran):
47
+ print(f'{c}: {t}')
 
 
48
  ```
49
  講筵官: Lecturer<br>
50
  判司簿尉: Supervisor of the Commandant of Records<br>