--- library_name: gptq base_model: google/gemma-7b language: - ja - en tags: - translation - hqq - gemma - text-generation-inference - nlp --- ### Model card 英日、日英翻訳用モデル[C3TR-Adapter](https://huggingface.co/webbigdata/C3TR-Adapter)のHQQ(Half-Quadratic Quantization)4bit量子化版です。 This is the HQQ(Half-Quadratic Quantization) 4bit quantized version of the [C3TR-Adapter](https://huggingface.co/webbigdata/C3TR-Adapter), model for English-Japanese and Japanese-English translation. ### install [hqq](https://github.com/mobiusml/hqq)の公式サイトをご確認下さい Check official [hqq](https://github.com/mobiusml/hqq) 私はソースからTransformersとhqqをインストールしないと動かす事ができませんでした。 I couldn't get it to work without installing Transformers and hqq from source. ``` # transformers 4.42.0.dev0 pip install git+https://github.com/huggingface/transformers.git # hqq 0.1.7.post2 pip install git+https://github.com/mobiusml/hqq.git ``` ### Sample code ``` from transformers import AutoModelForCausalLM, AutoTokenizer from hqq.models.hf.base import AutoHQQHFModel model_id = "C3TR-Adapter_hqq" model = AutoHQQHFModel.from_quantized(model_id) tokenizer = AutoTokenizer.from_pretrained(model_id) 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. ### Instruction: Translate English to Japanese. When translating, please use the following hints: [writeing_style: formal] [岡浩: Hiroshi Oka] [植草泰彦: Yasuhiko Uekusa] ### Input: 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に対して提供する物資の供与式を実施しました。  スリーピングマット等の支援物資は、18日(現地時間17日)、アラブ首長国連邦の備蓄倉庫からエジプトのエルアリーシュ空港に到着し、 今後、エジプト赤新月社の協力を得てガザ地区まで輸送され、パレスチナ被災民のために活用されます。 (参考)UNRWAによるパレスチナ被災民支援活動に対する物資協力 概要  パレスチナ暫定自治区であるガザ地区において人道的な国際救援活動を行っている国際連合パレスチナ難民救済事業機関(UNRWA)に対し、国際平和協力法に基づき、先方から依頼のあった物資を提供する。 提供物資  内閣府が人道支援のためにドバイに備蓄している以下の物資を提供。 毛布 5,000枚 給水容器 10,000個 ビニールシート 4,500枚 スリーピングマット 8,500枚 ### Response: """ tokens = tokenizer(prompt_text, return_tensors="pt", padding=True, max_length=1600, truncation=True).to("cuda:0").input_ids output = model.generate( input_ids=tokens, max_new_tokens=800, do_sample=True, num_beams=3, temperature=0.5, top_p=0.3, repetition_penalty=1.0) print(tokenizer.decode(output[0])) ``` 出力(Output) ``` ### Response: On May 20 (local time), H.E. Mr. Hiroshi Oka, Ambassador Extraordinary and Plenipotentiary of Japan to the Arab Republic of Egypt, Mr. Yasuhiko Uekusa, 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. 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. (Reference) Provision of Relief Supplies to UNRWA for Assistance to Palestinian Refugees Overview 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. Relief Supplies The following relief supplies stored in Dubai for humanitarian assistance will be provided: Blankets: 5,000 pieces Water containers: 10,000 pieces Plastic sheets: 4,500 pieces Sleeping mats: 8,500 pieces ``` ### See also 詳細は[C3TR-Adapter](https://huggingface.co/webbigdata/C3TR-Adapter)を見てください See also [C3TR-Adapter](https://huggingface.co/webbigdata/C3TR-Adapter)