beautified ipynb outupt, removed stderr cells

This commit is contained in:
NT 2022-09-06 10:17:40 +02:00
parent a3593f0efa
commit 680aa60719
7 changed files with 842 additions and 933 deletions

View File

@ -42,11 +42,6 @@
"Downloading training data (300MB), this can take a few minutes the first time...\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": []
},
{
"name": "stdout",
"output_type": "stream",
@ -405,11 +400,6 @@
"outputId": "13c2ada4-79bf-42f7-f2f9-4355c0173fb0"
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": []
},
{
"name": "stdout",
"output_type": "stream",
@ -1134,4 +1124,4 @@
},
"nbformat": 4,
"nbformat_minor": 1
}
}

View File

@ -116,7 +116,7 @@
{
"data": {
"text/plain": [
"(inflow_locᵇ=4, xˢ=32, yˢ=40)"
"(inflow_loc\u1d47=4, x\u02e2=32, y\u02e2=40)"
]
},
"execution_count": 2,
@ -253,7 +253,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Velocity dimensions: (inflow_locᵇ=4, xˢ=32, yˢ=40, vectorᶜ=x,y)\n"
"Velocity dimensions: (inflow_loc\u1d47=4, x\u02e2=32, y\u02e2=40, vector\u1d9c=x,y)\n"
]
}
],
@ -295,20 +295,12 @@
"outputId": "93dae39b-1b31-429a-cf81-f615e23bbf7d"
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/Users/thuerey/miniconda3/envs/tf/lib/python3.8/site-packages/IPython/core/interactiveshell.py:3427: SyntaxWarning: Specifying wrt by position is deprecated in phi.math.funcitonal_gradient() and phi.math.jacobian(). Please pass a list or comma-separated string of parameter names.\n",
" exec(code_obj, self.user_global_ns, self.user_ns)\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Some gradient info: StaggeredGrid[(inflow_locᵇ=4, xˢ=32, yˢ=40, vectorᶜ=x,y), size=\u001b[94m(x=32, y=40)\u001b[0m \u001b[93mint64\u001b[0m, extrapolation=\u001b[94m0\u001b[0m]\n",
"\u001b[92m(xˢ=31, yˢ=40)\u001b[0m \u001b[94m2.61e-08 ± 8.5e-01\u001b[0m \u001b[37m(-2e+01...1e+01)\u001b[0m\n"
"Some gradient info: StaggeredGrid[(inflow_loc\u1d47=4, x\u02e2=32, y\u02e2=40, vector\u1d9c=x,y), size=\u001b[94m(x=32, y=40)\u001b[0m \u001b[93mint64\u001b[0m, extrapolation=\u001b[94m0\u001b[0m]\n",
"\u001b[92m(x\u02e2=31, y\u02e2=40)\u001b[0m \u001b[94m2.61e-08 \u00b1 8.5e-01\u001b[0m \u001b[37m(-2e+01...1e+01)\u001b[0m\n"
]
}
],
@ -679,4 +671,4 @@
},
"nbformat": 4,
"nbformat_minor": 1
}
}

View File

@ -158,7 +158,7 @@
"id": "RY1F4kdWPLNG"
},
"source": [
"Also let's get installing / importing all the necessary libraries out of the way. And while we're at it, we set the random seed - obviously, 42 is the ultimate choice here 🙂"
"Also let's get installing / importing all the necessary libraries out of the way. And while we're at it, we set the random seed - obviously, 42 is the ultimate choice here \ud83d\ude42"
]
},
{
@ -622,21 +622,6 @@
"outputId": "9e95aa79-6124-4e30-baf1-28bc37801b0f"
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"<ipython-input-10-594cd5e5046a>:10: FutureWarning: Domain (phi.physics._boundaries) is deprecated and will be removed in a future release.\n",
"Please create grids directly, replacing the domain with a dict, e.g.\n",
" domain = dict(x=64, y=128, bounds=Box(x=1, y=1))\n",
" grid = CenteredGrid(0, **domain)\n",
" from phi.physics._boundaries import Domain, OPEN, STICKY as CLOSED\n",
"<ipython-input-10-594cd5e5046a>:17: DeprecationWarning: Domain is deprecated and will be removed in a future release. Use a dict instead, e.g. CenteredGrid(values, extrapolation, **domain_dict)\n",
" domain = phi.physics._boundaries.Domain(y=source_res[0], x=source_res[1], boundaries=boundary_conditions, bounds=Box(y=2*simulation_length, x=simulation_length))\n",
"<ipython-input-10-594cd5e5046a>:17: FutureWarning: Domain is deprecated and will be removed in a future release. Use a dict instead, e.g. CenteredGrid(values, extrapolation, **domain_dict)\n",
" domain = phi.physics._boundaries.Domain(y=source_res[0], x=source_res[1], boundaries=boundary_conditions, bounds=Box(y=2*simulation_length, x=simulation_length))\n"
]
},
{
"name": "stdout",
"output_type": "stream",
@ -864,7 +849,6 @@
"epoch 003/005, batch 001/002, step 0401/0496: loss=\u001b[94m4.7433133\u001b[0m\n",
"epoch 004/005, batch 001/002, step 0401/0496: loss=\u001b[94m4.522671\u001b[0m\n",
"epoch 005/005, batch 001/002, step 0401/0496: loss=\u001b[94m2.0179803\u001b[0m\n",
"WARNING:tensorflow:Compiled the loaded model, but the compiled metrics have yet to be built. `model.compile_metrics` will be empty until you train or evaluate the model.\n",
"Training done, saved NN\n"
]
}
@ -997,7 +981,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Reynolds numbers in test data set: \u001b[94m(120000.000, 480000.000, 1920000.000, 7680000.000)\u001b[0m along \u001b[92mbatch\u001b[0m\n"
"Reynolds numbers in test data set: \u001b[94m(120000.000, 480000.000, 1920000.000, 7680000.000)\u001b[0m along \u001b[92mbatch\u1d47\u001b[0m\n"
]
}
],
@ -1389,4 +1373,4 @@
},
"nbformat": 4,
"nbformat_minor": 1
}
}

