Skip to content

Commit e418785

Browse files
committed
retreat least selection choose | increase timeout | config
1 parent 9cc5f51 commit e418785

File tree

4 files changed

+31
-17
lines changed

4 files changed

+31
-17
lines changed

src/Nncase.EGraph/Passes/EGraphExtensions.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,14 @@ public static BaseExpr Extract(this IEGraph eGraph, EClass root, CompileOptions
4747
var costModel = new CostModel.EGraphCostEvaluator(root.Find(), compileOptions, basefunc_cost_evaluator, false).Evaluate();
4848

4949
// switch to smoothe (need to do : choose 1 from 2 by inheriting the same interface)
50-
return new SmoothEExtractor(compileOptions, costModel).Extract(root.Find(), eGraph, constrains ?? Array.Empty<EGraphExtractConstrains>());
50+
// var in_expr = new SmoothEExtractor(compileOptions, costModel).Extract(root.Find(), eGraph, constrains ?? Array.Empty<EGraphExtractConstrains>());
5151

52-
// return new EGraphExtractor(costModel).Extract(root.Find(), eGraph, constrains ?? Array.Empty<EGraphExtractConstrains>());
52+
// // first soft in smoothe, next hard in cp-sat
53+
// var in_egraph = new EGraph();
54+
// var root_new = in_egraph.Add(in_expr);
55+
// in_egraph.Rebuild();
56+
// var costModel1 = new CostModel.EGraphCostEvaluator(root_new.Find(), compileOptions, basefunc_cost_evaluator, false).Evaluate();
57+
// return new EGraphExtractor(costModel1).Extract(root_new.Find(), in_egraph, constrains ?? Array.Empty<EGraphExtractConstrains>());
58+
return new EGraphExtractor(costModel).Extract(root.Find(), eGraph, constrains ?? Array.Empty<EGraphExtractConstrains>());
5359
}
5460
}

src/Nncase.EGraph/Passes/SmoothEExtractor.cs

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ public BaseExpr Extract(EClass root, IEGraph eGraph, EGraphExtractConstrains[] c
194194
proc.BeginOutputReadLine();
195195
proc.BeginErrorReadLine();
196196

197-
bool finished = proc.WaitForExit((int)TimeSpan.FromMinutes(15).TotalMilliseconds);
197+
bool finished = proc.WaitForExit((int)TimeSpan.FromMinutes(60).TotalMilliseconds);
198198
if (!finished)
199199
{
200200
try
@@ -238,14 +238,22 @@ public BaseExpr Extract(EClass root, IEGraph eGraph, EGraphExtractConstrains[] c
238238
// rescued by recursive search the whole dir
239239
if (foundSelection is null)
240240
{
241-
var cand = new DirectoryInfo(smootheRepoDir)
242-
.EnumerateFiles("*_selection.json", SearchOption.AllDirectories)
243-
.OrderByDescending(f => f.LastWriteTimeUtc)
244-
.FirstOrDefault();
245-
if (cand is not null)
246-
{
247-
foundSelection = cand.FullName;
248-
}
241+
// var cand = new DirectoryInfo(smootheRepoDir)
242+
// .EnumerateFiles("full_layer_selection.json", SearchOption.AllDirectories)
243+
// .OrderByDescending(f => f.LastWriteTimeUtc)
244+
// .FirstOrDefault();
245+
// if (cand is not null)
246+
// {
247+
// foundSelection = cand.FullName;
248+
// // throw new FileNotFoundException(
249+
// // $"SmoothE selection file use existed: '{foundSelection}'.\n" +
250+
// // "Searched locations:\n" +
251+
// // string.Join(Environment.NewLine, candidateSelectionPaths));
252+
// }
253+
throw new FileNotFoundException(
254+
$"SmoothE selection file not find: '{selectionFileName}'.\n" +
255+
"Searched locations:\n" +
256+
string.Join(Environment.NewLine, candidateSelectionPaths));
249257
}
250258

251259
// no method is valid, throw error

tests/config.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,12 @@ args = 'tests/llm/prompt.txt'
120120
[target]
121121

122122
[target.cpu]
123-
eval = true
124-
infer = true
123+
eval = false
124+
infer = false
125125
similarity_name = 'cosine'
126126

127127
[target.cpu.mode.noptq]
128-
enabled = true
128+
enabled = false
129129
threshold = 0.999
130130

131131
[target.cpu.mode.ptq]
@@ -164,7 +164,7 @@ enabled = true
164164
threshold = 0.96
165165

166166
[target.xpu]
167-
eval = false
167+
eval = true
168168
infer = true
169169
similarity_name = 'cosine'
170170

@@ -173,7 +173,7 @@ enabled = true
173173
threshold = 0.999
174174

175175
[target.xpu.mode.ptq]
176-
enabled = false
176+
enabled = true
177177
threshold = 0.9
178178

179179
[target.xpu.target_options]

tests/importer/huggingface_/test_qwen2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def test_qwen2(request):
3030
[huggingface_options]
3131
output_logits = true
3232
output_hidden_states = false
33-
num_layers = 1
33+
num_layers = -1
3434
3535
[generator]
3636
[generator.inputs]

0 commit comments

Comments
 (0)