Skip to content

Commit

Permalink
needle env
Browse files Browse the repository at this point in the history
  • Loading branch information
cjGO committed Aug 6, 2024
1 parent 8ebc920 commit c8b48ca
Show file tree
Hide file tree
Showing 9 changed files with 5,479 additions and 972 deletions.
973 changes: 973 additions & 0 deletions dev_nbs/.~Breeder_Agent-Copy1.ipynb

Large diffs are not rendered by default.

1,178 changes: 1,178 additions & 0 deletions dev_nbs/.~Breeder_Agent.ipynb

Large diffs are not rendered by default.

130 changes: 27 additions & 103 deletions dev_nbs/Breeder_Agent-Copy1.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,10 @@
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"id": "eb3311cb",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"2024-08-01 00:01:19.578048: E external/local_xla/xla/stream_executor/cuda/cuda_dnn.cc:9261] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered\n",
"2024-08-01 00:01:19.578128: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:607] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered\n",
"2024-08-01 00:01:19.579672: E external/local_xla/xla/stream_executor/cuda/cuda_blas.cc:1515] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered\n",
"2024-08-01 00:01:19.588120: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.\n",
"To enable the following instructions: AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.\n",
"2024-08-01 00:01:20.882502: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"stable_baselines3 is already installed.\n",
"torch is already installed.\n",
"matplotlib is already installed.\n",
"gdown is already installed.\n"
]
}
],
"outputs": [],
"source": [
"import importlib\n",
"import subprocess\n",
Expand All @@ -55,18 +32,10 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"id": "7e1a4ceb",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"cuda\n"
]
}
],
"outputs": [],
"source": [
"import torch\n",
"from typing import Optional, Dict\n",
Expand All @@ -90,25 +59,17 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"id": "19305afc",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"/notebooks\n"
]
}
],
"outputs": [],
"source": [
"!pwd"
]
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": null,
"id": "d7d8595d",
"metadata": {},
"outputs": [],
Expand All @@ -133,22 +94,10 @@
},
{
"cell_type": "code",
"execution_count": 101,
"execution_count": null,
"id": "bf42a592",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Initial phenotype mean after trait initialization: 10.083398818969727\n",
"Initial phenotype mean after trait initialization: 10.083398818969727\n",
"CPU simulation time: 2.05 seconds\n",
"CUDA simulation time: 0.05 seconds\n",
"Speedup: 37.97x\n"
]
}
],
"outputs": [],
"source": [
"\n",
"## BREEDING SIMULATOR\n",
Expand Down Expand Up @@ -487,7 +436,7 @@
},
{
"cell_type": "code",
"execution_count": 124,
"execution_count": null,
"id": "7489091d",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -516,7 +465,7 @@
},
{
"cell_type": "code",
"execution_count": 150,
"execution_count": null,
"id": "5d7cde46",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -642,25 +591,10 @@
},
{
"cell_type": "code",
"execution_count": 151,
"execution_count": null,
"id": "11f18d16",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Initial phenotype mean after trait initialization: 10.083398818969727\n",
"Action Space Discrete\n",
"Selection Intensities: [0.01 0.26 0.5 ]\n",
"Budgets: [10. 20. 30.]\n",
"Initial phenotype mean after trait initialization: 10.083398818969727\n",
"Action Space Discrete\n",
"Selection Intensities: [0.01 0.26 0.5 ]\n",
"Budgets: [10. 20. 30.]\n"
]
}
],
"outputs": [],
"source": [
"cuda_sim = create_sim_instance(torch.device('cuda')) if torch.cuda.is_available() else None\n",
"cuda_be = EnvBasic(config, cuda_sim)\n",
Expand All @@ -673,32 +607,10 @@
},
{
"cell_type": "code",
"execution_count": 154,
"execution_count": null,
"id": "f8a030c2",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Action Space Discrete\n",
"Selection Intensities: [0.01 0.26 0.5 ]\n",
"Budgets: [10. 20. 30.]\n"
]
},
{
"data": {
"text/plain": [
"(array([ 1.9657166e-01, 6.2285286e-01, -3.7804082e-02, 1.5790001e-01,\n",
" 6.0000000e+00, 1.2000000e+03], dtype=float32),\n",
" {})"
]
},
"execution_count": 154,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"config.si_bins = 3\n",
"config.budget_bins = 3\n",
Expand All @@ -720,6 +632,18 @@
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.7"
}
},
"nbformat": 4,
Expand Down
Loading

0 comments on commit c8b48ca

Please sign in to comment.