Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Bojun-Feng committed Oct 6, 2023
1 parent 3a5082f commit 33325c1
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions xinference/web/ui/src/scenes/launch_model/modelCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ const ModelCard = ({ url, modelData }) => {
const [selected, setSelected] = useState(false);
const { isCallingApi, setIsCallingApi } = useContext(ApiContext);
const { isUpdatingModel } = useContext(ApiContext);
const isMacLike = /(Mac|iPhone|iPod|iPad)/i.test(
window.navigator.userAgent.toLowerCase()
);

// Model parameter selections
const [modelFormat, setModelFormat] = useState("");
Expand Down Expand Up @@ -47,7 +50,7 @@ const ModelCard = ({ url, modelData }) => {
...new Set(
modelFamily
.filter((spec) => spec.model_format === modelFormat)
.map((spec) => spec.model_size_in_billions),
.map((spec) => spec.model_size_in_billions)
),
];
setSizeOptions(sizes);
Expand All @@ -63,9 +66,9 @@ const ModelCard = ({ url, modelData }) => {
.filter(
(spec) =>
spec.model_format === modelFormat &&
spec.model_size_in_billions === parseFloat(modelSize),
spec.model_size_in_billions === parseFloat(modelSize)
)
.flatMap((spec) => spec.quantizations),
.flatMap((spec) => spec.quantizations)
),
];
setQuantizationOptions(quants);
Expand Down Expand Up @@ -363,11 +366,16 @@ const ModelCard = ({ url, modelData }) => {
onChange={(e) => setQuantization(e.target.value)}
label="Quantization"
>
{quantizationOptions.map((quant) => (
<MenuItem key={quant} value={quant}>
{quant}
</MenuItem>
))}
{quantizationOptions
.filter(
(quant) =>
!(isMacLike && (quant === "4-bit" || quant === "8-bit"))
)
.map((quant) => (
<MenuItem key={quant} value={quant}>
{quant}
</MenuItem>
))}
</Select>
</FormControl>
)}
Expand Down

0 comments on commit 33325c1

Please sign in to comment.