Datasets:

Languages:
English
Size:
< 1K
ArXiv:
Libraries:
Datasets
License:
asahi417 commited on
Commit
6584ee1
·
1 Parent(s): fe961d8
experiments/baseline_fasttext.py CHANGED
@@ -37,14 +37,14 @@ def get_vector(_model, _word_a, _word_b):
37
 
38
 
39
  # load dataset
40
- data = load_dataset("cardiffnlp/relentless_full", split="test")
41
  full_result = []
42
  os.makedirs("./experiments/results/word_embedding/fasttext", exist_ok=True)
43
  scorer = None
44
  for d in data:
45
  ppl_file = f"experiments/results/word_embedding/fasttext/ppl.{d['relation_type'].replace(' ', '_').replace('/', '__')}.jsonl"
46
 
47
- anchor_embeddings = [(a, b) for a, b in d['positive_examples']]
48
  option_embeddings = [(x, y) for x, y in d['pairs']]
49
 
50
  if not os.path.exists(ppl_file):
@@ -52,7 +52,7 @@ for d in data:
52
  if scorer is None:
53
  scorer = load_model()
54
 
55
- anchor_embeddings = [get_vector(scorer, a, b) for a, b in d['positive_examples']]
56
  option_embeddings = [get_vector(scorer, x, y) for x, y in d['pairs']]
57
  similarity = [[cosine_similarity(a, b) for b in anchor_embeddings] for a in option_embeddings]
58
  output = [{"similarity": s} for s in similarity]
 
37
 
38
 
39
  # load dataset
40
+ data = load_dataset("cardiffnlp/relentless", split="test")
41
  full_result = []
42
  os.makedirs("./experiments/results/word_embedding/fasttext", exist_ok=True)
43
  scorer = None
44
  for d in data:
45
  ppl_file = f"experiments/results/word_embedding/fasttext/ppl.{d['relation_type'].replace(' ', '_').replace('/', '__')}.jsonl"
46
 
47
+ anchor_embeddings = [(a, b) for a, b in d['prototypical_examples']]
48
  option_embeddings = [(x, y) for x, y in d['pairs']]
49
 
50
  if not os.path.exists(ppl_file):
 
52
  if scorer is None:
53
  scorer = load_model()
54
 
55
+ anchor_embeddings = [get_vector(scorer, a, b) for a, b in d['prototypical_examples']]
56
  option_embeddings = [get_vector(scorer, x, y) for x, y in d['pairs']]
57
  similarity = [[cosine_similarity(a, b) for b in anchor_embeddings] for a in option_embeddings]
58
  output = [{"similarity": s} for s in similarity]
experiments/baseline_fasttext_zeroshot.py CHANGED
@@ -31,14 +31,14 @@ def cosine_similarity(a, b):
31
 
32
 
33
  # load dataset
34
- data = load_dataset("cardiffnlp/relentless_full", split="test")
35
  full_result = []
36
  os.makedirs("./experiments/results/word_embedding/fasttext_zeroshot", exist_ok=True)
37
  scorer = None
38
  for d in data:
39
  ppl_file = f"experiments/results/word_embedding/fasttext_zeroshot/ppl.{d['relation_type'].replace(' ', '_').replace('/', '__')}.jsonl"
40
 
41
- anchor_embeddings = [(a, b) for a, b in d['positive_examples']]
42
  option_embeddings = [(x, y) for x, y in d['pairs']]
43
 
44
  if not os.path.exists(ppl_file):
 
31
 
32
 
33
  # load dataset
34
+ data = load_dataset("cardiffnlp/relentless", split="test")
35
  full_result = []
36
  os.makedirs("./experiments/results/word_embedding/fasttext_zeroshot", exist_ok=True)
37
  scorer = None
38
  for d in data:
39
  ppl_file = f"experiments/results/word_embedding/fasttext_zeroshot/ppl.{d['relation_type'].replace(' ', '_').replace('/', '__')}.jsonl"
40
 
41
+ anchor_embeddings = [(a, b) for a, b in d['prototypical_examples']]
42
  option_embeddings = [(x, y) for x, y in d['pairs']]
43
 
44
  if not os.path.exists(ppl_file):
experiments/baseline_oracle.py CHANGED
@@ -2,7 +2,7 @@ from statistics import mean
2
  import pandas as pd
3
  from datasets import load_dataset
4
 
5
- data = load_dataset("cardiffnlp/relentless_full", split='test')
6
 
7
  cor = []
8
  for d in data:
 
2
  import pandas as pd
3
  from datasets import load_dataset
4
 
5
+ data = load_dataset("cardiffnlp/relentless", split='test')
6
 
7
  cor = []
8
  for d in data: