-
Notifications
You must be signed in to change notification settings - Fork 93
Closed
Description
Describe the bug
Throwing AttributeError: 'NoneType' object has no attribute 'split' when trying to mk_truss
To Reproduce
Directly taken from "Quickstart: making a truss"
...
rfc.fit(data_x, data_y)
# Create the Truss (serializing & packaging model)
tr = truss.mk_truss(rfc, target_directory="iris_rfc_truss") # this line fails
...
Expected behavior
Expected to see working sample
Screenshots/Logs
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[149], line 15
12 rfc.fit(data_x, data_y)
14 # Create the Truss (serializing & packaging model)
---> 15 tr = truss.mk_truss(rfc, target_directory="iris_rfc_truss")
17 # Serve a prediction from the model
18 # tr.server_predict({"inputs": [[0, 0, 0, 0]]})
File ~/.virtualenvs/datasciense/lib/python3.8/site-packages/truss/build.py:267, in mk_truss(model, target_directory, data_files, requirements_file, bundled_packages)
257 def mk_truss(
258 model: Any,
259 target_directory: str = None,
(...)
264 # Some model objects can are callable (like Keras models)
265 # so we first attempt to make Truss via a model object
--> 267 model_scaffold = mk_truss_from_model_with_exception_handler(
268 model, target_directory, data_files, requirements_file, bundled_packages
269 )
270 if model_scaffold:
271 return model_scaffold
File ~/.virtualenvs/datasciense/lib/python3.8/site-packages/truss/build.py:203, in mk_truss_from_model_with_exception_handler(*args)
200 def mk_truss_from_model_with_exception_handler(*args):
201 # returns None if framework not supported, otherwise the Truss
202 try:
--> 203 return mk_truss_from_model(*args)
204 except FrameworkNotSupportedError:
205 return None
File ~/.virtualenvs/datasciense/lib/python3.8/site-packages/truss/build.py:99, in mk_truss_from_model(model, target_directory, data_files, requirements_file, bundled_packages)
97 else:
98 target_directory_path = Path(target_directory)
---> 99 model_framework.to_truss(model, target_directory_path)
100 scaf = TrussHandle(target_directory_path)
101 _update_truss_props(scaf, data_files, requirements_file, bundled_packages)
File ~/.virtualenvs/datasciense/lib/python3.8/site-packages/truss/model_framework.py:69, in ModelFramework.to_truss(self, model, target_directory)
61 python_version = map_to_supported_python_version(infer_python_version())
63 # Create config
64 config = TrussConfig(
65 model_name=self.model_name(model),
66 model_type=self.model_type(model),
67 model_framework=self.typ(),
68 model_metadata=self.model_metadata(model),
---> 69 requirements=self.requirements_txt(),
70 python_version=python_version,
71 )
72 with (target_directory / CONFIG_FILE).open("w") as config_file:
73 yaml.dump(config.to_dict(), config_file)
File ~/.virtualenvs/datasciense/lib/python3.8/site-packages/truss/model_framework.py:29, in ModelFramework.requirements_txt(self)
27 def requirements_txt(self) -> List[str]:
---> 29 return list(infer_deps(must_include_deps=self.required_python_depedencies()))
File ~/.virtualenvs/datasciense/lib/python3.8/site-packages/truss/environment_inference/requirements_inference.py:44, in infer_deps(must_include_deps)
41 if not must_include_deps:
42 must_include_deps = set()
---> 44 pkg_candidates = _extract_packages_from_frame(relevant_stack[0].frame)
45 imports = must_include_deps.union(pkg_candidates)
46 requirements = set([])
File ~/.virtualenvs/datasciense/lib/python3.8/site-packages/truss/environment_inference/requirements_inference.py:98, in _extract_packages_from_frame(frame)
96 pkg_name = val.__name__.split(".")[0]
97 elif hasattr(val, "__module__"):
---> 98 pkg_name = val.__module__.split(".")[0]
99 else:
100 continue
AttributeError: 'NoneType' object has no attribute 'split'
Desktop (please complete the following information):
- OS: Linux 5+
- Environment versions: python 3.8.12, sklearn 1.1.3 with poetry 1.3.1
- Truss version: 0.1.12
Additional context
Nothing
Metadata
Metadata
Assignees
Labels
No labels