File size: 2,992 Bytes
22f8eb7 1b3b6e1 31283f8 22f8eb7 93d1827 22f8eb7 93d1827 22f8eb7 31283f8 22f8eb7 31283f8 1b3b6e1 31283f8 1b3b6e1 22f8eb7 31283f8 93d1827 22f8eb7 1b3b6e1 93d1827 22f8eb7 93d1827 22f8eb7 93d1827 22f8eb7 93d1827 22f8eb7 1b3b6e1 22f8eb7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
import React from 'react'
import { useFeatureExtraction } from '../../contexts/FeatureExtractionContext'
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue
} from '@/components/ui/select'
const FeatureExtractionConfig = () => {
const { config, setConfig } = useFeatureExtraction()
return (
<div className="space-y-4">
<h3 className="text-lg font-semibold text-foreground">
Feature Extraction Settings
</h3>
<div className="space-y-3">
<div>
<label className="block text-sm font-medium text-foreground/80 mb-1">
Pooling Strategy
</label>
<Select
value={config.pooling}
onValueChange={(value) =>
setConfig((prev) => ({
...prev,
pooling: value as 'mean' | 'cls'
}))
}
>
<SelectTrigger className="w-full text-sm xl:text-base">
<SelectValue placeholder="Select a pooling strategy" />
</SelectTrigger>
<SelectContent>
<SelectItem
key="mean"
value="mean"
className="text-sm data-[state=checked]:font-bold"
>
Mean Pooling
</SelectItem>
<SelectItem
key="cls"
value="cls"
className="text-sm data-[state=checked]:font-bold"
>
CLS Token
</SelectItem>
</SelectContent>
</Select>
<p className="text-xs text-muted-foreground mt-1">
How to aggregate token embeddings into sentence embeddings
</p>
</div>
<div>
<label className="flex items-center space-x-2">
<input
type="checkbox"
checked={config.normalize}
onChange={(e) =>
setConfig((prev) => ({
...prev,
normalize: e.target.checked
}))
}
className="rounded border-input text-primary shadow-xs focus:border-ring focus:ring-3 focus:ring-ring/20"
/>
<span className="text-sm font-medium text-foreground/80">
Normalize Embeddings
</span>
</label>
<p className="text-xs text-muted-foreground mt-1 ml-6">
L2 normalize embeddings for better similarity calculations
</p>
</div>
</div>
<div className="pt-2 border-t border-border">
<div className="text-xs text-muted-foreground">
<p className="mb-1">
<strong>Mean Pooling:</strong> Average all token embeddings
</p>
<p className="mb-1">
<strong>CLS Token:</strong> Use the [CLS] token embedding (if
available)
</p>
</div>
</div>
</div>
)
}
export default FeatureExtractionConfig
|