Skip to content

Commit 4c473cf

Browse files
committed
Merge branch 'develop' of github.com:PaddlePaddle/GraphNet into develop
2 parents 868b686 + 04af35c commit 4c473cf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+39803
-4
lines changed

graph_net/torch/extractor.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ def try_rename_placeholder(node):
6666
"framework": "torch",
6767
"num_devices_required": 1,
6868
"num_nodes_required": 1,
69+
"dynamic": bool(dynamic),
6970
}
7071
with open(os.path.join(model_path, "graph_net.json"), "w") as f:
7172
json.dump(metadata, f, indent=4)

graph_net/torch/utils.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,19 @@ def apply_templates(forward_code: str) -> str:
2323
def get_limited_precision_float_str(value):
2424
if not isinstance(value, float):
2525
return value
26-
if not math.isfinite(value):
27-
return f'float("{value}")'
2826
return f"{value:.3f}"
2927

3028

3129
def convert_state_and_inputs_impl(state_dict, example_inputs):
3230
def tensor_info(tensor):
3331
is_float = tensor.dtype.is_floating_point
3432
mean = float(tensor.mean().item()) if is_float else None
35-
std = float(tensor.std().item()) if is_float else None
33+
std = None
34+
if is_float:
35+
if tensor.numel() <= 1:
36+
std = 0.0
37+
else:
38+
std = float(tensor.std().item())
3639
return {
3740
"shape": list(tensor.shape),
3841
"dtype": str(tensor.dtype),
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
6d8b5686295201d8140f6155bc3bcc52982d4faa5003fdfb34ad62dc3ba93fd2
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"framework": "torch",
3+
"num_devices_required": 1,
4+
"num_nodes_required": 1
5+
}

samples/transformers-auto-model/all-MiniLM-L6-v2/input_meta.py

Whitespace-only changes.

samples/transformers-auto-model/all-MiniLM-L6-v2/input_tensor_constraints.py

Whitespace-only changes.

samples/transformers-auto-model/all-MiniLM-L6-v2/model.py

Lines changed: 883 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)