Skip to content

Commit e702136

Browse files
committed
update
1 parent 6ff2baa commit e702136

File tree

3 files changed

+8
-47
lines changed

3 files changed

+8
-47
lines changed

test/llm/models/test_txt2kg.py

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -83,42 +83,3 @@ def fake_llm_fn(chunk, **kwargs):
8383
assert isinstance(out, list)
8484
assert all(len(t) == 3 for t in out)
8585
os.remove(out_path)
86-
87-
88-
# @onlyOnline
89-
# @withPackage("transformers")
90-
# def test_chunk_to_triples_str_local_no_external_import():
91-
# class FakeLLM:
92-
# def __init__(self, name):
93-
# self.name = name
94-
95-
# def eval(self):
96-
# return self
97-
98-
# def inference(self, question, max_tokens):
99-
# return ["('A','B','C')"]
100-
101-
# fake_module = types.SimpleNamespace(LLM=FakeLLM)
102-
# sys.modules["torch_geometric.nn.nlp"] = fake_module
103-
104-
# model = TXT2KG(local_LM=True)
105-
# out = model._chunk_to_triples_str_local("This is a test text.")
106-
# assert isinstance(out, str)
107-
# assert "A" in out
108-
# assert model.total_chars_parsed > 0
109-
# assert model.time_to_parse > 0
110-
111-
# @onlyOnline
112-
# @withPackage("transformers")
113-
# def test_add_doc_and_save():
114-
# model = TXT2KG(local_LM=True)
115-
116-
# model.add_doc_2_KG("graph knowledge text", QA_pair=("Q1", "A1"))
117-
# assert ("Q1", "A1") in model.relevant_triples
118-
# assert model.relevant_triples[("Q1", "A1")] == [("a", "b", "c")]
119-
120-
# # 保存 + 加载
121-
# save_path = "/tmp/kg.pt"
122-
# model.save_kg(save_path)
123-
# loaded = torch.load(save_path)
124-
# assert loaded["Q1", "A1"] == [("a", "b", "c")]

test/nn/test_model_hub.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,13 @@ def test_save_pretrained_with_push_to_hub(model, tmp_path):
8383
)
8484

8585

86-
# @withPackage('huggingface_hub')
87-
# def test_from_pretrained(model, tmp_path):
88-
# save_directory = f'{str(tmp_path / REPO_NAME)}'
89-
# model.save_pretrained(save_directory)
86+
@withPackage('huggingface_hub')
87+
def test_from_pretrained(model, tmp_path):
88+
save_directory = f'{str(tmp_path / REPO_NAME)}'
89+
model.save_pretrained(save_directory)
9090

91-
# model = model.from_pretrained(save_directory)
92-
# assert isinstance(model, DummyModel)
91+
model = model.from_pretrained(save_directory)
92+
assert isinstance(model, DummyModel)
9393

9494

9595
@withPackage('huggingface_hub')

torch_geometric/nn/model_hub.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,10 @@ def _from_pretrained(
144144
revision,
145145
cache_dir,
146146
force_download,
147-
proxies,
148-
resume_download,
149147
local_files_only,
150148
token,
149+
proxies=None,
150+
resume_download=False,
151151
dataset_name='',
152152
model_name='',
153153
map_location='cpu',

0 commit comments

Comments
 (0)