diff --git a/netlify.toml b/netlify.toml index deebe4283..ddcd0ca6c 100644 --- a/netlify.toml +++ b/netlify.toml @@ -2,9 +2,8 @@ redirects = [ # Netlify {from = "https://spacy.netlify.com/*", to="https://spacy.io/:splat", force = true }, # Subdomain for branches - {from = "https://nightly.spacy.io/*", to="https://nightly-spacy-io.spacy.io/:splat", force = true, status = 200}, - # TODO: update this with the v2 branch build once v3 is live (status = 200) - {from = "https://v2.spacy.io/*", to="https://spacy.io/:splat", force = true}, + {from = "https://nightly.spacy.io/*", to="https://spacy.io/:splat", force = true}, + {from = "https://v2.spacy.io/*", to="https://v2-spacy-io.spacy.io/:splat", force = true, status = 200}, # Old subdomains {from = "https://survey.spacy.io/*", to = "https://spacy.io", force = true}, {from = "http://survey.spacy.io/*", to = "https://spacy.io", force = true}, diff --git a/website/docs/usage/layers-architectures.md b/website/docs/usage/layers-architectures.md index 13e474bfe..d7a7d3ce8 100644 --- a/website/docs/usage/layers-architectures.md +++ b/website/docs/usage/layers-architectures.md @@ -537,15 +537,17 @@ two major steps required: pass through the `nlp` pipeline. -Run this example use-case by using our project template. It includes all the +Run this example use-case by using our project template. It includes all the code to create the ML model and the pipeline component from scratch. -It also contains two config files to train the model: +It also contains two config files to train the model: one to run on CPU with a Tok2Vec layer, and one for the GPU using a transformer. -The project applies the relation extraction component to identify biomolecular -interactions in a sample dataset, but you can easily swap in your own dataset +The project applies the relation extraction component to identify biomolecular +interactions in a sample dataset, but you can easily swap in your own dataset for your experiments in any other domain. + + #### Step 1: Implementing the Model {#component-rel-model} We need to implement a [`Model`](https://thinc.ai/docs/api-model) that takes a @@ -824,7 +826,7 @@ will predict scores for each label. We add convenience methods to easily retrieve and add to them. ```python -### The constructor (continued) +### The constructor (continued) def __init__(self, vocab, model, name="rel"): """Create a component instance.""" # ... @@ -1041,11 +1043,11 @@ def make_relation_extractor(nlp, name, model): ``` -Run this example use-case by using our project template. It includes all the +Run this example use-case by using our project template. It includes all the code to create the ML model and the pipeline component from scratch. -It contains two config files to train the model: +It contains two config files to train the model: one to run on CPU with a Tok2Vec layer, and one for the GPU using a transformer. -The project applies the relation extraction component to identify biomolecular -interactions, but you can easily swap in your own dataset for your experiments +The project applies the relation extraction component to identify biomolecular +interactions, but you can easily swap in your own dataset for your experiments in any other domain. diff --git a/website/docs/usage/training.md b/website/docs/usage/training.md index ef7e5a157..72ac50d95 100644 --- a/website/docs/usage/training.md +++ b/website/docs/usage/training.md @@ -193,6 +193,8 @@ available for the different architectures are documented with the + + ### Config lifecycle at runtime and training {#config-lifecycle} A pipeline's `config.cfg` is considered the "single source of truth", both at diff --git a/website/docs/usage/v3.md b/website/docs/usage/v3.md index e0106d79a..9219c7268 100644 --- a/website/docs/usage/v3.md +++ b/website/docs/usage/v3.md @@ -67,6 +67,16 @@ improvements**. The [API docs](/api) include additional deprecation notes. New methods and functions that were introduced in this version are marked with the tag 3. + + + + + + + + + + ### Transformer-based pipelines {#features-transformers} > #### Example diff --git a/website/gatsby-config.js b/website/gatsby-config.js index ea88e4890..1d919dc33 100644 --- a/website/gatsby-config.js +++ b/website/gatsby-config.js @@ -19,11 +19,11 @@ const universe = require('./meta/universe.json') const DEFAULT_TEMPLATE = path.resolve('./src/templates/index.js') -const isNightly = !!+process.env.SPACY_NIGHTLY || site.nightlyBranches.includes(process.env.BRANCH) -const favicon = isNightly ? `src/images/icon_nightly.png` : `src/images/icon.png` -const binderBranch = isNightly ? 'nightly' : site.binderBranch -const siteUrl = isNightly ? site.siteUrlNightly : site.siteUrl -const domain = isNightly ? site.domainNightly : site.domain +const domain = process.env.BRANCH || site.domain +const siteUrl = `https://${domain}` +const isNightly = site.nightlyBranches.includes(domain) +const isLegacy = site.legacy || !!+process.env.SPACY_LEGACY +const favicon = `src/images/icon${isNightly ? '_nightly' : isLegacy ? '_legacy' : ''}.png` const branch = isNightly ? 'develop' : 'master' // Those variables are going to be replaced in the Markdown, e.g. %%GITHUB_SPACY @@ -53,7 +53,8 @@ module.exports = { counts: getCounts(models.languages), universe, nightly: isNightly, - binderBranch, + legacy: isLegacy, + binderBranch: domain, siteUrl, }, diff --git a/website/meta/site.json b/website/meta/site.json index fcff96b56..e84a282ae 100644 --- a/website/meta/site.json +++ b/website/meta/site.json @@ -2,11 +2,9 @@ "title": "spaCy", "description": "spaCy is a free open-source library for Natural Language Processing in Python. It features NER, POS tagging, dependency parsing, word vectors and more.", "slogan": "Industrial-strength Natural Language Processing in Python", - "siteUrl": "https://spacy.io", "domain": "spacy.io", - "siteUrlNightly": "https://nightly.spacy.io", - "domainNightly": "nightly.spacy.io", "nightlyBranches": ["nightly.spacy.io"], + "legacy": false, "email": "contact@explosion.ai", "company": "Explosion", "companyUrl": "https://explosion.ai", diff --git a/website/package.json b/website/package.json index def94a9c2..ef62f3c19 100644 --- a/website/package.json +++ b/website/package.json @@ -57,6 +57,7 @@ "build": "npm run python:install && npm run python:setup && gatsby build", "dev": "npm run python:setup && gatsby develop", "dev:nightly": "BRANCH=nightly.spacy.io npm run dev", + "dev:legacy": "SPACY_LEGACY=1 npm run dev", "lint": "eslint **", "clear": "rm -rf .cache", "test": "echo \"Write tests! -> https://gatsby.app/unit-testing\"", diff --git a/website/src/components/embed.js b/website/src/components/embed.js index 90a640fe2..dc25ae079 100644 --- a/website/src/components/embed.js +++ b/website/src/components/embed.js @@ -8,8 +8,8 @@ import { markdownToReact } from './util' import classes from '../styles/embed.module.sass' -const YouTube = ({ id, ratio = '16x9' }) => { - const embedClassNames = classNames(classes.root, classes.responsive, { +const YouTube = ({ id, ratio = '16x9', className }) => { + const embedClassNames = classNames(classes.root, classes.responsive, className, { [classes.ratio16x9]: ratio === '16x9', [classes.ratio4x3]: ratio === '4x3', }) diff --git a/website/src/components/landing.js b/website/src/components/landing.js index 96f9640ce..de054ddce 100644 --- a/website/src/components/landing.js +++ b/website/src/components/landing.js @@ -1,10 +1,12 @@ import React from 'react' import classNames from 'classnames' -import pattern from '../images/pattern_blue.jpg' +import patternDefault from '../images/pattern_blue.jpg' import patternNightly from '../images/pattern_nightly.jpg' -import patternOverlay from '../images/pattern_landing.jpg' -import patternOverlayNightly from '../images/pattern_landing_nightly.jpg' +import patternLegacy from '../images/pattern_legacy.jpg' +import overlayDefault from '../images/pattern_landing.jpg' +import overlayNightly from '../images/pattern_landing_nightly.jpg' +import overlayLegacy from '../images/pattern_landing_legacy.jpg' import Grid from './grid' import { Content } from './main' @@ -14,9 +16,15 @@ import { H1, H2, H3 } from './typography' import Link from './link' import classes from '../styles/landing.module.sass' -export const LandingHeader = ({ nightly, style = {}, children }) => { - const overlay = nightly ? patternOverlayNightly : patternOverlay - const wrapperStyle = { backgroundImage: `url(${nightly ? patternNightly : pattern})` } +function getPattern(nightly, legacy) { + if (nightly) return { pattern: patternNightly, overlay: overlayNightly } + if (legacy) return { pattern: patternLegacy, overlay: overlayLegacy } + return { pattern: patternDefault, overlay: overlayDefault } +} + +export const LandingHeader = ({ nightly, legacy, style = {}, children }) => { + const { pattern, overlay } = getPattern(nightly, legacy) + const wrapperStyle = { backgroundImage: `url(${pattern})` } const contentStyle = { backgroundImage: `url(${overlay})`, ...style } return (
@@ -109,16 +117,18 @@ export const LandingBanner = ({ return (
- - {label && ( -
- {label} -
- )} - - {title} - -
+ {(title || label) && ( + + {label && ( +
+ {label} +
+ )} + + {title} + +
+ )}

{children}

diff --git a/website/src/components/main.js b/website/src/components/main.js index f0ca0ac04..a11a04305 100644 --- a/website/src/components/main.js +++ b/website/src/components/main.js @@ -6,6 +6,7 @@ import patternBlue from '../images/pattern_blue.jpg' import patternGreen from '../images/pattern_green.jpg' import patternPurple from '../images/pattern_purple.jpg' import patternNightly from '../images/pattern_nightly.jpg' +import patternLegacy from '../images/pattern_legacy.jpg' import classes from '../styles/main.module.sass' const patterns = { @@ -13,6 +14,7 @@ const patterns = { green: patternGreen, purple: patternPurple, nightly: patternNightly, + legacy: patternLegacy, } export const Content = ({ Component = 'div', className, children }) => ( diff --git a/website/src/components/navigation.js b/website/src/components/navigation.js index f7264f0f5..10bcb4d30 100644 --- a/website/src/components/navigation.js +++ b/website/src/components/navigation.js @@ -26,12 +26,18 @@ const NavigationDropdown = ({ items = [], section }) => { ) } -export default function Navigation({ title, items = [], section, search, children }) { +export default function Navigation({ title, items = [], section, search, alert, children }) { return (