Spaces:
Runtime error
Runtime error
Commit ·
e2fd976
1
Parent(s): 4056c2c
Upd valid output SFT saver
Browse filesFiles changed (2)
- vi/processing.py+10-2
- vi/translator.py+3-1
103 unmodified lines104105106107108109110111112113114115110116117112118119120121122123103 unmodified lines original = sft_data[field] translated = translator.translate_text(original) # Debug logging logger.debug(f"Translation attempt for field '{field}':") logger.debug(f" Original: '{original[:50]}...'") logger.debug(f" Translated: '{translated[:50]}...'") logger.debug(f" Are they the same? {original == translated}") # Validate and sanitize translated field if _validate_vi_translation(original, translated): translated_sft[field] = _vi_sanitize_text(translated) logger.debug(f"Translated field '{field}': '{original[:50]}...' -> '{translated[:50]}...'") logger.debug(f"✅ Successfully translated field '{field}'") else: logger.warning(f"Invalid Vietnamese translation for field {field}, keeping original") logger.warning(f"❌ Invalid Vietnamese translation for field {field}, keeping original") logger.warning(f" Original: '{original[:50]}...'") logger.warning(f" Translated: '{translated[:50]}...'") translated_sft[field] = original except Exception as e: logger.error(f"Failed to translate field '{field}': {e}")126 unmodified lines127128129130130131132133134135126 unmodified lines # Decode translated = self.tokenizer.decode(outputs[0], skip_special_tokens=True) logger.debug(f"Translated: '{text[:50]}...' -> '{translated[:50]}...'") logger.debug(f"Translation result: '{text[:50]}...' -> '{translated[:50]}...'") logger.debug(f"Are original and translated the same? {text.strip() == translated.strip()}") return translated.strip() except Exception as e:vi/processing.py+10-2
vi/translator.py+3-1