Text Generation
PEFT
Safetensors
English
pyspark
data-engineering
code-generation
qlora
lora
delta-lake
conversational
Instructions to use hoodarunner/pyspark-coding-assistant-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use hoodarunner/pyspark-coding-assistant-lora with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("mistralai/Mistral-7B-Instruct-v0.3") model = PeftModel.from_pretrained(base_model, "hoodarunner/pyspark-coding-assistant-lora") - Notebooks
- Google Colab
- Kaggle
| id: null_sum_all_null_group | |
| category: nulls_types | |
| difficulty: medium | |
| probes: > | |
| sum() over a group where every value is NULL returns NULL, not 0. The fix is | |
| coalesce after the aggregate, not before -- coalescing before changes the | |
| average and the count. Models very often emit sum(coalesce(x,0)) which is a | |
| different query that happens to agree here but not on avg. | |
| tags: [null_semantics, sum, coalesce] | |
| prompt: | | |
| For each region in `readings`, return the sum of `value` as `total`, but | |
| report 0 rather than null when the region has no non-null values at all. | |
| `total` must be a LONG (BIGINT) column. | |
| Return columns: region, total. | |
| fixtures: | |
| - name: readings | |
| schema: region STRING, value INT | |
| rows: | |
| - ["north", 5] | |
| - ["north", null] | |
| - ["north", 7] | |
| - ["south", null] | |
| - ["south", null] | |
| - ["east", 3] | |
| solution: | | |
| from pyspark.sql import functions as F | |
| def solve(spark, readings): | |
| # sum() ignores NULLs; an all-NULL group aggregates to NULL, so the | |
| # coalesce has to sit outside the aggregate. | |
| return ( | |
| readings | |
| .groupBy("region") | |
| .agg(F.coalesce(F.sum("value"), F.lit(0)).cast("long").alias("total")) | |
| ) | |
| compare: | |
| mode: rows | |