WilliamSotoM commited on
Commit
172e841
·
verified ·
1 Parent(s): 81b2bbb

Upload 4 files

Browse files
Files changed (4) hide show
  1. LICENSE +9 -0
  2. README.md +58 -3
  3. adapter_config.json +32 -0
  4. adapter_model.bin +3 -0
LICENSE ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ Copyright 2025
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
README.md CHANGED
@@ -1,3 +1,58 @@
1
- ---
2
- license: mit
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - it
4
+ license: mit
5
+ tags:
6
+ - text2text-generation
7
+ - text-generation
8
+ base_model: google/mt5-large
9
+ ---
10
+
11
+ # PTHQL_language_Italian
12
+
13
+ This is the Italian (ita_Latn) Phylogenetic Tree Hierarquical QLoRAs (PTHQL) adapter from [Generating from AMRs into High and Low-Resource Languages using Phylogenetic Knowledge and Hierarchical QLoRA Training (HQL)](https://aclanthology.org/2024.inlg-main.7/) used for AMR-to-Text generation.
14
+
15
+ # Use
16
+
17
+ This model is the last of 4 hierarquical LoRAs. It is strongly adviseable to load all 4 LoRAs in order.
18
+
19
+ The following is minimal code to generate Italian text from an AMR graph:
20
+ ```
21
+ from transformers import MT5ForConditionalGeneration, AutoTokenizer
22
+ from peft import PeftModel
23
+
24
+ model = MT5ForConditionalGeneration.from_pretrained('google/mt5-large')
25
+ tokennizer = AutoTokenizer.from_pretrained('google/mt5-large')
26
+
27
+ model = PeftModel.from_pretrained(model, 'WilliamSotoM/PTHQL_level0_Indo_European')
28
+ model = model.merge_and_unload()
29
+
30
+ model = PeftModel.from_pretrained(model, 'WilliamSotoM/PTHQL_level1_Romance')
31
+ model = model.merge_and_unload()
32
+
33
+ model = PeftModel.from_pretrained(model, 'WilliamSotoM/PTHQL_level2_Italo_Romance')
34
+ model = model.merge_and_unload()
35
+
36
+ model = PeftModel.from_pretrained(model, 'WilliamSotoM/PTHQL_language_Italian')
37
+ model = model.merge_and_unload()
38
+
39
+ graph = '''
40
+ (w / want-01
41
+ :ARG0 (b / boy)
42
+ :ARG1 (b2 / believe-01
43
+ :ARG0 (g / girl)
44
+ :ARG1 b))
45
+ '''
46
+ tokenized_input = tokenizer(graph, return_tensors='pt')
47
+
48
+ with torch.inference_mode():
49
+ prediction = model.generate(**tokenized_input)
50
+ generated_text = tokenizer.batch_decode(prediction, skip_special_tokens=True)[0]
51
+
52
+ print(f'Generated text:', generated_text)
53
+ ```
54
+
55
+ Expected outpu:
56
+ ```
57
+ Il ragazzo vuole che la ragazza gli creda.
58
+ ```
adapter_config.json ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alpha_pattern": {},
3
+ "auto_mapping": null,
4
+ "base_model_name_or_path": "google/mt5-large",
5
+ "bias": "none",
6
+ "fan_in_fan_out": false,
7
+ "inference_mode": true,
8
+ "init_lora_weights": true,
9
+ "layers_pattern": null,
10
+ "layers_to_transform": null,
11
+ "loftq_config": {},
12
+ "lora_alpha": 256,
13
+ "lora_dropout": 0.05,
14
+ "megatron_config": null,
15
+ "megatron_core": "megatron.core",
16
+ "modules_to_save": null,
17
+ "peft_type": "LORA",
18
+ "r": 256,
19
+ "rank_pattern": {},
20
+ "revision": null,
21
+ "target_modules": [
22
+ "wi_0",
23
+ "o",
24
+ "k",
25
+ "q",
26
+ "wo",
27
+ "wi_1",
28
+ "v"
29
+ ],
30
+ "task_type": "SEQ_2_SEQ_LM",
31
+ "use_rslora": true
32
+ }
adapter_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8c43aeca960c2595332fa74c30023abe1eaa145b5a075eb33a5d69a42517b4f6
3
+ size 1170534090