View File

@ -21,11 +21,15 @@ fileList = [
]
#fileList = [ "physgrad-code.ipynb"] # debug, only 1 file
#fileList = [ "t1.ipynb" ] # debug
# main
for fnOut in fileList:
if not os.path.isfile(fnOut):
print("Error: "+fnOut+" not found!"); exit(1)
# create backups
fn0 = fnOut[:-5] + "bak"
fn = fn0 + "0"; cnt = 0
@ -47,6 +51,7 @@ for fnOut in fileList:
#print(d.keys()) #print(d["cells"][0].keys())
# remove TF / pytorch warnings, build list of regular expressions to search for
# double check, redundant with removing stderr cells (cf delE)
res = []
res.append( re.compile(r"WARNING:tensorflow:") )
res.append( re.compile(r"UserWarning:") )
@ -90,16 +95,26 @@ for fnOut in fileList:
deletes = deletes+1
#print( d[t][i]["source"][j] +"\n >>> \n" +d2 )
delE = [] # collect whole entries (sections) to delete
#print(len( d[t][i]["outputs"] ))
for j in range(len( d[t][i]["outputs"] )):
#print(type( d[t][i]["outputs"][j] ))
#print( d[t][i]["outputs"][j].keys() )
# search for error stderr cells
if d[t][i]["outputs"][j]["output_type"]=="stream":
#print("output j name: "+ format( d[t][i]["outputs"][j]["name"] ) )
#print("output j: "+ format( d[t][i]["outputs"][j] ) )
if d[t][i]["outputs"][j]["name"]=="stderr":
print("stderr found! len text "+ format(len( d[t][i]["outputs"][j]["text"]) ) +", removing entry "+format(j) )
delE.append(j) # remove the whole stderr entry
# images
if d[t][i]["outputs"][j]["output_type"]=="stream":
#print("len "+ len( d[t][i]["outputs"][j]["text"] ) )
#print("len "+ format(len( d[t][i]["outputs"][j]["text"] )) )
dell = [] # collect entries to delete
dell = [] # collect lines to delete
for k in range( len( d[t][i]["outputs"][j]["text"] ) ):
#print(" tout "+ d[t][i]["outputs"][j]["text"][k] ) # debug , print all lines
nums = []; all_good = True
@ -117,8 +132,17 @@ for fnOut in fileList:
for dl in dell:
d[t][i]["outputs"][j]["text"].remove(dl)
#print("len after "+format( len( d[t][i]["outputs"][j]["text"] )) + " A") # debug
#print("len after "+format( len( d[t][i]["outputs"][j]["text"] )) + " A") # debug
# afterwards (potentially remove whole entries)
# if len(delE)>0:
# print("len bef "+format( len( d[t][i]["outputs"] )) + " A " + format(delE)) # debug
for de in delE:
#print(type(d[t][i]["outputs"])); print(de)
d[t][i]["outputs"].pop(de) # remove array element
deletes+=1
# if len(delE)>0:
# print("len after "+format( len( d[t][i]["outputs"] )) + " A") # debug
if deletes==0:
print("Warning: Nothing found in "+fn+"!")

View File

@ -363,11 +363,6 @@
"outputId": "4d938ed4-484b-46df-d0ca-d2268cb97dd0"
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": []
},
{
"name": "stdout",
"output_type": "stream",
@ -413,11 +408,6 @@
}
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": []
},
{
"name": "stdout",
"output_type": "stream",
@ -615,4 +605,4 @@
},
"nbformat": 4,
"nbformat_minor": 0
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long