dahara1 commited on
Commit
8fc9d90
·
verified ·
1 Parent(s): 8d91c1d

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +104 -0
README.md ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: gptq
3
+ base_model: google/gemma-7b
4
+ language:
5
+ - ja
6
+ - en
7
+ tags:
8
+ - translation
9
+ - hqq
10
+ - gemma
11
+ - text-generation-inference
12
+ - nlp
13
+ ---
14
+
15
+ ### Model card
16
+ 英日、日英翻訳用モデルC3TR-AdapterのHQQ(Half-Quadratic Quantization)量子化版です。
17
+ This is the HQQ(Half-Quadratic Quantization) quantized version of the C3TR-Adapter model for English-Japanese and Japanese-English translation.
18
+
19
+ ### install
20
+ [hqq](https://github.com/mobiusml/hqq)の公式サイトをご確認下さい
21
+ Check official [hqq](https://github.com/mobiusml/hqq)
22
+
23
+ 私はソースからTransformersとhqqをインストールしないと動かす事ができませんでした。
24
+ I couldn't get it to work without installing Transformers and hqq from source.
25
+
26
+ ```
27
+ # transformers 4.42.0.dev0
28
+ pip install git+https://github.com/huggingface/transformers.git
29
+ # hqq 0.1.7.post2)
30
+ pip install git+https://github.com/mobiusml/hqq.git
31
+ ```
32
+
33
+ ### Sample code
34
+ ```
35
+ from transformers import AutoModelForCausalLM, AutoTokenizer
36
+ from hqq.models.hf.base import AutoHQQHFModel
37
+
38
+ model_id = "C3TR-Adapter_hqq"
39
+ model = AutoHQQHFModel.from_quantized(model_id)
40
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
41
+
42
+ prompt_text = """You are a highly skilled professional Japanese-English and English-Japanese translator. Translate the given text accurately, taking into account the context and specific instructions provided. Steps may include hints enclosed in square brackets [] with the key and value separated by a colon:. Only when the subject is specified in the Japanese sentence, the subject will be added when translating into English. If no additional instructions or context are provided, use your expertise to consider what the most appropriate context is and provide a natural translation that aligns with that context. When translating, strive to faithfully reflect the meaning and tone of the original text, pay attention to cultural nuances and differences in language usage, and ensure that the translation is grammatically correct and easy to read. After completing the translation, review it once more to check for errors or unnatural expressions. For technical terms and proper nouns, either leave them in the original language or use appropriate translations as necessary. Take a deep breath, calm down, and start translating.
43
+
44
+ ### Instruction:
45
+ Translate English to Japanese.
46
+ When translating, please use the following hints:
47
+ [writeing_style: formal]
48
+ [岡浩: Oka Hiroshi]
49
+ [植草泰彦: Uekusa Yasuhiko]
50
+
51
+ ### Input:
52
+ 5月20日(現地時間同日)、エジプト・アラブ共和国の首都カイロにおいて、岡浩駐エジプト日本国特命全権大使、植草泰彦内閣府国際平和>協力本部事務局参事官及びサハル・アル・ジョブリー国連パレスチナ難民救済事業機関(UNRWA)カイロ事務所長(Ms. Sahar Al Jobury, Chief, the United Nations Relief and Works Agency for Palestine Refugees in the Near East (UNRWA) Representative Office in Cairo)の列席のもと、UNRWAに対して提供する物資の供与式を実施しました。
53
+
54
+  スリーピングマット等の支援物資は、18日(現地時間17日)、アラブ首長国連邦の備蓄倉庫からエジプトのエルアリーシュ空港に到着し、
55
+ 今後、エジプト赤新月社の協力を得てガザ地区まで輸送され、パレスチナ被災民のために活用されます。
56
+
57
+ (参考)UNRWAによるパレスチナ被災民支援活動に対する物資協力
58
+ 概要
59
+  パレスチナ暫定自治区であるガザ地区において人道的な国際救援活動を行っている国際連合パレスチナ難民救済事業機関(UNRWA)に対し>、国際平和協力法に基づき、先方から依頼のあった物資を提供する。
60
+ 提供物資
61
+  内閣府が人道支援のためにドバイに備蓄している以下の物資を提供。
62
+ 毛布 5,000枚
63
+ 給水容器 10,000個
64
+ ビニールシート 4,500枚
65
+ スリーピングマット 8,500枚
66
+
67
+ ### Response:
68
+ """
69
+
70
+ tokens = tokenizer(prompt_text, return_tensors="pt",
71
+ padding=True, max_length=1600, truncation=True).to("cuda:0").input_ids
72
+
73
+ output = model.generate(
74
+ input_ids=tokens,
75
+ max_new_tokens=800,
76
+ do_sample=True,
77
+ num_beams=3, temperature=0.5, top_p=0.3,
78
+ repetition_penalty=1.0)
79
+ print(tokenizer.decode(output[0]))
80
+
81
+ ```
82
+
83
+ 出力(Output)
84
+ ```
85
+ ### Response:
86
+ On May 20 (local time), H.E. Mr. Oka Hiroshi, Ambassador Extraordinary and Plenipotentiary of Japan to the Arab Republic of Egypt, Mr. Uekusa Yasuhiko, Counsellor, International Cooperation Bureau, Cabinet Office, and Ms. Sahar Al Jobury, Chief, the United Nations Relief and Works Agency for Palestine Refugees in the Near East (UNRWA) Representative Office in Cairo, attended the handover ceremony of relief supplies to be provided to UNRWA.
87
+
88
+ The relief supplies such as sleeping mats were received on May 18 (local time, May 17) at El Arish Airport in the Arab Republic of Egypt from a warehouse in the United Arab Emirates. The supplies will be transported to the Gaza Strip with the cooperation of the Egyptian Red Crescent Society and will be utilized for Palestinian refugees.
89
+
90
+ (Reference) Provision of Relief Supplies to UNRWA for Assistance to Palestinian Refugees
91
+ Overview
92
+ Based on the International Cooperation Law, Japan will provide relief supplies to the United Nations Relief and Works Agency for Palestine Refugees in the Near East (UNRWA), which is conducting humanitarian international relief activities in the Gaza Strip, Palestinian Territory.
93
+ Relief Supplies
94
+ The following relief supplies stored in Dubai for humanitarian assistance will be provided:
95
+ Blankets: 5,000 pieces
96
+ Water containers: 10,000 pieces
97
+ Plastic sheets: 4,500 pieces
98
+ Sleeping mats: 8,500 pieces<eos>
99
+ ```
100
+
101
+ ### See also
102
+
103
+ 詳細は[C3TR-Adapter](https://huggingface.co/webbigdata/C3TR-Adapter)を見てください
104
+ See also [C3TR-Adapter](https://huggingface.co/webbigdata/C3TR-Adapter)