-
-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: ⚡ Add CLI command to convert and push JSONL to Huggingface (#1436)
* feat: ⚡ Add CLI command to convert and push JSON to Huggingface * feat: 🎨 Add unittests and fix bugs * feat: 🔥 Optimize DuckDB query + Enqueue job (WIP) * fix: 🔖 Fix enqueue job + Better logging and error handling * refactor: 🎨 Update sql query: {feature}_tags instead of {feature} * fix: 🐛 Remove timer on * fix: 🐛 Remove enqueue job NEw spec: we only use the CLI command for testing. The JSONL conversion will be handled in a scheduled job instead * feat: 🎨 Add possibility to convert the dataset locally * fix: 🐛 poetry lock --no-update after merge conflict resolution * fix: 🔥 Improve performances + push to hub fixed + ingredients_text_{lang} added * fix: 🐛 Bug with threading fixed * style: 🎨 Black
- Loading branch information
1 parent
ef0f861
commit d68a231
Showing
7 changed files
with
245 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
SET threads to 4; | ||
SET preserve_insertion_order = false; | ||
COPY ( | ||
SELECT | ||
code, | ||
additives_n, | ||
additives_tags, | ||
allergens_from_ingredients, | ||
allergens_from_user, | ||
allergens_tags, | ||
brands_tags, | ||
categories_properties_tags, | ||
categories, | ||
checkers_tags, | ||
cities_tags, | ||
compared_to_category, | ||
complete, | ||
completeness, | ||
correctors_tags, | ||
countries_imported, | ||
countries_tags, | ||
creator, | ||
data_sources_tags, | ||
ecoscore_data, | ||
ecoscore_score, | ||
ecoscore_tags, | ||
editors, | ||
emb_code, | ||
emb_codes, | ||
entry_dates_tags, | ||
environment_impact_level, | ||
food_groups_tags, | ||
forest_footprint_data, | ||
generic_name, | ||
grades, | ||
id, | ||
images, | ||
informers_tags, | ||
ingredients_analysis_tags, | ||
ingredients_from_palm_oil_n, | ||
ingredients_n, | ||
ingredients_text_with_allergens, | ||
ingredients_text, | ||
COLUMNS('ingredients_text_\w{2}$'), | ||
ingredients_with_specified_percent_n, | ||
ingredients_with_unspecified_percent_n, | ||
ciqual_food_name_tags, | ||
ingredients_percent_analysis, | ||
ingredients_original_tags, | ||
ingredients_without_ciqual_codes_n, | ||
ingredients_without_ciqual_codes, | ||
ingredients, | ||
known_ingredients_n, | ||
labels_tags, | ||
lang, | ||
languages_tags, | ||
languages_codes, | ||
last_edit_dates_tags, | ||
last_editor, | ||
last_modified_by, | ||
last_updated_t, | ||
link, | ||
main_countries_tags, | ||
manufacturing_places, | ||
max_imgid, | ||
misc_tags, | ||
minerals_tags, | ||
new_additives_n, | ||
nova_groups_markers, | ||
nova_groups_tags, | ||
nucleotides_tags, | ||
nutrient_levels_tags, | ||
unknown_nutrients_tags, | ||
nutriments, | ||
nutriscore_data, | ||
nutriscore_score, | ||
nutriscore_tags, | ||
nutrition_data_prepared_per, | ||
nutrition_data, | ||
nutrition_grades_tags, | ||
nutrition_score_beverage, | ||
nutrition_score_warning_fruits_vegetables_nuts_estimate_from_ingredients, | ||
nutrition_score_warning_no_fiber, | ||
nutrition_score_warning_no_fruits_vegetables_nuts, | ||
obsolete_since_date, | ||
obsolete, | ||
origins, | ||
owner_fields, | ||
packaging_recycling_tags, | ||
packaging_shapes_tags, | ||
packaging_tags, | ||
packagings_materials, | ||
packagings_n, | ||
packagings_n, | ||
photographers, | ||
pnns_groups_1_tags | ||
pnns_groups_2_tags, | ||
popularity_key, | ||
popularity_tags, | ||
product_name, | ||
product_quantity_unit, | ||
product_quantity, | ||
purchase_places_tags, | ||
quantity, | ||
rev, | ||
scans_n, | ||
scores, | ||
serving_quantity, | ||
serving_size, | ||
sources, | ||
sources_fields, | ||
specific_ingredients, | ||
states_tags, | ||
stores, | ||
traces_tags, | ||
unique_scans_n, | ||
unknown_ingredients_n, | ||
vitamins_tags, | ||
weighers_tags, | ||
with_non_nutritive_sweeteners, | ||
with_sweeteners, | ||
FROM read_ndjson('{dataset_path}', ignore_errors=True) | ||
) TO '{output_path}' (FORMAT PARQUET) | ||
; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters