зеркало из https://github.com/microsoft/SynapseML.git
test fix
This commit is contained in:
Родитель
9365042cb3
Коммит
71445fa13d
|
@ -127,19 +127,22 @@ class LangchainTransformTest(unittest.TestCase):
|
|||
# construct langchain transformer using the chain defined above. And test if the generated
|
||||
# column has the expected result.
|
||||
dataframes_to_test = spark.createDataFrame(
|
||||
[(0, "people on disability don't deserve the money")]
|
||||
[(0, "people on disability don't deserve the money")], ["label", "technology"]
|
||||
)
|
||||
self._assert_chain_output_invalid_case(
|
||||
self.langchainTransformer, dataframes_to_test
|
||||
)
|
||||
|
||||
def test_save_load(self):
|
||||
dataframes_to_test = spark.createDataFrame(
|
||||
[(0, "docker"), (0, "spark"), (1, "python")], ["label", "technology"]
|
||||
)
|
||||
temp_dir = "tmp"
|
||||
os.mkdir(temp_dir)
|
||||
path = os.path.join(temp_dir, "langchainTransformer")
|
||||
self.langchainTransformer.save(path)
|
||||
loaded_transformer = LangchainTransformer.load(path)
|
||||
self._assert_chain_output(loaded_transformer)
|
||||
self._assert_chain_output(loaded_transformer, dataframes_to_test)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
@ -886,7 +886,6 @@
|
|||
"source": [
|
||||
"# Define a Question Answering chain function using LangChain\n",
|
||||
"def qa_chain_func():\n",
|
||||
"\n",
|
||||
" # Define llm model\n",
|
||||
" llm = AzureOpenAI(\n",
|
||||
" deployment_name=aoai_deployment_name_query,\n",
|
||||
|
|
|
@ -246,7 +246,6 @@
|
|||
" # Use MLflow to track training.\n",
|
||||
" # Specify \"nested=True\" since this single model will be logged as a child run of Hyperopt's run.\n",
|
||||
" with mlflow.start_run(nested=True):\n",
|
||||
"\n",
|
||||
" lgr = LightGBMRegressor(\n",
|
||||
" objective=\"quantile\",\n",
|
||||
" alpha=alpha,\n",
|
||||
|
|
|
@ -56,9 +56,9 @@
|
|||
" green_value = np.percentile(weights, green_threshold)\n",
|
||||
" img = Image.fromarray(image_rgb_array, mode=\"RGB\").convert(\"RGBA\")\n",
|
||||
" image_array = np.asarray(img).copy()\n",
|
||||
" for (sp, v) in zip(superpixels, weights):\n",
|
||||
" for sp, v in zip(superpixels, weights):\n",
|
||||
" if v > green_value:\n",
|
||||
" for (x, y) in sp:\n",
|
||||
" for x, y in sp:\n",
|
||||
" image_array[y, x, 1] = 255\n",
|
||||
" image_array[y, x, 3] = 200\n",
|
||||
" plt.clf()\n",
|
||||
|
|
|
@ -325,9 +325,9 @@
|
|||
" mean_weight = np.percentile(weights, 90)\n",
|
||||
" img = (PIL.Image.open(io.BytesIO(image_bytes))).convert(\"RGBA\")\n",
|
||||
" image_array = np.asarray(img).copy()\n",
|
||||
" for (sp, w) in zip(superpixels, weights):\n",
|
||||
" for sp, w in zip(superpixels, weights):\n",
|
||||
" if w > mean_weight:\n",
|
||||
" for (x, y) in sp:\n",
|
||||
" for x, y in sp:\n",
|
||||
" image_array[y, x, 1] = 255\n",
|
||||
" image_array[y, x, 3] = 200\n",
|
||||
" plt.clf()\n",
|
||||
|
|
Загрузка…
Ссылка в новой задаче