Self-contained skill for predicting 10 rice agronomic traits via pre-trained MMoE models. All models, data, and scripts are inside this directory — give users this one folder.
bash
python <SKILL_DIR>/scripts/check_env.py
This verifies Python dependencies and data integrity. If packages are missing:
bash
pip install -r <SKILL_DIR>/requirements.txt
Required: torch>=2.0 numpy pandas scikit-learn scipy requests
GPU is optional — CPU works (just slower). If GPU is present, cuda:0 is used automatically.
<SKILL_DIR> convention#Throughout this file, <SKILL_DIR> means the absolute path to this skill's root directory
(the folder containing this SKILL.md). When running commands, substitute with the actual path.
--base_dir is optional; if omitted, scripts auto-detect it from their own location.
CodeChineseEnglishUnitHD抽穗期Heading DatedaysPH株高Plant HeightcmPL穗长Panicle LengthcmTN分蘖数Tiller NumbercountGP每穗粒数Grains Per PaniclecountSSR结实率Seed Setting Rate%TGW千粒重Thousand Grain WeightgGL粒长Grain LengthmmGW粒宽Grain WidthmmY产量Yieldkg/ha
CodeCityLatLonkm昆明25.02102.68gzl六盘水26.59104.83nn南宁22.82108.37wh武汉30.58114.27hf合肥31.82117.25hz杭州30.25120.17th通化41.73125.94
Any input lat/lon is auto-matched to the nearest station via Haversine distance. For locations with internet, daily weather data can also be fetched from NASA POWER API for the exact coordinates.
TypeChineseDefault effecthigh_temp高温胁迫+3°C max / +2°C minlow_temp低温胁迫-3°C max / -2°C mindrought干旱胁迫90% precipitation reductionflood涝害胁迫3x precipitation increaselow_light寡照胁迫60% PAR reduction
bash
python <SKILL_DIR>/scripts/predict.py --lat 30.5 --lon 114.3 --sample sample1
bash
python <SKILL_DIR>/scripts/predict.py --lat 30.5 --lon 114.3 --sample sample1 --mode gene
python <SKILL_DIR>/scripts/predict.py --lat 30.5 --lon 114.3 --sample sample1 --mode env
bash
python <SKILL_DIR>/scripts/predict.py --lat 30.5 --lon 114.3 --sample sample1 --trait PH,Y
bash
python <SKILL_DIR>/scripts/predict.py --lat 30.5 --lon 114.3 --sample sample1 --stress high_temp
python <SKILL_DIR>/scripts/predict.py --lat 30.5 --lon 114.3 --sample sample1 --stress high_temp --stress_delta 5.0
bash
python <SKILL_DIR>/scripts/predict.py --lat 30.5 --lon 114.3 --sample "sample1,sample2,sample3"
bash
python <SKILL_DIR>/scripts/predict.py --lat 30.5 --lon 114.3 --genotype_file /path/to/user_vae.csv
Format: CSV with 1024 columns (VAE-encoded features), first column = sample index.
bash
python <SKILL_DIR>/scripts/predict.py --lat 30.5 --lon 114.3 --sample sample1 --device cpu
python <SKILL_DIR>/scripts/predict.py --lat 30.5 --lon 114.3 --sample sample1 --device cuda:0
bash
python <SKILL_DIR>/scripts/predict.py --lat 30.5 --lon 114.3 --sample sample1 --output table
ArgDefaultDescription--latrequiredLatitude--lonrequiredLongitude--sampleNoneBuilt-in sample ID(s), comma-separated (sample1..sample3925)--genotype_fileNoneCustom 1024-dim VAE CSV path--modefullgene, env, or full``--traitallComma-separated trait codes or all``--stressNoneStress type name--stress_deltaNoneOverride temperature delta--deviceautoauto, cpu, or cuda:0``--year2024Year for environmental data--outputjsonjson or table``--base_dirautoOverride skill directory path
--lat 30.5 --lon 114.3--lat 30.58 --lon 114.27--lat 25 --lon 103--stress high_temp --stress_delta 5.0--sample sample1 (3925 available: sample1..sample3925)--genotype_file /path/to/file.csvJSON contains: location, genotype_prediction, environment_prediction, stress_prediction, trait_info.
Report environment_prediction as primary (has environmental context).
Compare genotype_prediction as baseline.
For stress, compare normal vs stressed values.
Rounding: HD/TN/GP → integer, PH/PL/TGW/SSR → 1 decimal, GL/GW → 2 decimals, Y → integer.
text
rice_prediction/ ← give users this folder
├── SKILL.md ← this file
├── requirements.txt ← pip dependencies
├── data/
│ ├── grid_points.json ← 7 station coordinates
│ ├── vae_features.csv ← 3925 built-in genotype samples (1024-dim VAE)
│ ├── season_history.csv ← historical season data for normalization
│ ├── env_cache/ ← cached daily weather (auto-populated)
│ ├── models_env/ ← 10 trait-specific env+gene models (~4.6MB each)
│ └── models_gene/ ← 7 location-specific genotype models (~8MB each)
└── scripts/
├── predict.py ← main entry point
├── check_env.py ← dependency checker
├── model_def.py ← MMoE model architectures
├── grid_manager.py ← nearest grid point finder
├── env_data_fetcher.py ← NASA POWER API fetcher + cache
├── env_processor.py ← environmental feature engineering
└── stress_simulator.py ← stress scenario simulation