Skip to content

Commit 26af2d5

Browse files
fix?
1 parent bcd2921 commit 26af2d5

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

extensions/HuggingFace/python/src/aiconfig_extension_hugging_face/local_inference/text_translation.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,12 +240,13 @@ async def run_inference(self, prompt: Prompt, aiconfig: "AIConfigRuntime", optio
240240

241241
model_name: str = aiconfig.get_model_name(prompt)
242242
if isinstance(model_name, str) and model_name not in self.translators:
243-
self.translators[model_name] = pipeline(model_name)
243+
self.translators[model_name] = pipeline("translation_en_to_fr")
244244
translator = self.translators[model_name]
245245

246246
# if stream enabled in runtime options and config, then stream. Otherwise don't stream.
247247
streamer = None
248248
should_stream = (options.stream if options else False) and (not "stream" in completion_data or completion_data.get("stream") != False)
249+
should_stream = False
249250
if should_stream:
250251
raise NotImplementedError("Streaming is not supported for HuggingFace Text Translation")
251252

python/src/aiconfig/editor/server/server_utils.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
LOGGER.addHandler(log_handler)
3535

3636
# TODO unhardcode
37-
LOGGER.setLevel(logging.INFO)
37+
LOGGER.setLevel(logging.DEBUG)
3838

3939

4040
UnvalidatedPath = NewType("UnvalidatedPath", str)
@@ -123,20 +123,26 @@ def get_validated_path(raw_path: str | None, allow_create: bool = False) -> Resu
123123

124124
def _import_module_from_path(path_to_module: str) -> Result[ModuleType, str]:
125125
LOGGER.debug(f"{path_to_module=}")
126+
print(f"{path_to_module=}")
126127
resolved_path = resolve_path(path_to_module)
127128
LOGGER.debug(f"{resolved_path=}")
128129
module_name = os.path.basename(resolved_path).replace(".py", "")
129130

130131
try:
132+
LOGGER.debug(f"running spec_from_file_location({module_name}, {resolved_path})")
131133
spec = importlib.util.spec_from_file_location(module_name, resolved_path)
132134
if spec is None:
133135
return Err(f"Could not import module from path: {resolved_path}")
134136
elif spec.loader is None:
135137
return Err(f"Could not import module from path: {resolved_path} (no loader)")
136138
else:
139+
LOGGER.debug(f"{spec=}")
137140
module = importlib.util.module_from_spec(spec)
141+
LOGGER.debug(f"{module=}")
138142
sys.modules[module_name] = module
139-
spec.loader.exec_module(module)
143+
exec_module_result = spec.loader.exec_module(module)
144+
LOGGER.debug(f"{exec_module_result=}")
145+
LOGGER.debug(f"{module=}")
140146
return Ok(module)
141147
except Exception as e:
142148
return core_utils.ErrWithTraceback(e)

0 commit comments

Comments
 (0)